[Gradle] ResolvedMppVariantsProvider: Use dependent.selected instead of requested...

... in order to support dependencySubstitutions

KT-52172
This commit is contained in:
Sebastian Sellmair
2022-12-08 12:53:54 +01:00
committed by Space Team
parent 287337007f
commit d4177f167b
@@ -106,13 +106,12 @@ internal class ResolvedMppVariantsProvider private constructor(private val proje
val result = mutableListOf<ResolvedComponentResult>()
configuration.incoming.resolutionResult.allComponents { component ->
val isMpp =
component.dependents.isNotEmpty() && // filter out the root of the dependency graph, we are not interested in it
component.variants.any { variant -> variant.attributes.keySet().any { it.name == KotlinPlatformType.attribute.name } }
val isMpp = component.dependents.isNotEmpty() && // filter out the root of the dependency graph, we are not interested in it
component.variants.any { variant -> variant.attributes.keySet().any { it.name == KotlinPlatformType.attribute.name } }
if (isMpp) {
result.add(component)
component.dependents.forEach { dependent ->
dependent.requested.toKpmModuleIdentifiers().forEach { moduleId ->
dependent.selected.toKpmModuleIdentifiers().forEach { moduleId ->
val moduleEntry = getEntryForModule(moduleId)
moduleEntry.resolvedVariantsByConfiguration[configuration] = listOf(dependent.resolvedVariant)