Skip to content

Commit 9c7aac2

Browse files
homurollSpace Team
authored and
Space Team
committed
[gradle] Use more fine grained directory for K/N incremental compilation
Otherwise, two or more link tasks being executed in parallel will use the same directory for IC caches which might lead to races during compilation #KT-63471 Fixed
1 parent 9012e67 commit 9c7aac2

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/NativeIncrementalCompilationIT.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ class NativeIncrementalCompilationIT : KGPBaseTest() {
4040
"-Xbackend-threads=4"
4141
)
4242

43+
val icCacheDir = projectPath.resolve("build").resolve("kotlin-native-ic-cache").resolve("debugExecutable")
4344
val incrementalCacheArgs = arrayOf(
4445
"-Xenable-incremental-compilation",
45-
"-Xic-cache-dir=${projectPath.resolve("build").resolve("kotlin-native-ic-cache").toFile().canonicalPath}"
46+
"-Xic-cache-dir=${icCacheDir.toFile().canonicalPath}"
4647
)
4748

4849
val withoutIncrementalCacheBuildOptions = defaultBuildOptions.copy(

libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/native/tasks/KotlinNativeLink.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,9 @@ constructor(
379379
add("-Xauto-cache-from=${cacheSettings.gradleUserHomeDir}")
380380
add("-Xbackend-threads=${cacheSettings.threads}")
381381
if (cacheSettings.icEnabled) {
382-
val icCacheDir = cacheSettings.gradleBuildDir.resolve("kotlin-native-ic-cache")
382+
val icCacheDir = cacheSettings.gradleBuildDir
383+
.resolve("kotlin-native-ic-cache")
384+
.resolve(binaryName)
383385
icCacheDir.mkdirs()
384386
add("-Xenable-incremental-compilation")
385387
add("-Xic-cache-dir=$icCacheDir")

0 commit comments

Comments
 (0)