Apply -Xklib-relative-path-base to all KotlinCompile tasks
As absolute paths were also revealed in atomicfu.jar kotlin-stdlib-wasm kotlin-test-wasm Use solution from Alexander Likhachev (avoid accessing buildDir, projectDir in doFirst()) to prevent breaking the configuration cache. Should be removed after fixing KT-50876 KTI-729
This commit is contained in:
@@ -494,6 +494,17 @@ allprojects {
|
|||||||
apiVersion = kotlinLanguageVersion
|
apiVersion = kotlinLanguageVersion
|
||||||
freeCompilerArgs = commonCompilerArgs
|
freeCompilerArgs = commonCompilerArgs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val relativePathBaseArg: String? =
|
||||||
|
"-Xklib-relative-path-base=$buildDir,$projectDir".takeIf {
|
||||||
|
!kotlinBuildProperties.getBoolean("kotlin.build.use.absolute.paths.in.klib")
|
||||||
|
}
|
||||||
|
|
||||||
|
doFirst {
|
||||||
|
if (relativePathBaseArg != null) {
|
||||||
|
kotlinOptions.freeCompilerArgs += relativePathBaseArg
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val jvmCompilerArgs = listOf(
|
val jvmCompilerArgs = listOf(
|
||||||
|
|||||||
@@ -52,12 +52,6 @@ tasks.withType<KotlinCompile<*>>().configureEach {
|
|||||||
"-opt-in=kotlin.ExperimentalMultiplatform",
|
"-opt-in=kotlin.ExperimentalMultiplatform",
|
||||||
"-opt-in=kotlin.contracts.ExperimentalContracts"
|
"-opt-in=kotlin.contracts.ExperimentalContracts"
|
||||||
)
|
)
|
||||||
|
|
||||||
doFirst {
|
|
||||||
kotlinOptions.freeCompilerArgs += listOfNotNull(
|
|
||||||
"-Xklib-relative-path-base=$buildDir,$projectDir".takeIf { !kotlinBuildProperties.getBoolean("kotlin.build.use.absolute.paths.in.klib") }
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named("compileKotlinJs") {
|
tasks.named("compileKotlinJs") {
|
||||||
|
|||||||
@@ -143,12 +143,6 @@ tasks.withType<KotlinCompile<*>>().configureEach {
|
|||||||
"-opt-in=kotlin.ExperimentalUnsignedTypes",
|
"-opt-in=kotlin.ExperimentalUnsignedTypes",
|
||||||
"-opt-in=kotlin.ExperimentalStdlibApi"
|
"-opt-in=kotlin.ExperimentalStdlibApi"
|
||||||
)
|
)
|
||||||
|
|
||||||
doFirst {
|
|
||||||
kotlinOptions.freeCompilerArgs += listOfNotNull(
|
|
||||||
"-Xklib-relative-path-base=$buildDir,$projectDir".takeIf { !kotlinBuildProperties.getBoolean("kotlin.build.use.absolute.paths.in.klib") }
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val compileKotlinJs by tasks.existing(KotlinCompile::class) {
|
val compileKotlinJs by tasks.existing(KotlinCompile::class) {
|
||||||
|
|||||||
Reference in New Issue
Block a user