From 722acc028af31279f6d6509f311acd8a28f52f29 Mon Sep 17 00:00:00 2001 From: Dmitriy Dolovov Date: Fri, 15 Mar 2024 17:31:53 +0100 Subject: [PATCH] Revert "[K/N] add testing setup for header klibs and caches" This reverts commit a89893a2c5f14b1ac54c7f43e1fb19e748244ea4. --- .../privateSuperType.kt | 1 - .../codegen/box/inline/lateinitProperty.kt | 1 - .../box/suppressions/suppressInvisibleCtor.kt | 1 - .../box/volatile/crossModuleIntrinsic.kt | 1 - .../kclass/anonymousObjectInInlineFunction.kt | 1 - .../AbstractNativeKlibEvolutionTest.kt | 27 +-------- .../AbstractNativePartialLinkageTest.kt | 2 +- .../test/blackbox/NativeSimpleTestUtils.kt | 2 +- .../blackbox/support/NativeTestSupport.kt | 3 - .../support/compilation/TestCompilation.kt | 40 +++---------- .../compilation/TestCompilationArtifact.kt | 13 +---- .../compilation/TestCompilationFactory.kt | 58 +++++-------------- .../support/settings/TestProcessSettings.kt | 5 +- .../konan/test/blackbox/support/util/Names.kt | 1 - 14 files changed, 26 insertions(+), 130 deletions(-) diff --git a/compiler/testData/codegen/box/compileKotlinAgainstKotlin/privateSuperType.kt b/compiler/testData/codegen/box/compileKotlinAgainstKotlin/privateSuperType.kt index 285f9a2e6aa..e1ccbf09b46 100644 --- a/compiler/testData/codegen/box/compileKotlinAgainstKotlin/privateSuperType.kt +++ b/compiler/testData/codegen/box/compileKotlinAgainstKotlin/privateSuperType.kt @@ -2,7 +2,6 @@ // Looks like the call to `k` fails as `k` is not exported from the lib module. // IGNORE_NATIVE: cacheMode=STATIC_EVERYWHERE // IGNORE_NATIVE: cacheMode=STATIC_PER_FILE_EVERYWHERE -// IGNORE_NATIVE: cacheMode=STATIC_USE_HEADERS_EVERYWHERE // MODULE: lib // FILE: Z.kt package z diff --git a/compiler/testData/codegen/box/inline/lateinitProperty.kt b/compiler/testData/codegen/box/inline/lateinitProperty.kt index 7a3d58665da..6c036297ae2 100644 --- a/compiler/testData/codegen/box/inline/lateinitProperty.kt +++ b/compiler/testData/codegen/box/inline/lateinitProperty.kt @@ -2,7 +2,6 @@ // KT-64511: lateinit is not lowered with caches // DISABLE_NATIVE: cacheMode=STATIC_EVERYWHERE // DISABLE_NATIVE: cacheMode=STATIC_PER_FILE_EVERYWHERE -// DISABLE_NATIVE: cacheMode=STATIC_USE_HEADERS_EVERYWHERE // MODULE: lib // FILE: lib.kt diff --git a/compiler/testData/codegen/box/suppressions/suppressInvisibleCtor.kt b/compiler/testData/codegen/box/suppressions/suppressInvisibleCtor.kt index f92c45cb821..c20fdf3632b 100644 --- a/compiler/testData/codegen/box/suppressions/suppressInvisibleCtor.kt +++ b/compiler/testData/codegen/box/suppressions/suppressInvisibleCtor.kt @@ -1,6 +1,5 @@ // ISSUE: KT-58421 // TARGET_BACKEND: JVM -// IGNORE_NATIVE: cacheMode=STATIC_USE_HEADERS_EVERYWHERE // MODULE: lib // FILE: ContinuationImpl.kt diff --git a/compiler/testData/codegen/box/volatile/crossModuleIntrinsic.kt b/compiler/testData/codegen/box/volatile/crossModuleIntrinsic.kt index f395e4f747b..e9cd0695b10 100644 --- a/compiler/testData/codegen/box/volatile/crossModuleIntrinsic.kt +++ b/compiler/testData/codegen/box/volatile/crossModuleIntrinsic.kt @@ -2,7 +2,6 @@ // test is disabled now because of https://youtrack.jetbrains.com/issue/KT-55426 // IGNORE_NATIVE: cacheMode=STATIC_EVERYWHERE // IGNORE_NATIVE: cacheMode=STATIC_PER_FILE_EVERYWHERE -// IGNORE_NATIVE: cacheMode=STATIC_USE_HEADERS_EVERYWHERE // MODULE: lib // FILE: lib.kt diff --git a/native/native.tests/testData/codegen/kclass/anonymousObjectInInlineFunction.kt b/native/native.tests/testData/codegen/kclass/anonymousObjectInInlineFunction.kt index facd625c8b1..1dd6883c6df 100644 --- a/native/native.tests/testData/codegen/kclass/anonymousObjectInInlineFunction.kt +++ b/native/native.tests/testData/codegen/kclass/anonymousObjectInInlineFunction.kt @@ -6,7 +6,6 @@ // kotlin.AssertionError: Expected , actual . // IGNORE_NATIVE: cacheMode=STATIC_EVERYWHERE // IGNORE_NATIVE: cacheMode=STATIC_PER_FILE_EVERYWHERE -// IGNORE_NATIVE: cacheMode=STATIC_USE_HEADERS_EVERYWHERE package codegen.kclass.kclass0 import kotlin.test.* diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/AbstractNativeKlibEvolutionTest.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/AbstractNativeKlibEvolutionTest.kt index 518b6379d43..f6d5e5cb55b 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/AbstractNativeKlibEvolutionTest.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/AbstractNativeKlibEvolutionTest.kt @@ -13,8 +13,6 @@ import org.jetbrains.kotlin.konan.test.blackbox.support.TestModule import org.jetbrains.kotlin.konan.test.blackbox.support.compilation.* import org.jetbrains.kotlin.konan.test.blackbox.support.compilation.TestCompilationArtifact.KLIB import org.jetbrains.kotlin.konan.test.blackbox.support.compilation.TestCompilationArtifact.KLIBStaticCache -import org.jetbrains.kotlin.konan.test.blackbox.support.compilation.TestCompilationArtifact.KLIBStaticCacheImpl -import org.jetbrains.kotlin.konan.test.blackbox.support.compilation.TestCompilationArtifact.KLIBStaticCacheHeader import org.jetbrains.kotlin.konan.test.blackbox.support.compilation.TestCompilationResult.Companion.assertSuccess import org.jetbrains.kotlin.konan.test.blackbox.support.group.UsePartialLinkage import org.jetbrains.kotlin.konan.test.blackbox.support.runner.TestExecutable @@ -149,28 +147,13 @@ abstract class AbstractNativeKlibEvolutionTest : AbstractNativeSimpleTest() { ) { val klib = module.klibFile - if (useHeaders) { - val compilation = StaticCacheCompilation( - settings = testRunSettings, - freeCompilerArgs = COMPILER_ARGS_FOR_STATIC_CACHE_AND_EXECUTABLE, - options = staticCacheCompilationOptions, - pipelineType = testRunSettings.get(), - dependencies = moduleDependencies.map { - it.klibFile.toHeaderCacheArtifact().toDependency() - } + klib.toKlib().toDependency(), - createHeaderCache = true, - expectedArtifact = klib.toHeaderCacheArtifact() - ) - compilation.trigger() - } - val compilation = StaticCacheCompilation( settings = testRunSettings, freeCompilerArgs = COMPILER_ARGS_FOR_STATIC_CACHE_AND_EXECUTABLE, options = staticCacheCompilationOptions, pipelineType = testRunSettings.get(), dependencies = moduleDependencies.map { - if (useHeaders) it.klibFile.toHeaderCacheArtifact().toDependency() else it.klibFile.toStaticCacheArtifact().toDependency() + it.klibFile.toStaticCacheArtifact().toDependency() } + klib.toKlib().toDependency(), expectedArtifact = klib.toStaticCacheArtifact() ) @@ -300,7 +283,6 @@ abstract class AbstractNativeKlibEvolutionTest : AbstractNativeSimpleTest() { private val buildDir: File get() = testRunSettings.get().testBinariesDir private val useStaticCacheForUserLibraries: Boolean get() = testRunSettings.get().useStaticCacheForUserLibraries - private val useHeaders: Boolean get() = testRunSettings.get().useHeaders companion object { private val COMPILER_ARGS_FOR_KLIB = TestCompilerArgs.EMPTY @@ -319,16 +301,11 @@ private fun File.resolveKlibFileWithVersion(moduleName: String, version: Int): F resolveModuleWithVersion(moduleName, version).resolve("${moduleName}.klib") private fun File.toKlib(): KLIB = KLIB(this) -private fun File.toStaticCacheArtifact() = KLIBStaticCacheImpl( +private fun File.toStaticCacheArtifact() = KLIBStaticCache( cacheDir = parentFile.resolve(STATIC_CACHE_DIR_NAME).apply { mkdirs() }, klib = KLIB(this) ) -private fun File.toHeaderCacheArtifact() = KLIBStaticCacheHeader( - cacheDir = parentFile.resolve(HEADER_CACHE_DIR_NAME).apply { mkdirs() }, - klib = KLIB(this) -) - private fun KLIB.toDependency() = ExistingDependency(this, TestCompilationDependencyType.Library) private fun KLIB.toIncludedDependency() = ExistingDependency(this, TestCompilationDependencyType.IncludedLibrary) private fun KLIBStaticCache.toDependency() = ExistingDependency(this, TestCompilationDependencyType.LibraryStaticCache) diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/AbstractNativePartialLinkageTest.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/AbstractNativePartialLinkageTest.kt index 9a22c892776..2f328602c5e 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/AbstractNativePartialLinkageTest.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/AbstractNativePartialLinkageTest.kt @@ -209,7 +209,7 @@ abstract class AbstractNativePartialLinkageTest : AbstractNativeSimpleTest() { private fun KLIB.toFriendDependency() = ExistingDependency(this, FriendLibrary) private fun KLIBStaticCache.toDependency() = ExistingDependency(this, LibraryStaticCache) - private fun KLIB.toStaticCacheArtifact() = KLIBStaticCacheImpl( + private fun KLIB.toStaticCacheArtifact() = KLIBStaticCache( cacheDir = klibFile.parentFile.resolve(STATIC_CACHE_DIR_NAME).apply { mkdirs() }, klib = this ) diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/NativeSimpleTestUtils.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/NativeSimpleTestUtils.kt index 1932a68a126..eb186fb223b 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/NativeSimpleTestUtils.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/NativeSimpleTestUtils.kt @@ -201,7 +201,7 @@ internal fun AbstractNativeSimpleTest.compileToStaticCache( this += klib.asLibraryDependency() dependencies.mapTo(this) { it.asStaticCacheDependency() } }, - expectedArtifact = TestCompilationArtifact.KLIBStaticCacheImpl(cacheDir, klib) + expectedArtifact = TestCompilationArtifact.KLIBStaticCache(cacheDir, klib) ) return compilation.result.assertSuccess().resultingArtifact } diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/NativeTestSupport.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/NativeTestSupport.kt index b611a05ff18..37f13a58165 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/NativeTestSupport.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/NativeTestSupport.kt @@ -277,10 +277,8 @@ internal object NativeTestSupport { CacheMode.Alias.STATIC_ONLY_DIST -> false CacheMode.Alias.STATIC_EVERYWHERE -> true CacheMode.Alias.STATIC_PER_FILE_EVERYWHERE -> true - CacheMode.Alias.STATIC_USE_HEADERS_EVERYWHERE -> true } val makePerFileCaches = cacheMode == CacheMode.Alias.STATIC_PER_FILE_EVERYWHERE - val useHeaders = cacheMode == CacheMode.Alias.STATIC_USE_HEADERS_EVERYWHERE return if (defaultCache == CacheMode.Alias.NO) CacheMode.WithoutCache @@ -290,7 +288,6 @@ internal object NativeTestSupport { optimizationMode, useStaticCacheForUserLibraries, makePerFileCaches, - useHeaders, cacheMode ) } 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 8ee98e4ce86..baac2acf1b0 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 @@ -224,6 +224,7 @@ abstract class SourceBasedCompilation( } override fun applyDependencies(argsBuilder: ArgsBuilder): Unit = with(argsBuilder) { + addFlattened(dependencies.libraries) { library -> listOf("-l", library.path) } dependencies.friends.takeIf(Collection<*>::isNotEmpty)?.let { friends -> add("-friend-modules", friends.joinToString(File.pathSeparator) { friend -> friend.path }) } @@ -268,29 +269,15 @@ internal class LibraryCompilation( dependencies = CategorizedDependencies(dependencies), expectedArtifact = expectedArtifact ) { - private val useHeaders: Boolean = settings.get().useHeaders override val binaryOptions get() = BinaryOptions.RuntimeAssertionsMode.defaultForTesting(optimizationMode, freeCompilerArgs.assertionsMode) override fun applySpecificArgs(argsBuilder: ArgsBuilder) = with(argsBuilder) { add( "-produce", "library", - "-output", expectedArtifact.path, + "-output", expectedArtifact.path ) - if (useHeaders) { - add("-Xheader-klib-path=${expectedArtifact.headerKlib.path}") - } super.applySpecificArgs(argsBuilder) } - - override fun applyDependencies(argsBuilder: ArgsBuilder): Unit = with(argsBuilder) { - super.applyDependencies(argsBuilder) - addFlattened(dependencies.libraries) { library -> - listOf( - "-l", - library.headerKlib.takeIf { useHeaders && it.exists() }?.path ?: library.path - ) - } - } } internal class ObjCFrameworkCompilation( @@ -566,7 +553,6 @@ class ExecutableCompilation( override fun applyDependencies(argsBuilder: ArgsBuilder): Unit = with(argsBuilder) { super.applyDependencies(argsBuilder) - addFlattened(dependencies.libraries) { library -> listOf("-l", library.path) } } override fun postCompileCheck() { @@ -614,9 +600,8 @@ internal class StaticCacheCompilation( private val options: Options, private val pipelineType: PipelineType, dependencies: Iterable>, + expectedArtifact: KLIBStaticCache, makePerFileCacheOverride: Boolean? = null, - private val createHeaderCache: Boolean = false, - expectedArtifact: KLIBStaticCache ) : BasicCompilation( targets = settings.get(), home = settings.get(), @@ -641,10 +626,8 @@ internal class StaticCacheCompilation( private val partialLinkageConfig: UsedPartialLinkageConfig = settings.get() - private val useHeaders: Boolean = settings.get().useHeaders - override fun applySpecificArgs(argsBuilder: ArgsBuilder): Unit = with(argsBuilder) { - add("-produce", if (createHeaderCache) "header_cache" else "static_cache") + add("-produce", "static_cache") pipelineType.compilerFlags.forEach { compilerFlag -> add(compilerFlag) } when (options) { @@ -670,18 +653,9 @@ internal class StaticCacheCompilation( override fun applyDependencies(argsBuilder: ArgsBuilder): Unit = with(argsBuilder) { dependencies.friends.takeIf(Collection<*>::isNotEmpty)?.let { friends -> - add( - "-friend-modules", - friends.joinToString(File.pathSeparator) { friend -> - friend.headerKlib.takeIf { useHeaders && it.exists() }?.path ?: friend.path - }) - } - addFlattened(dependencies.cachedLibraries) { lib -> - listOf( - "-l", - lib.klib.headerKlib.takeIf { useHeaders && it.exists() }?.path ?: lib.klib.path - ) + add("-friend-modules", friends.joinToString(File.pathSeparator) { friend -> friend.path }) } + addFlattened(dependencies.cachedLibraries) { (_, library) -> listOf("-l", library.path) } super.applyDependencies(argsBuilder) } @@ -719,7 +693,7 @@ class CategorizedDependencies(uncategorizedDependencies: Iterable by lazy { - cachedLibraries.mapToSet { it.cacheDir } // Avoid repeating the same directory more than once. + cachedLibraries.mapToSet { (libraryCacheDir, _) -> libraryCacheDir } // Avoid repeating the same directory more than once. } private inline fun > Iterable>.collectArtifacts(): List { diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/compilation/TestCompilationArtifact.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/compilation/TestCompilationArtifact.kt index 14431c32bc6..d62da7468b3 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/compilation/TestCompilationArtifact.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/compilation/TestCompilationArtifact.kt @@ -12,15 +12,10 @@ sealed interface TestCompilationArtifact { data class KLIB(val klibFile: File) : TestCompilationArtifact { val path: String get() = klibFile.path - - val headerKlib: File get() = klibFile.resolveSibling(klibFile.name.replaceAfterLast(".", "header.klib")) override val logFile: File get() = klibFile.resolveSibling("${klibFile.name}.log") } - interface KLIBStaticCache : TestCompilationArtifact { - val cacheDir: File - val klib: KLIB - val fileCheckStage: String? + data class KLIBStaticCache(val cacheDir: File, val klib: KLIB, val fileCheckStage: String? = null) : TestCompilationArtifact { override val logFile: File get() = cacheDir.resolve("${klib.klibFile.nameWithoutExtension}-cache.log") val fileCheckDump: File? get() = fileCheckStage?.let { @@ -28,12 +23,6 @@ sealed interface TestCompilationArtifact { } } - data class KLIBStaticCacheImpl(override val cacheDir: File, override val klib: KLIB, override val fileCheckStage: String? = null) : - KLIBStaticCache - - data class KLIBStaticCacheHeader(override val cacheDir: File, override val klib: KLIB, override val fileCheckStage: String? = null) : - KLIBStaticCache - data class Executable(val executableFile: File, val fileCheckStage: String? = null) : TestCompilationArtifact { val path: String get() = executableFile.path override val logFile: File get() = executableFile.resolveSibling("${executableFile.name}.log") diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/compilation/TestCompilationFactory.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/compilation/TestCompilationFactory.kt index c50e94e5179..7f3a2dd36cc 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/compilation/TestCompilationFactory.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/compilation/TestCompilationFactory.kt @@ -30,25 +30,24 @@ internal class TestCompilationFactory { private val cachedObjCFrameworkCompilations = ThreadSafeCache() private val cachedBinaryLibraryCompilations = ThreadSafeCache() - private data class KlibCacheKey(val sourceModules: Set, val freeCompilerArgs: TestCompilerArgs, val useHeaders: Boolean) + private data class KlibCacheKey(val sourceModules: Set, val freeCompilerArgs: TestCompilerArgs) private data class ExecutableCacheKey(val sourceModules: Set) private data class ObjCFrameworkCacheKey(val sourceModules: Set) private data class BinaryLibraryCacheKey(val sourceModules: Set, val kind: BinaryLibraryKind) // A pair of compilations for a KLIB itself and for its static cache that are created together. - private data class KlibCompilations(val klib: TestCompilation, val staticCache: TestCompilation?, val headerCache: TestCompilation?) + private data class KlibCompilations(val klib: TestCompilation, val staticCache: TestCompilation?) private data class CompilationDependencies( private val klibDependencies: List>, - private val staticCacheDependencies: List>, - private val staticCacheHeaderDependencies: List> + private val staticCacheDependencies: List> ) { /** Dependencies needed to compile KLIB. */ fun forKlib(): Iterable> = klibDependencies /** Dependencies needed to compile KLIB static cache. */ - fun forStaticCache(klib: CompiledDependency, useHeaders: Boolean): Iterable> = - (klibDependencies.asSequence().filter { it.type == FriendLibrary } + klib + if (useHeaders) staticCacheHeaderDependencies else staticCacheDependencies).asIterable() + fun forStaticCache(klib: CompiledDependency): Iterable> = + (klibDependencies.asSequence().filter { it.type == FriendLibrary } + klib + staticCacheDependencies).asIterable() /** Dependencies needed to compile one-stage executable. */ fun forOneStageExecutable(): Iterable> = @@ -211,8 +210,7 @@ internal class TestCompilationFactory { produceStaticCache: ProduceStaticCache, settings: Settings ): KlibCompilations { - val useHeaders: Boolean = settings.get().useHeaders - val cacheKey = KlibCacheKey(sourceModules, freeCompilerArgs, useHeaders) + val cacheKey = KlibCacheKey(sourceModules, freeCompilerArgs) // Fast pass. cachedKlibCompilations[cacheKey]?.let { return it } @@ -225,20 +223,12 @@ internal class TestCompilationFactory { val staticCacheArtifactAndOptions: Pair? = when (produceStaticCache) { is ProduceStaticCache.No -> null // No artifact means no static cache should be compiled. - is ProduceStaticCache.Yes -> KLIBStaticCacheImpl( + is ProduceStaticCache.Yes -> KLIBStaticCache( cacheDir = settings.cacheDirForStaticCache(klibArtifact, isGivenKlibArtifact), klib = klibArtifact ) to produceStaticCache.options } - val headerCacheArtifactAndOptions = staticCacheArtifactAndOptions?.let { - if (!useHeaders) return@let null - KLIBStaticCacheHeader( - cacheDir = settings.cacheDirForStaticCache(klibArtifact, isGivenKlibArtifact, header = true), - klib = klibArtifact - ) to it.second - } - return cachedKlibCompilations.computeIfAbsent(cacheKey) { val (klibCompilation, makePerFileCacheOverride) = if (isGivenKlibArtifact) GivenLibraryCompilation(klibArtifact) to false // Don't make per-file-cache from given dependencies(usually, cinterop) @@ -284,32 +274,13 @@ internal class TestCompilationFactory { freeCompilerArgs = freeCompilerArgs, options = staticCacheOptions, pipelineType = settings.get(), - dependencies = dependencies.forStaticCache( - klibCompilation.asKlibDependency(type = /* does not matter in fact*/ Library), - settings.get().useHeaders - ), + dependencies = dependencies.forStaticCache(klibCompilation.asKlibDependency(type = /* does not matter in fact*/ Library)), expectedArtifact = staticCacheArtifact, makePerFileCacheOverride = makePerFileCacheOverride, ) } - val headerCacheCompilation: StaticCacheCompilation? = - headerCacheArtifactAndOptions?.let { (staticCacheArtifact, staticCacheOptions) -> - StaticCacheCompilation( - settings = settings, - freeCompilerArgs = freeCompilerArgs, - options = staticCacheOptions, - createHeaderCache = true, - pipelineType = settings.get(), - dependencies = dependencies.forStaticCache( - klibCompilation.asKlibDependency(type = /* does not matter in fact*/ Library), - settings.get().useHeaders - ), - expectedArtifact = staticCacheArtifact - ) - } - - KlibCompilations(klibCompilation, staticCacheCompilation, headerCacheCompilation) + KlibCompilations(klibCompilation, staticCacheCompilation) } } @@ -320,7 +291,6 @@ internal class TestCompilationFactory { ): CompilationDependencies { val klibDependencies = mutableListOf>() val staticCacheDependencies = mutableListOf>() - val staticCacheHeaderDependencies = mutableListOf>() val produceStaticCache = ProduceStaticCache.decideForRegularKlib(settings) @@ -329,16 +299,14 @@ internal class TestCompilationFactory { val klibCompilations = modulesToKlib(setOf(dependencyModule), freeCompilerArgs, produceStaticCache, settings) klibDependencies += klibCompilations.klib.asKlibDependency(type) - if (type == Library || type == IncludedLibrary) { + if (type == Library || type == IncludedLibrary) staticCacheDependencies.addIfNotNull(klibCompilations.staticCache?.asStaticCacheDependency()) - staticCacheHeaderDependencies.addIfNotNull((klibCompilations.headerCache ?: klibCompilations.staticCache)?.asStaticCacheDependency()) - } } sourceModules.allDependencies().collectDependencies(Library) sourceModules.allFriends().collectDependencies(FriendLibrary) - return CompilationDependencies(klibDependencies, staticCacheDependencies, staticCacheHeaderDependencies) + return CompilationDependencies(klibDependencies, staticCacheDependencies) } private fun sortDependsOnTopologically(module: TestModule): List { @@ -394,7 +362,7 @@ internal class TestCompilationFactory { } } - private fun Settings.cacheDirForStaticCache(klibArtifact: KLIB, isGivenKlibArtifact: Boolean, header: Boolean = false): File { + private fun Settings.cacheDirForStaticCache(klibArtifact: KLIB, isGivenKlibArtifact: Boolean): File { val artifactBaseDir = if (isGivenKlibArtifact) { // Special case for the given (external) KLIB artifacts. get().givenBinariesDir @@ -403,7 +371,7 @@ internal class TestCompilationFactory { klibArtifact.klibFile.parentFile } - return artifactBaseDir.resolve(if (header) HEADER_CACHE_DIR_NAME else STATIC_CACHE_DIR_NAME).apply { mkdirs() } + return artifactBaseDir.resolve(STATIC_CACHE_DIR_NAME).apply { mkdirs() } } private fun Settings.singleModuleArtifactFile(module: TestModule.Exclusive, extension: String): File { diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/settings/TestProcessSettings.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/settings/TestProcessSettings.kt index 19a1c925d02..08f9d7de054 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/settings/TestProcessSettings.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/settings/TestProcessSettings.kt @@ -210,7 +210,6 @@ sealed class CacheMode { abstract val staticCacheForDistributionLibrariesRootDir: File? abstract val useStaticCacheForUserLibraries: Boolean abstract val makePerFileCaches: Boolean - abstract val useHeaders: Boolean abstract val alias: Alias val useStaticCacheForDistributionLibraries: Boolean get() = staticCacheForDistributionLibrariesRootDir != null @@ -219,7 +218,6 @@ sealed class CacheMode { override val staticCacheForDistributionLibrariesRootDir: File? get() = null override val useStaticCacheForUserLibraries: Boolean get() = false override val makePerFileCaches: Boolean = false - override val useHeaders = false override val alias = Alias.NO } @@ -229,7 +227,6 @@ sealed class CacheMode { optimizationMode: OptimizationMode, override val useStaticCacheForUserLibraries: Boolean, override val makePerFileCaches: Boolean, - override val useHeaders: Boolean, override val alias: Alias, ) : CacheMode() { init { @@ -258,7 +255,7 @@ sealed class CacheMode { } } - enum class Alias { NO, STATIC_ONLY_DIST, STATIC_EVERYWHERE, STATIC_PER_FILE_EVERYWHERE, STATIC_USE_HEADERS_EVERYWHERE } + enum class Alias { NO, STATIC_ONLY_DIST, STATIC_EVERYWHERE, STATIC_PER_FILE_EVERYWHERE } companion object { fun defaultForTestTarget(distribution: Distribution, kotlinNativeTargets: KotlinNativeTargets): Alias { diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/util/Names.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/util/Names.kt index d7664537545..a4d680d10a6 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/util/Names.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/util/Names.kt @@ -33,7 +33,6 @@ internal const val SHARED_MODULES_DIR_NAME = "__shared_modules__" internal const val GIVEN_MODULES_DIR_NAME = "__given_modules__" internal const val STATIC_CACHE_DIR_NAME = "__static_cache__" -internal const val HEADER_CACHE_DIR_NAME = "__header_cache__" internal fun prettyHash(hash: Int): String = hash.toUInt().toString(16).padStart(8, '0')