1 import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2
3 evaluationDependsOn(":common-util")
4 evaluationDependsOn(":compiler-plugin")
5
6 val kotlinBaseVersion: String by project
7 val signingKey: String? by project
8 val signingPassword: String? by project
9
<lambda>null10 plugins {
11 kotlin("jvm")
12 id("com.github.johnrengelman.shadow") version "6.0.0"
13 `maven-publish`
14 signing
15 }
16
17 val packedJars by configurations.creating
18
<lambda>null19 dependencies {
20 packedJars(project(":compiler-plugin")) { isTransitive = false }
21 packedJars(project(":common-util")) { isTransitive = false }
22 }
23
<lambda>null24 tasks.withType<ShadowJar>() {
25 archiveClassifier.set("")
26 // ShadowJar picks up the `compile` configuration by default and pulls stdlib in.
27 // Therefore, specifying another configuration instead.
28 configurations = listOf(packedJars)
29 relocate("com.intellij", "org.jetbrains.kotlin.com.intellij")
30 }
31
<lambda>null32 tasks {
33 publish {
34 dependsOn(shadowJar)
35 dependsOn(project(":compiler-plugin").tasks["dokkaJavadocJar"])
36 dependsOn(project(":compiler-plugin").tasks["sourcesJar"])
37 }
38 }
39
<lambda>null40 publishing {
41 publications {
42 create<MavenPublication>("shadow") {
43 artifactId = "symbol-processing"
44 artifact(project(":compiler-plugin").tasks["dokkaJavadocJar"])
45 artifact(project(":compiler-plugin").tasks["sourcesJar"])
46 artifact(tasks["shadowJar"])
47 pom {
48 name.set("com.google.devtools.ksp:symbol-processing")
49 description.set("Symbol processing for Kotlin")
50 // FIXME: figure out how to make ShadowJar generate dependencies in POM,
51 // or simply depends on kotlin-compiler-embeddable so that relocation
52 // isn't needed, at the price of giving up composite build.
53 withXml {
54 fun groovy.util.Node.addDependency(
55 groupId: String,
56 artifactId: String,
57 version: String,
58 scope: String = "runtime"
59 ) {
60 appendNode("dependency").apply {
61 appendNode("groupId", groupId)
62 appendNode("artifactId", artifactId)
63 appendNode("version", version)
64 appendNode("scope", scope)
65 }
66 }
67
68 asNode().appendNode("dependencies").apply {
69 addDependency("org.jetbrains.kotlin", "kotlin-stdlib", kotlinBaseVersion)
70 addDependency("org.jetbrains.kotlin", "kotlin-compiler-embeddable", kotlinBaseVersion)
71 addDependency("com.google.devtools.ksp", "symbol-processing-api", version)
72 }
73 }
74 }
75 }
76 }
77 }
78
<lambda>null79 signing {
80 isRequired = hasProperty("signingKey")
81 useInMemoryPgpKeys(signingKey, signingPassword)
82 sign(extensions.getByType<PublishingExtension>().publications)
83 }
84