Skip to content

Commit

Permalink
[gradle] Use more fine grained directory for K/N incremental compilation
Browse files Browse the repository at this point in the history
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
  • Loading branch information
homuroll authored and qodana-bot committed Dec 18, 2023
1 parent 9012e67 commit 9c7aac2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ class NativeIncrementalCompilationIT : KGPBaseTest() {
"-Xbackend-threads=4"
)

val icCacheDir = projectPath.resolve("build").resolve("kotlin-native-ic-cache").resolve("debugExecutable")
val incrementalCacheArgs = arrayOf(
"-Xenable-incremental-compilation",
"-Xic-cache-dir=${projectPath.resolve("build").resolve("kotlin-native-ic-cache").toFile().canonicalPath}"
"-Xic-cache-dir=${icCacheDir.toFile().canonicalPath}"
)

val withoutIncrementalCacheBuildOptions = defaultBuildOptions.copy(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,9 @@ constructor(
add("-Xauto-cache-from=${cacheSettings.gradleUserHomeDir}")
add("-Xbackend-threads=${cacheSettings.threads}")
if (cacheSettings.icEnabled) {
val icCacheDir = cacheSettings.gradleBuildDir.resolve("kotlin-native-ic-cache")
val icCacheDir = cacheSettings.gradleBuildDir
.resolve("kotlin-native-ic-cache")
.resolve(binaryName)
icCacheDir.mkdirs()
add("-Xenable-incremental-compilation")
add("-Xic-cache-dir=$icCacheDir")
Expand Down

0 comments on commit 9c7aac2

Please sign in to comment.