[Commonizer] Lookup common descriptors that don't participate in commonization (for tests only)
This is necessary to run integration tests with fake declarations from Kotlin/Native stdlib that are absent in stdlib-common.
This commit is contained in:
@@ -23,6 +23,9 @@ class Parameters(
|
||||
field = value
|
||||
}
|
||||
|
||||
// only for test purposes
|
||||
internal var commonModulesProvider: ModulesProvider? = null
|
||||
|
||||
fun addTarget(targetProvider: TargetProvider): Parameters {
|
||||
require(targetProvider.target !in _targetProviders) { "Target ${targetProvider.target} is already added" }
|
||||
_targetProviders[targetProvider.target] = targetProvider
|
||||
|
||||
+4
-1
@@ -216,7 +216,10 @@ fun CirRootNode.createGlobalBuilderComponents(
|
||||
}
|
||||
|
||||
val lazyModulesLookupTable = storageManager.createLazyValue {
|
||||
val source = if (isCommon) emptyMap() else parameters.targetProviders[index].modulesProvider.loadModules()
|
||||
val source = if (isCommon)
|
||||
parameters.commonModulesProvider?.loadModules() ?: emptyMap()
|
||||
else
|
||||
parameters.targetProviders[index].modulesProvider.loadModules()
|
||||
THashMap(source)
|
||||
}
|
||||
|
||||
|
||||
+5
-1
@@ -253,7 +253,11 @@ private class AnalyzedModules(
|
||||
check(originalPlatformModules.keys == commonizedPlatformModules.keys)
|
||||
}
|
||||
|
||||
fun toCommonizationParameters(): Parameters = originalPlatformModules.mapValues { it.value.module }.toCommonizationParameters()
|
||||
fun toCommonizationParameters(): Parameters {
|
||||
val parameters = originalPlatformModules.mapValues { it.value.module }.toCommonizationParameters()
|
||||
parameters.commonModulesProvider = MockModulesProvider(commonizedCommonModule.module)
|
||||
return parameters
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun create(
|
||||
|
||||
Reference in New Issue
Block a user