Move embeddable compiler shading logic to buildSrc, implement rewriteDeps task
the task takes a jar an a shading task (like the one that creates embeddable compiler) and rewrites jar's dependencies to the shaded ones according the the shade task.
This commit is contained in:
@@ -1,44 +1,11 @@
|
||||
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
|
||||
description = "Kotlin Compiler (embeddable)"
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath("com.github.jengelman.gradle.plugins:shadow:${property("versions.shadow")}")
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
`java`
|
||||
}
|
||||
|
||||
val compilerJar by configurations.creating
|
||||
|
||||
val kotlinEmbeddableRootPackage = "org.jetbrains.kotlin"
|
||||
|
||||
val packagesToRelocate =
|
||||
listOf(
|
||||
// "com.intellij",
|
||||
"com.google",
|
||||
"com.sampullara",
|
||||
"org.apache",
|
||||
"org.jdom",
|
||||
"org.picocontainer",
|
||||
"jline",
|
||||
"gnu",
|
||||
"javax.inject",
|
||||
"org.fusesource")
|
||||
|
||||
dependencies {
|
||||
val compile by configurations
|
||||
|
||||
compilerJar(projectRuntimeJar(":kotlin-compiler"))
|
||||
|
||||
compile(project(":kotlin-stdlib"))
|
||||
compile(project(":kotlin-script-runtime"))
|
||||
compile(project(":kotlin-reflect"))
|
||||
@@ -46,20 +13,7 @@ dependencies {
|
||||
|
||||
noDefaultJar()
|
||||
|
||||
runtimeJar(task<ShadowJar>("embeddable")) {
|
||||
destinationDir = File(buildDir, "libs")
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
// dependsOn(":kotlin-compiler:proguard")
|
||||
from(compilerJar)
|
||||
relocate("com.google.protobuf", "org.jetbrains.kotlin.protobuf")
|
||||
packagesToRelocate.forEach {
|
||||
relocate(it, "$kotlinEmbeddableRootPackage.$it")
|
||||
}
|
||||
relocate("org.fusesource", "$kotlinEmbeddableRootPackage.org.fusesource") {
|
||||
// TODO: remove "it." after #KT-12848 get addressed
|
||||
exclude("org.fusesource.jansi.internal.CLibrary")
|
||||
}
|
||||
}
|
||||
runtimeJar(embeddableCompiler())
|
||||
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
|
||||
Reference in New Issue
Block a user