Minor: Cleanup :prepare:compiler build script
This commit is contained in:
@@ -10,21 +10,18 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// You can run Gradle with "-Pkotlin.build.proguard=true" to enable ProGuard run on kotlin-compiler.jar (on TeamCity, ProGuard always runs)
|
// You can run Gradle with "-Pkotlin.build.proguard=true" to enable ProGuard run on kotlin-compiler.jar (on TeamCity, ProGuard always runs)
|
||||||
val shrink =
|
val shrink = findProperty("kotlin.build.proguard")?.toString()?.toBoolean() ?: hasProperty("teamcity")
|
||||||
findProperty("kotlin.build.proguard")?.toString()?.toBoolean()
|
|
||||||
?: hasProperty("teamcity")
|
|
||||||
|
|
||||||
val fatJarContents by configurations.creating
|
val fatJarContents by configurations.creating
|
||||||
|
|
||||||
val fatJarContentsStripMetadata by configurations.creating
|
val fatJarContentsStripMetadata by configurations.creating
|
||||||
val fatJarContentsStripServices by configurations.creating
|
val fatJarContentsStripServices by configurations.creating
|
||||||
val fatJar by configurations.creating
|
|
||||||
val compilerJar by configurations.creating
|
|
||||||
val runtimeJar by configurations.creating
|
val runtimeJar by configurations.creating
|
||||||
val compile by configurations // maven plugin writes pom compile scope from compile configuration by default
|
val compile by configurations // maven plugin writes pom compile scope from compile configuration by default
|
||||||
val libraries by configurations.creating {
|
val libraries by configurations.creating {
|
||||||
extendsFrom(compile)
|
extendsFrom(compile)
|
||||||
}
|
}
|
||||||
|
|
||||||
val trove4jJar by configurations.creating
|
val trove4jJar by configurations.creating
|
||||||
val ktorNetworkJar by configurations.creating
|
val ktorNetworkJar by configurations.creating
|
||||||
|
|
||||||
@@ -88,6 +85,7 @@ dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fatJarContentsStripServices(jpsStandalone()) { includeJars("jps-model") }
|
fatJarContentsStripServices(jpsStandalone()) { includeJars("jps-model") }
|
||||||
|
|
||||||
fatJarContentsStripMetadata(intellijDep()) { includeJars("oro-2.0.8", "jdom", "log4j" ) }
|
fatJarContentsStripMetadata(intellijDep()) { includeJars("oro-2.0.8", "jdom", "log4j" ) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,14 +94,12 @@ publish()
|
|||||||
noDefaultJar()
|
noDefaultJar()
|
||||||
|
|
||||||
val packCompiler by task<ShadowJar> {
|
val packCompiler by task<ShadowJar> {
|
||||||
configurations = listOf(fatJar)
|
configurations = listOf(fatJarContents)
|
||||||
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||||
destinationDir = File(buildDir, "libs")
|
destinationDir = File(buildDir, "libs")
|
||||||
|
|
||||||
setupPublicJar(compilerBaseName, "before-proguard")
|
setupPublicJar(compilerBaseName, "before-proguard")
|
||||||
|
|
||||||
from(fatJarContents)
|
|
||||||
|
|
||||||
dependsOn(fatJarContentsStripServices)
|
dependsOn(fatJarContentsStripServices)
|
||||||
from {
|
from {
|
||||||
fatJarContentsStripServices.files.map {
|
fatJarContentsStripServices.files.map {
|
||||||
@@ -131,15 +127,15 @@ val proguard by task<ProGuardTask> {
|
|||||||
inputs.files(packCompiler.outputs.files.singleFile)
|
inputs.files(packCompiler.outputs.files.singleFile)
|
||||||
outputs.file(outputJar)
|
outputs.file(outputJar)
|
||||||
|
|
||||||
// TODO: remove after dropping compatibility with ant build
|
libraryjars(mapOf("filter" to "!META-INF/versions/**"), libraries)
|
||||||
|
|
||||||
|
printconfiguration("$buildDir/compiler.pro.dump")
|
||||||
|
|
||||||
|
// This properties are used by proguard config compiler.pro
|
||||||
doFirst {
|
doFirst {
|
||||||
System.setProperty("kotlin-compiler-jar-before-shrink", packCompiler.outputs.files.singleFile.canonicalPath)
|
System.setProperty("kotlin-compiler-jar-before-shrink", packCompiler.outputs.files.singleFile.canonicalPath)
|
||||||
System.setProperty("kotlin-compiler-jar", outputJar.canonicalPath)
|
System.setProperty("kotlin-compiler-jar", outputJar.canonicalPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
libraryjars(mapOf("filter" to "!META-INF/versions/**"), libraries)
|
|
||||||
|
|
||||||
printconfiguration("$buildDir/compiler.pro.dump")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val pack = if (shrink) proguard else packCompiler
|
val pack = if (shrink) proguard else packCompiler
|
||||||
|
|||||||
Reference in New Issue
Block a user