From e4d36d38407ee75d9982d785471a21a2196b708d Mon Sep 17 00:00:00 2001 From: Vladimir Sukharev Date: Wed, 31 Jan 2024 17:28:23 +0100 Subject: [PATCH] [K/N][Tests] Fix wrong root cache path ^KT-61259 --- .../blackbox/support/compilation/TestCompilation.kt | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/compilation/TestCompilation.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/compilation/TestCompilation.kt index e2fea061b74..1771ed50882 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/compilation/TestCompilation.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/compilation/TestCompilation.kt @@ -79,7 +79,7 @@ internal abstract class BasicCompilation( protected abstract fun applySpecificArgs(argsBuilder: ArgsBuilder) protected open fun applyDependencies(argsBuilder: ArgsBuilder) = with(argsBuilder) { if (this@BasicCompilation !is LibraryCompilation) { - // To use static caches, `-Xcache-directory=` option must be provided for backend, similar to `` + // To use static caches, `-Xcache-directory=` option must be provided for backend, similar to what old infra did. // This is so-known 2nd compilation stage, which can also be a result of a split, which happens in driver. // (The split: "source to binary" is splitted to "source to klib"+"klib to binary" ) // Now three subclasses of SourceBasedCompilation use backend, and need the option, @@ -87,12 +87,9 @@ internal abstract class BasicCompilation( // For LibraryCompilation any backend-related options are useless. // All this would "soon" change, when 1-stage testing would be stopped, and SourceBasedCompilation would have only one subclass: // LibraryCompilation. Three others (Executable, ObjCFramework, BinaryLibrary) would go to separate hierarchy: KLibBasedCompilation. - if (tryPassSystemCacheDirectory) { - add("-Xcache-directory=${ - cacheMode.staticCacheForDistributionLibrariesRootDir?.absolutePath - ?: fail { "No cache root directory found for cache mode $cacheMode" } - }") - } + cacheMode.staticCacheForDistributionLibrariesRootDir + ?.takeIf { tryPassSystemCacheDirectory} + ?.let { cacheRootDir -> add("-Xcache-directory=$cacheRootDir") } add(dependencies.uniqueCacheDirs) { libraryCacheDir -> "-Xcache-directory=${libraryCacheDir.path}" } } }