Build: Normalize line separators in components.xml
of kotlin-scripting-dependencies-maven-all jar to produce same binaries on linux and windows #KTI-782
This commit is contained in:
committed by
teamcity
parent
6cc73a73ce
commit
649f246cef
@@ -52,7 +52,7 @@ val relocatedJar by task<ShadowJar> {
|
|||||||
configurations = listOf(embedded)
|
configurations = listOf(embedded)
|
||||||
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
||||||
destinationDirectory.set(File(buildDir, "libs"))
|
destinationDirectory.set(File(buildDir, "libs"))
|
||||||
archiveClassifier.set("before-proguard")
|
archiveClassifier.set("relocated")
|
||||||
|
|
||||||
transform(ComponentsXmlResourceTransformer())
|
transform(ComponentsXmlResourceTransformer())
|
||||||
|
|
||||||
@@ -63,11 +63,46 @@ val relocatedJar by task<ShadowJar> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val proguard by task<CacheableProguardTask> {
|
val normalizeComponentsXmlEndings by tasks.registering {
|
||||||
dependsOn(relocatedJar)
|
dependsOn(relocatedJar)
|
||||||
|
val outputDirectory = buildDir.resolve(name)
|
||||||
|
val outputFile = outputDirectory.resolve(ComponentsXmlResourceTransformer.COMPONENTS_XML_PATH)
|
||||||
|
outputs.file(outputFile)
|
||||||
|
|
||||||
|
doFirst {
|
||||||
|
val componentsXml = zipTree(relocatedJar.get().singleOutputFile()).matching {
|
||||||
|
include { it.path == ComponentsXmlResourceTransformer.COMPONENTS_XML_PATH }
|
||||||
|
}.single().readText()
|
||||||
|
val processedComponentsXml = componentsXml.replace("\r\n", "\n")
|
||||||
|
outputDirectory.mkdirs()
|
||||||
|
outputFile.writeText(processedComponentsXml)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val normalizedJar by task<Jar> {
|
||||||
|
dependsOn(relocatedJar)
|
||||||
|
dependsOn(normalizeComponentsXmlEndings)
|
||||||
|
|
||||||
|
archiveClassifier.set("normalized")
|
||||||
|
|
||||||
|
from {
|
||||||
|
zipTree(relocatedJar.get().singleOutputFile()).matching {
|
||||||
|
exclude(ComponentsXmlResourceTransformer.COMPONENTS_XML_PATH)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
into(ComponentsXmlResourceTransformer.COMPONENTS_XML_PATH.substringBeforeLast("/")) {
|
||||||
|
from {
|
||||||
|
normalizeComponentsXmlEndings.get().singleOutputFile()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val proguard by task<CacheableProguardTask> {
|
||||||
|
dependsOn(normalizedJar)
|
||||||
configuration("dependencies-maven.pro")
|
configuration("dependencies-maven.pro")
|
||||||
|
|
||||||
injars(mapOf("filter" to "!META-INF/versions/**,!kotlinx/coroutines/debug/**"), relocatedJar.get().outputs.files)
|
injars(mapOf("filter" to "!META-INF/versions/**,!kotlinx/coroutines/debug/**"), normalizedJar.get().outputs.files)
|
||||||
|
|
||||||
outjars(fileFrom(buildDir, "libs", "$jarBaseName-$version-after-proguard.jar"))
|
outjars(fileFrom(buildDir, "libs", "$jarBaseName-$version-after-proguard.jar"))
|
||||||
|
|
||||||
@@ -94,11 +129,10 @@ val proguard by task<CacheableProguardTask> {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val resultJar by task<Jar> {
|
val resultJar by task<Jar> {
|
||||||
val pack = if (kotlinBuildProperties.proguard) proguard else relocatedJar
|
val pack = if (kotlinBuildProperties.proguard) proguard else normalizedJar
|
||||||
dependsOn(pack)
|
dependsOn(pack)
|
||||||
setupPublicJar(jarBaseName)
|
setupPublicJar(jarBaseName)
|
||||||
from {
|
from {
|
||||||
@@ -106,6 +140,7 @@ val resultJar by task<Jar> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
addArtifact("runtime", resultJar)
|
addArtifact("runtime", resultJar)
|
||||||
addArtifact("runtimeElements", resultJar)
|
addArtifact("runtimeElements", resultJar)
|
||||||
addArtifact("archives", resultJar)
|
addArtifact("archives", resultJar)
|
||||||
|
|||||||
Reference in New Issue
Block a user