Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup depenedencies in compiler plugin's POM #233

Merged
merged 1 commit into from
Jan 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compiler-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ fun ModuleDependency.includeJars(vararg names: String) {
}
}

// WARNING: remember to update the dependencies in symbol-processing as well.
dependencies {
implementation(kotlin("stdlib", kotlinBaseVersion))
implementation("org.jetbrains.kotlin:kotlin-compiler:$kotlinBaseVersion")
Expand Down
33 changes: 22 additions & 11 deletions symbol-processing/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

val kotlinBaseVersion: String by project

plugins {
kotlin("jvm")
id("com.github.johnrengelman.shadow") version "6.0.0"
Expand All @@ -10,20 +12,11 @@ val packedJars by configurations.creating

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

tasks.withType<ShadowJar>() {
archiveClassifier.set("")
from(packedJars)
exclude(
"kotlin/**",
"org/intellij/**",
"org/jetbrains/annotations/**",
"META-INF/maven/org.jetbrains/annotations/*",
"META-INF/kotlin-stdlib*"
)

relocate("com.intellij", "org.jetbrains.kotlin.com.intellij")
}

Expand All @@ -34,7 +27,6 @@ tasks {

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

Expand All @@ -49,11 +41,30 @@ publishing {
val publication = create<MavenPublication>("shadow") {
artifactId = "symbol-processing"
artifact(tasks["sourcesJar"])
artifact(tasks["shadowJar"])
pom {
name.set("com.google.devtools.ksp:symbol-processing")
description.set("Symbol processing for Kotlin")
// FIXME: figure out how to make ShadowJar generate dependencies in POM,
// or simply depends on kotlin-compiler-embeddable so that relocation
// isn't needed, at the price of giving up composite build.
withXml {
fun groovy.util.Node.addDependency(groupId: String, artifactId: String, version: String, scope: String = "runtime") {
appendNode("dependency").apply {
appendNode("groupId", groupId)
appendNode("artifactId", artifactId)
appendNode("version", version)
appendNode("scope", scope)
}
}

asNode().appendNode("dependencies").apply {
addDependency("org.jetbrains.kotlin", "kotlin-stdlib", kotlinBaseVersion)
addDependency("org.jetbrains.kotlin", "kotlin-compiler-embeddable", kotlinBaseVersion)
addDependency("com.google.devtools.ksp", "symbol-processing-api", version)
}
}
}
}
project.shadow.component(publication)
}
}