Skip to content

Commit a79c4ba

Browse files
homurollSpace Team
authored andcommitted
[K/N][caches] Support explicit stdlib passing
The cache directory for stdlib and platform libraries is selected differently as opposed to all other libraries. This commit fixes a problem in this mechanism if stdlib is passed explicitly (ot it would be confused with external libraries). Due to the problem, the stdlib's cache was placed into the directory with other external libraries caches, but the selecting cache mechanism in the compiler (in CachedLibraries.kt) only searches for caches in this directory for external libraries (and stdlib isn't considered external there because of its path). #KT-69835 Fixed
1 parent 72e12c6 commit a79c4ba

File tree

1 file changed

+3
-3
lines changed
  • kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan

1 file changed

+3
-3
lines changed

kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/CacheBuilder.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.library.KotlinLibrary
1515
import org.jetbrains.kotlin.library.metadata.resolver.TopologicalLibraryOrder
1616
import org.jetbrains.kotlin.library.uniqueName
1717
import org.jetbrains.kotlin.config.CommonConfigurationKeys
18+
import org.jetbrains.kotlin.library.isNativeStdlib
1819
import org.jetbrains.kotlin.library.metadata.isCInteropLibrary
1920
import org.jetbrains.kotlin.library.unresolvedDependencies
2021

@@ -83,9 +84,8 @@ class CacheBuilder(
8384
val externalLibrariesToCache = mutableListOf<KotlinLibrary>()
8485
val icedLibraries = mutableListOf<KotlinLibrary>()
8586

86-
val stdlib = konanConfig.distribution.stdlib
8787
allLibraries.forEach { library ->
88-
val isSubjectOfIC = !library.isDefault && !library.isExternal && !library.libraryName.startsWith(stdlib)
88+
val isSubjectOfIC = !library.isDefault && !library.isExternal && !library.isNativeStdlib
8989
val cache = konanConfig.cachedLibraries.getLibraryCache(library, allowIncomplete = isSubjectOfIC)
9090
cache?.let {
9191
caches[library] = it
@@ -238,7 +238,7 @@ class CacheBuilder(
238238
val makePerFileCache = !isExternal && !library.isCInteropLibrary()
239239

240240
val libraryCacheDirectory = when {
241-
library.isDefault -> konanConfig.systemCacheDirectory
241+
library.isDefault || library.isNativeStdlib -> konanConfig.systemCacheDirectory
242242
isExternal -> CachedLibraries.computeLibraryCacheDirectory(
243243
konanConfig.autoCacheDirectory, library, uniqueNameToLibrary, uniqueNameToHash)
244244
else -> konanConfig.incrementalCacheDirectory!!

0 commit comments

Comments
 (0)