[Gradle] Evaluate rootCacheDirectory on demand

To avoid failures in Gradle Configuration Cache due to illegal cacheKind
This commit is contained in:
Anton Lakotka
2022-06-16 14:11:45 +02:00
committed by Space
parent 9a5739555c
commit 1af804c897
@@ -878,14 +878,18 @@ internal class CacheBuilder(
val runnerSettings: KotlinNativeCompilerRunner.Settings,
val konanCacheKind: NativeCacheKind,
val libraries: FileCollection,
rootCacheDirectoryProvider: () -> File,
val gradleUserHomeDir: File,
val binary: NativeBinary,
val konanTarget: KonanTarget,
val kotlinOptions: KotlinCommonToolOptions,
val externalDependenciesArgs: List<String>
) {
val rootCacheDirectory by UnserializableLazy(rootCacheDirectoryProvider)
val rootCacheDirectory get() = getRootCacheDirectory(
File(runnerSettings.parent.konanHome),
konanTarget,
binary.debuggable,
konanCacheKind
)
companion object {
operator fun invoke(
@@ -900,7 +904,6 @@ internal class CacheBuilder(
runnerSettings = KotlinNativeCompilerRunner.Settings(project),
konanCacheKind = konanCacheKind,
libraries = binary.compilation.compileDependencyFiles.filterOutPublishableInteropLibs(project),
rootCacheDirectoryProvider = { getRootCacheDirectory(File(project.konanHome), konanTarget, binary.debuggable, konanCacheKind) },
gradleUserHomeDir = project.gradle.gradleUserHomeDir,
binary, konanTarget, kotlinOptions, externalDependenciesArgs
)