singleOutputFile() method used Task.getProject() and that's not allowed with CC

Required for KTI-1553
This commit is contained in:
cristiangarcia
2024-02-08 22:10:29 +01:00
committed by Space Team
parent 21fff5634e
commit cb0d78d443
6 changed files with 13 additions and 12 deletions
+1 -1
View File
@@ -234,7 +234,7 @@ val intermediate = when {
val result by task<Jar> { val result by task<Jar> {
dependsOn(intermediate) dependsOn(intermediate)
from { from {
zipTree(intermediate.get().singleOutputFile()) zipTree(intermediate.get().singleOutputFile(layout))
} }
from(zipTree(provider { reflectShadowJar.get().archiveFile.get().asFile })) { from(zipTree(provider { reflectShadowJar.get().archiveFile.get().asFile })) {
include("META-INF/versions/**") include("META-INF/versions/**")
@@ -83,7 +83,7 @@ val relocatedJar by task<ShadowJar> {
val normalizeComponentsXmlEndings by tasks.registering { val normalizeComponentsXmlEndings by tasks.registering {
dependsOn(relocatedJar) dependsOn(relocatedJar)
val outputFile = layout.buildDirectory.file("$name/${ComponentsXmlResourceTransformer.COMPONENTS_XML_PATH}") val outputFile = layout.buildDirectory.file("$name/${ComponentsXmlResourceTransformer.COMPONENTS_XML_PATH}")
val relocatedJarFile = project.provider { relocatedJar.get().singleOutputFile() } val relocatedJarFile = relocatedJar.map { it.singleOutputFile(layout) }
val archiveOperations = serviceOf<ArchiveOperations>() val archiveOperations = serviceOf<ArchiveOperations>()
outputs.file(outputFile) outputs.file(outputFile)
@@ -105,14 +105,14 @@ val normalizedJar by task<Jar> {
archiveClassifier.set("normalized") archiveClassifier.set("normalized")
from { from {
zipTree(relocatedJar.get().singleOutputFile()).matching { zipTree(relocatedJar.get().singleOutputFile(layout)).matching {
exclude(ComponentsXmlResourceTransformer.COMPONENTS_XML_PATH) exclude(ComponentsXmlResourceTransformer.COMPONENTS_XML_PATH)
} }
} }
into(ComponentsXmlResourceTransformer.COMPONENTS_XML_PATH.substringBeforeLast("/")) { into(ComponentsXmlResourceTransformer.COMPONENTS_XML_PATH.substringBeforeLast("/")) {
from { from {
normalizeComponentsXmlEndings.get().singleOutputFile() normalizeComponentsXmlEndings.map { it.singleOutputFile(layout) }
} }
} }
} }
@@ -156,7 +156,7 @@ val resultJar by task<Jar> {
dependsOn(pack) dependsOn(pack)
setupPublicJar(jarBaseName) setupPublicJar(jarBaseName)
from { from {
zipTree(pack.get().singleOutputFile()) zipTree(pack.map { it.singleOutputFile(layout) })
} }
} }
@@ -120,7 +120,7 @@ val resultJar by task<Jar> {
dependsOn(pack) dependsOn(pack)
setupPublicJar(jarBaseName) setupPublicJar(jarBaseName)
from { from {
zipTree(pack.get().singleOutputFile()) zipTree(pack.map { it.singleOutputFile(layout) })
} }
} }
+3 -3
View File
@@ -315,7 +315,7 @@ val proguard by task<CacheableProguardTask> {
**.class,**.properties,**.kt,**.kotlin_*,**.jnilib,**.so,**.dll,**.txt,**.caps, **.class,**.properties,**.kt,**.kotlin_*,**.jnilib,**.so,**.dll,**.txt,**.caps,
META-INF/services/**,META-INF/native/**,META-INF/extensions/**,META-INF/MANIFEST.MF, META-INF/services/**,META-INF/native/**,META-INF/extensions/**,META-INF/MANIFEST.MF,
messages/**""".trimIndent()), messages/**""".trimIndent()),
provider { packCompiler.get().outputs.files.singleFile } packCompiler.map { it.outputs.files.singleFile }
) )
outjars(layout.buildDirectory.file("libs/$compilerBaseName-after-proguard.jar")) outjars(layout.buildDirectory.file("libs/$compilerBaseName-after-proguard.jar"))
@@ -346,7 +346,7 @@ val proguard by task<CacheableProguardTask> {
printconfiguration(layout.buildDirectory.file("compiler.pro.dump")) printconfiguration(layout.buildDirectory.file("compiler.pro.dump"))
} }
val pack = if (kotlinBuildProperties.proguard) proguard else packCompiler val pack: TaskProvider<out DefaultTask> = if (kotlinBuildProperties.proguard) proguard else packCompiler
val distDir: String by rootProject.extra val distDir: String by rootProject.extra
val jar = runtimeJar { val jar = runtimeJar {
@@ -354,7 +354,7 @@ val jar = runtimeJar {
dependsOn(compilerVersion) dependsOn(compilerVersion)
from { from {
zipTree(pack.get().singleOutputFile()) pack.map { zipTree(it.singleOutputFile(layout)) }
} }
from { from {
@@ -17,7 +17,7 @@ idePluginDependency {
from { from {
val klibTask = project(jsRuntimeProjectName).tasks.getByName(klibTaskName) val klibTask = project(jsRuntimeProjectName).tasks.getByName(klibTaskName)
zipTree(klibTask.singleOutputFile()) zipTree(klibTask.singleOutputFile(layout))
} }
} }
} }
@@ -5,6 +5,7 @@ import groovy.lang.Closure
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.Task import org.gradle.api.Task
import org.gradle.api.file.CopySourceSpec import org.gradle.api.file.CopySourceSpec
import org.gradle.api.file.ProjectLayout
import org.gradle.api.file.SourceDirectorySet import org.gradle.api.file.SourceDirectorySet
import org.gradle.api.plugins.JavaPluginExtension import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.api.tasks.JavaExec import org.gradle.api.tasks.JavaExec
@@ -80,9 +81,9 @@ fun Project.findJavaPluginExtension(): JavaPluginExtension? = extensions.findByT
fun JavaExec.pathRelativeToWorkingDir(file: File): String = file.relativeTo(workingDir).invariantSeparatorsPath fun JavaExec.pathRelativeToWorkingDir(file: File): String = file.relativeTo(workingDir).invariantSeparatorsPath
fun Task.singleOutputFile(): File = when (this) { fun Task.singleOutputFile(layout: ProjectLayout): File = when (this) {
is AbstractArchiveTask -> archiveFile.get().asFile is AbstractArchiveTask -> archiveFile.get().asFile
is ProGuardTask -> project.file(outJarFiles.single()!!) is ProGuardTask -> layout.files(outJarFiles.single()!!).singleFile
else -> outputs.files.singleFile else -> outputs.files.singleFile
} }