Fix resolving an MPP dependency in custom configurations (KT-32239)
In the `KotlinPlatformType` disambiguation rule, don't prefer `common` when there's a `jvm` or an `androidJvm` variant, as this would conflict with disambiguation rules created by the other plugins, such as Gradle's `java` which will choose `org.gradle.usage=java-api` and lead to ambiguity. Issue #KT-32239 Fixed
This commit is contained in:
+4
-2
@@ -32,10 +32,12 @@ enum class KotlinPlatformType: Named, Serializable {
|
||||
if (candidateValues == setOf(androidJvm, jvm))
|
||||
closestMatch(androidJvm)
|
||||
|
||||
if (common in candidateValues)
|
||||
if (common in candidateValues && jvm !in candidateValues && androidJvm !in candidateValues) {
|
||||
// then the consumer requests common or requests no platform-specific artifacts,
|
||||
// so common is the best match, KT-26834
|
||||
// so common is the best match, KT-26834; apply this rule only when no JVM variant is available,
|
||||
// as doing otherwise would conflict with Gradle java's disambiguation rules and lead to KT-32239
|
||||
closestMatch(common)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user