|
6 | 6 | package org.jetbrains.kotlin.gradle.plugin.mpp
|
7 | 7 |
|
8 | 8 | import org.gradle.api.Project
|
| 9 | +import org.gradle.api.artifacts.component.ComponentIdentifier |
| 10 | +import org.gradle.api.artifacts.component.ModuleComponentIdentifier |
| 11 | +import org.gradle.api.artifacts.component.ProjectComponentIdentifier |
9 | 12 | import org.gradle.api.artifacts.result.ResolvedDependencyResult
|
10 | 13 | import org.jetbrains.kotlin.gradle.dsl.multiplatformExtensionOrNull
|
11 | 14 | import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
|
@@ -94,7 +97,7 @@ internal class SourceSetVisibilityProvider(
|
94 | 97 | val resolvedPlatformDependency = platformCompilationData
|
95 | 98 | .resolvedDependenciesConfiguration
|
96 | 99 | .allResolvedDependencies
|
97 |
| - .find { it.selected.id == resolvedRootMppDependencyId } |
| 100 | + .find { it.selected.id isEqualsIgnoringVersion resolvedRootMppDependencyId } |
98 | 101 | /*
|
99 | 102 | Returning null if we can't find the given dependency in a certain platform compilations dependencies.
|
100 | 103 | This is not expected, since this means the dependency does not support the given targets which will
|
@@ -188,3 +191,13 @@ internal class SourceSetVisibilityProvider(
|
188 | 191 |
|
189 | 192 | internal fun kotlinVariantNameFromPublishedVariantName(resolvedToVariantName: String): String =
|
190 | 193 | originalVariantNameFromPublished(resolvedToVariantName) ?: resolvedToVariantName
|
| 194 | + |
| 195 | +/** |
| 196 | + * Returns true when two components identifiers are from the same maven module (group + name) |
| 197 | + * Gradle projects can't be resolved into multiple versions since there is only one version of a project in gradle build |
| 198 | + */ |
| 199 | +private infix fun ComponentIdentifier.isEqualsIgnoringVersion(that: ComponentIdentifier): Boolean { |
| 200 | + if (this is ProjectComponentIdentifier && that is ProjectComponentIdentifier) return this == that |
| 201 | + if (this is ModuleComponentIdentifier && that is ModuleComponentIdentifier) return this.moduleIdentifier == that.moduleIdentifier |
| 202 | + return false |
| 203 | +} |
0 commit comments