Build: Use configurations property for shadowJar in :kotlin-main-kts
It marked as classpath and improves cache reuse between different builds
This commit is contained in:
@@ -11,6 +11,8 @@ plugins {
|
||||
val jarBaseName = property("archivesBaseName") as String
|
||||
|
||||
val proguardLibraryJars by configurations.creating
|
||||
val relocatedJarContents by configurations.creating
|
||||
val embedded by configurations
|
||||
|
||||
dependencies {
|
||||
compileOnly("org.apache.ivy:ivy:2.5.0")
|
||||
@@ -35,6 +37,9 @@ dependencies {
|
||||
proguardLibraryJars(kotlinStdlib())
|
||||
proguardLibraryJars(project(":kotlin-reflect"))
|
||||
proguardLibraryJars(project(":kotlin-compiler"))
|
||||
|
||||
relocatedJarContents(embedded)
|
||||
relocatedJarContents(mainSourceSet.output)
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
@@ -46,15 +51,12 @@ publish()
|
||||
|
||||
noDefaultJar()
|
||||
|
||||
val packJar by task<ShadowJar> {
|
||||
configurations = emptyList()
|
||||
val relocatedJar by task<ShadowJar> {
|
||||
configurations = listOf(relocatedJarContents)
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
destinationDirectory.set(File(buildDir, "libs"))
|
||||
archiveClassifier.set("before-proguard")
|
||||
|
||||
from(mainSourceSet.output)
|
||||
from(project.configurations.embedded)
|
||||
|
||||
// don't add this files to resources classpath to avoid IDE exceptions on kotlin project
|
||||
from("jar-resources")
|
||||
|
||||
@@ -66,23 +68,23 @@ val packJar by task<ShadowJar> {
|
||||
}
|
||||
|
||||
val proguard by task<ProGuardTask> {
|
||||
dependsOn(packJar)
|
||||
dependsOn(relocatedJar)
|
||||
configuration("main-kts.pro")
|
||||
|
||||
injars(mapOf("filter" to "!META-INF/versions/**"), packJar.get().outputs.files)
|
||||
injars(mapOf("filter" to "!META-INF/versions/**"), relocatedJar.get().outputs.files)
|
||||
|
||||
val outputJar = fileFrom(buildDir, "libs", "$jarBaseName-$version-after-proguard.jar")
|
||||
|
||||
outjars(outputJar)
|
||||
|
||||
inputs.files(packJar.get().outputs.files.singleFile)
|
||||
inputs.files(relocatedJar.get().outputs.files.singleFile)
|
||||
outputs.file(outputJar)
|
||||
|
||||
libraryjars(mapOf("filter" to "!META-INF/versions/**"), proguardLibraryJars)
|
||||
}
|
||||
|
||||
val resultJar by task<Jar> {
|
||||
val pack = if (kotlinBuildProperties.proguard) proguard else packJar
|
||||
val pack = if (kotlinBuildProperties.proguard) proguard else relocatedJar
|
||||
dependsOn(pack)
|
||||
setupPublicJar(jarBaseName)
|
||||
from {
|
||||
|
||||
Reference in New Issue
Block a user