Skip to content

Commit

Permalink
pack util module into symbol-processing-cmdline artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
neetopia authored and ting-yuan committed Feb 7, 2022
1 parent d8792ed commit 0047c43
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 15 deletions.
1 change: 1 addition & 0 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ description = "Kotlin Symbol Processing API"

val signingKey: String? by project
val signingPassword: String? by project
val kotlinBaseVersion: String by project

tasks.withType<KotlinCompile> {
kotlinOptions.freeCompilerArgs += "-Xjvm-default=compatibility"
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions compiler-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ dependencies {
implementation("org.jetbrains.kotlin:kotlin-compiler:$kotlinBaseVersion")

implementation(project(":api"))
implementation(project(":util"))
implementation(project(":common-util"))

// workaround: IntelliJ doesn't resolve packed classes from included builds.
if (kotlinProjectPath != null) {
Expand All @@ -58,7 +58,7 @@ dependencies {
testImplementation("junit:junit:$junitVersion")

testImplementation(project(":api"))
testImplementation(project(":util"))
testImplementation(project(":common-util"))

libsForTesting(kotlin("stdlib", kotlinBaseVersion))
libsForTesting(kotlin("test", kotlinBaseVersion))
Expand Down
1 change: 1 addition & 0 deletions integration-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ tasks.named<Test>("test") {
dependsOn(":api:publishAllPublicationsToTestRepository")
dependsOn(":gradle-plugin:publishAllPublicationsToTestRepository")
dependsOn(":symbol-processing:publishAllPublicationsToTestRepository")
dependsOn(":symbol-processing-cmdline:publishAllPublicationsToTestRepository")
}
3 changes: 2 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ pluginManagement {

include("api")
include("gradle-plugin")
include("common-util")
include("compiler-plugin")
include("symbol-processing")
include("symbol-processing-cmdline")
include("integration-tests")
include("util")

val kotlinProjectPath: String? by settings
if (kotlinProjectPath != null) {
Expand Down
59 changes: 59 additions & 0 deletions symbol-processing-cmdline/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

val kotlinBaseVersion: String by project
val signingKey: String? by project
val signingPassword: String? by project

plugins {
kotlin("jvm")
id("com.github.johnrengelman.shadow") version "6.0.0"
`maven-publish`
signing
}

val packedJars by configurations.creating

dependencies {
packedJars(project(":compiler-plugin")) { isTransitive = false }
packedJars(project(":common-util")) { isTransitive = false }
}

tasks.withType<ShadowJar>() {
archiveClassifier.set("")
// ShadowJar picks up the `compile` configuration by default and pulls stdlib in.
// Therefore, specifying another configuration instead.
configurations = listOf(packedJars)
}

tasks {
publish {
dependsOn(shadowJar)
dependsOn(project(":compiler-plugin").tasks["dokkaJavadocJar"])
}

val sourcesJar by creating(Jar::class) {
archiveClassifier.set("sources")
from(project(":compiler-plugin").sourceSets.main.get().allSource)
from(project(":common-util").sourceSets.main.get().allSource)
}
}

publishing {
publications {
create<MavenPublication>("shadow") {
artifactId = "symbol-processing-cmdline"
artifact(tasks["sourcesJar"])
artifact(project(":compiler-plugin").tasks["dokkaJavadocJar"])
artifact(tasks["shadowJar"])
pom {
name.set("com.google.devtools.ksp:symbol-processing-cmdline")
description.set("Symbol processing for K/N and command line")
}
}
}
}

signing {
isRequired = hasProperty("signingKey") && !gradle.taskGraph.hasTask("publishToMavenLocal")
sign(extensions.getByType<PublishingExtension>().publications)
}
14 changes: 2 additions & 12 deletions symbol-processing/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ val packedJars by configurations.creating

dependencies {
packedJars(project(":compiler-plugin")) { isTransitive = false }
packedJars(project(":util")) { isTransitive = false }
packedJars(project(":common-util")) { isTransitive = false }
}

tasks.withType<ShadowJar>() {
Expand All @@ -35,6 +35,7 @@ tasks {
val sourcesJar by creating(Jar::class) {
archiveClassifier.set("sources")
from(project(":compiler-plugin").sourceSets.main.get().allSource)
from(project(":common-util").sourceSets.main.get().allSource)
}
}

Expand Down Expand Up @@ -74,17 +75,6 @@ publishing {
}
}
}

create<MavenPublication>("cmdline") {
artifactId = "symbol-processing-cmdline"
artifact(tasks["sourcesJar"])
artifact(project(":compiler-plugin").tasks["dokkaJavadocJar"])
from(project(":compiler-plugin").components["java"])
pom {
name.set("com.google.devtools.ksp:symbol-processing-cmdline")
description.set("Symbol processing for K/N and command line")
}
}
}
}

Expand Down

0 comments on commit 0047c43

Please sign in to comment.