[K/N][Tests] Fix wrong root cache path

^KT-61259
This commit is contained in:
Vladimir Sukharev
2024-01-31 17:28:23 +01:00
committed by Space Team
parent 95b1fba37f
commit e4d36d3840
@@ -79,7 +79,7 @@ internal abstract class BasicCompilation<A : TestCompilationArtifact>(
protected abstract fun applySpecificArgs(argsBuilder: ArgsBuilder) protected abstract fun applySpecificArgs(argsBuilder: ArgsBuilder)
protected open fun applyDependencies(argsBuilder: ArgsBuilder) = with(argsBuilder) { protected open fun applyDependencies(argsBuilder: ArgsBuilder) = with(argsBuilder) {
if (this@BasicCompilation !is LibraryCompilation) { 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. // 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" ) // (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, // Now three subclasses of SourceBasedCompilation use backend, and need the option,
@@ -87,12 +87,9 @@ internal abstract class BasicCompilation<A : TestCompilationArtifact>(
// For LibraryCompilation any backend-related options are useless. // 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: // 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. // LibraryCompilation. Three others (Executable, ObjCFramework, BinaryLibrary) would go to separate hierarchy: KLibBasedCompilation.
if (tryPassSystemCacheDirectory) { cacheMode.staticCacheForDistributionLibrariesRootDir
add("-Xcache-directory=${ ?.takeIf { tryPassSystemCacheDirectory}
cacheMode.staticCacheForDistributionLibrariesRootDir?.absolutePath ?.let { cacheRootDir -> add("-Xcache-directory=$cacheRootDir") }
?: fail { "No cache root directory found for cache mode $cacheMode" }
}")
}
add(dependencies.uniqueCacheDirs) { libraryCacheDir -> "-Xcache-directory=${libraryCacheDir.path}" } add(dependencies.uniqueCacheDirs) { libraryCacheDir -> "-Xcache-directory=${libraryCacheDir.path}" }
} }
} }