Skip to content

Commit

Permalink
Pack and publish sources jars
Browse files Browse the repository at this point in the history
Change-Id: I06b529a2d5fbc8a3fff8323f6d0ae596589b3d68
  • Loading branch information
ting-yuan committed Sep 18, 2020
1 parent 13fddf9 commit 807f81d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
14 changes: 13 additions & 1 deletion api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,27 @@ plugins {
`maven-publish`
}

tasks {
val sourcesJar by creating(Jar::class) {
archiveClassifier.set("sources")
from(sourceSets.main.get().allSource)
}

artifacts {
archives(sourcesJar)
archives(jar)
}
}

publishing {
publications {
create<MavenPublication>("default") {
artifactId = "symbol-processing-api"
from(components["java"])
artifact(tasks["sourcesJar"])
}
repositories {
mavenLocal()
}
}
}

17 changes: 15 additions & 2 deletions symbol-processing/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies {
}

tasks.withType<ShadowJar>() {
classifier = ""
archiveClassifier.set("")
from(packedJars)
exclude(
"kotlin/**",
Expand All @@ -42,15 +42,28 @@ tasks.withType<ShadowJar>() {
}

tasks {
build {
publish {
dependsOn(shadowJar)
}

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

artifacts {
archives(sourcesJar)
archives(jar)
}
}

publishing {
publications {
val publication = create<MavenPublication>("shadow") {
artifactId = "symbol-processing"
artifact(tasks["sourcesJar"])
}
project.shadow.component(publication)
repositories {
Expand Down

0 comments on commit 807f81d

Please sign in to comment.