Skip to content

Commit

Permalink
KSP2: Rename common-util in the embeddable
Browse files Browse the repository at this point in the history
  • Loading branch information
ting-yuan committed Feb 22, 2024
1 parent b78fa5d commit 86f0b6a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions symbol-processing-aa-embeddable/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ val prefixesToRelocate = listOf(
"org.codehaus.",
"com.github.benmanes.caffeine.",
"com.google.common.",
"com.google.devtools.ksp.common.",
"com.google.errorprone.",
"com.google.gwt.",
"com.google.j2objc.",
Expand Down Expand Up @@ -79,8 +80,13 @@ tasks.withType<ShadowJar> {
}
}

val prefixesToRelocateStripped = prefixesToRelocate.map {
Pair(it.first.trim('.'), it.second.trim('.'))
}

// TODO: match with Trie
fun String.replaceWithKsp() =
prefixesToRelocate.fold(this) { acc, (f, t) ->
prefixesToRelocateStripped.fold(this) { acc, (f, t) ->
acc.replace("package $f", "package $t")
.replace("import $f", "import $t")
}
Expand Down Expand Up @@ -131,14 +137,14 @@ tasks {
project(":kotlin-analysis-api").configurations.getByName("depSourceJars").resolve().forEach {
from(zipTree(it))
}
from(project(":common-util").sourceSets.main.get().allSource)
into("$DEP_SOURCES_DIR/ksp")
}
val sourcesJar by creating(Jar::class) {
dependsOn(copyDeps)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveClassifier.set("sources")
from(project(":kotlin-analysis-api").sourceSets.main.get().allSource)
from(project(":common-util").sourceSets.main.get().allSource)
from(DEP_SOURCES_DIR)
filter { it.replaceWithKsp() }
}
Expand Down

0 comments on commit 86f0b6a

Please sign in to comment.