1
1
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2
2
3
+ val kotlinBaseVersion: String by project
4
+
3
5
plugins {
4
6
kotlin(" jvm" )
5
7
id(" com.github.johnrengelman.shadow" ) version " 6.0.0"
@@ -10,20 +12,11 @@ val packedJars by configurations.creating
10
12
11
13
dependencies {
12
14
packedJars(project(" :compiler-plugin" )) { isTransitive = false }
13
- packedJars(project(" :api" )) { isTransitive = false }
14
15
}
15
16
16
17
tasks.withType<ShadowJar >() {
17
18
archiveClassifier.set(" " )
18
19
from(packedJars)
19
- exclude(
20
- " kotlin/**" ,
21
- " org/intellij/**" ,
22
- " org/jetbrains/annotations/**" ,
23
- " META-INF/maven/org.jetbrains/annotations/*" ,
24
- " META-INF/kotlin-stdlib*"
25
- )
26
-
27
20
relocate(" com.intellij" , " org.jetbrains.kotlin.com.intellij" )
28
21
}
29
22
@@ -34,7 +27,6 @@ tasks {
34
27
35
28
val sourcesJar by creating(Jar ::class ) {
36
29
archiveClassifier.set(" sources" )
37
- from(project(" :api" ).sourceSets.main.get().allSource)
38
30
from(project(" :compiler-plugin" ).sourceSets.main.get().allSource)
39
31
}
40
32
@@ -49,11 +41,30 @@ publishing {
49
41
val publication = create<MavenPublication >(" shadow" ) {
50
42
artifactId = " symbol-processing"
51
43
artifact(tasks[" sourcesJar" ])
44
+ artifact(tasks[" shadowJar" ])
52
45
pom {
53
46
name.set(" com.google.devtools.ksp:symbol-processing" )
54
47
description.set(" Symbol processing for Kotlin" )
48
+ // FIXME: figure out how to make ShadowJar generate dependencies in POM,
49
+ // or simply depends on kotlin-compiler-embeddable so that relocation
50
+ // isn't needed, at the price of giving up composite build.
51
+ withXml {
52
+ fun groovy.util.Node.addDependency (groupId : String , artifactId : String , version : String , scope : String = "runtime") {
53
+ appendNode(" dependency" ).apply {
54
+ appendNode(" groupId" , groupId)
55
+ appendNode(" artifactId" , artifactId)
56
+ appendNode(" version" , version)
57
+ appendNode(" scope" , scope)
58
+ }
59
+ }
60
+
61
+ asNode().appendNode(" dependencies" ).apply {
62
+ addDependency(" org.jetbrains.kotlin" , " kotlin-stdlib" , kotlinBaseVersion)
63
+ addDependency(" org.jetbrains.kotlin" , " kotlin-compiler-embeddable" , kotlinBaseVersion)
64
+ addDependency(" com.google.devtools.ksp" , " symbol-processing-api" , version)
65
+ }
66
+ }
55
67
}
56
68
}
57
- project.shadow.component(publication)
58
69
}
59
70
}
0 commit comments