[K/N] Exclude stdlib from icedLibraries cache when passed explicitly

As part of KT-61559 stdlib is intended to be passed explicitly from
Gradle. However, CacheBuilder was not aware of such configuration
and was failing during cache building.

Author of this commit is Igor Chevdar

^KT-61430 Verification Pending
^KT-61559 Verification Pending
This commit is contained in:
Anton Lakotka
2024-01-23 09:17:25 +01:00
committed by Space Team
parent 9acb9ff2b7
commit 71a03a7c7d
@@ -82,17 +82,18 @@ class CacheBuilder(
val externalLibrariesToCache = mutableListOf<KotlinLibrary>()
val icedLibraries = mutableListOf<KotlinLibrary>()
val stdlib = konanConfig.distribution.stdlib
allLibraries.forEach { library ->
val isDefaultOrExternal = library.isDefault || library.isExternal
val cache = konanConfig.cachedLibraries.getLibraryCache(library, !isDefaultOrExternal)
val isSubjectOfIC = !library.isDefault && !library.isExternal && !library.libraryName.startsWith(stdlib)
val cache = konanConfig.cachedLibraries.getLibraryCache(library, allowIncomplete = isSubjectOfIC)
cache?.let {
caches[library] = it
cacheRootDirectories[library] = it.rootDirectory
}
if (isDefaultOrExternal) {
if (cache == null) externalLibrariesToCache += library
} else {
if (isSubjectOfIC) {
icedLibraries += library
} else {
if (cache == null) externalLibrariesToCache += library
}
library.unresolvedDependencies.forEach {
val dependency = uniqueNameToLibrary[it.path]!!