[Gradle] rename projectIdOrNull to currentBuildProjectIdOrNull for clarity
This commit is contained in:
committed by
Space Team
parent
d70a57d689
commit
c3274b61ee
+2
-3
@@ -16,7 +16,6 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
|||||||
import org.jetbrains.kotlin.gradle.dsl.multiplatformExtension
|
import org.jetbrains.kotlin.gradle.dsl.multiplatformExtension
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
|
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.MetadataDependencyResolution.ChooseVisibleSourceSets.MetadataProvider.ArtifactMetadataProvider
|
import org.jetbrains.kotlin.gradle.plugin.mpp.MetadataDependencyResolution.ChooseVisibleSourceSets.MetadataProvider.ArtifactMetadataProvider
|
||||||
import org.jetbrains.kotlin.gradle.plugin.sources.KotlinDependencyScope
|
|
||||||
import org.jetbrains.kotlin.gradle.plugin.sources.internal
|
import org.jetbrains.kotlin.gradle.plugin.sources.internal
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
@@ -269,7 +268,7 @@ internal class GranularMetadataTransformation(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal val ResolvedComponentResult.projectIdOrNull get(): ProjectComponentIdentifier? {
|
internal val ResolvedComponentResult.currentBuildProjectIdOrNull get(): ProjectComponentIdentifier? {
|
||||||
val identifier = id
|
val identifier = id
|
||||||
return when {
|
return when {
|
||||||
identifier is ProjectComponentIdentifier && identifier.build.isCurrentBuild -> identifier
|
identifier is ProjectComponentIdentifier && identifier.build.isCurrentBuild -> identifier
|
||||||
@@ -281,7 +280,7 @@ internal fun MetadataDependencyResolution.projectDependency(currentProject: Proj
|
|||||||
dependency.toProjectOrNull(currentProject)
|
dependency.toProjectOrNull(currentProject)
|
||||||
|
|
||||||
internal fun ResolvedComponentResult.toProjectOrNull(currentProject: Project): Project? {
|
internal fun ResolvedComponentResult.toProjectOrNull(currentProject: Project): Project? {
|
||||||
val projectId = projectIdOrNull ?: return null
|
val projectId = currentBuildProjectIdOrNull ?: return null
|
||||||
return currentProject.project(projectId.projectPath)
|
return currentProject.project(projectId.projectPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -163,7 +163,7 @@ abstract class DefaultKotlinSourceSet @Inject constructor(
|
|||||||
|
|
||||||
return metadataDependencyResolutionByModule.mapNotNull { (groupAndName, resolution) ->
|
return metadataDependencyResolutionByModule.mapNotNull { (groupAndName, resolution) ->
|
||||||
val (group, name) = groupAndName
|
val (group, name) = groupAndName
|
||||||
val projectPath = resolution.dependency.projectIdOrNull?.projectPath
|
val projectPath = resolution.dependency.currentBuildProjectIdOrNull?.projectPath
|
||||||
when (resolution) {
|
when (resolution) {
|
||||||
// No metadata transformation leads to original dependency being used during import
|
// No metadata transformation leads to original dependency being used during import
|
||||||
is MetadataDependencyResolution.KeepOriginalDependency -> null
|
is MetadataDependencyResolution.KeepOriginalDependency -> null
|
||||||
|
|||||||
+1
-2
@@ -25,7 +25,6 @@ import org.jetbrains.kotlin.gradle.plugin.sources.*
|
|||||||
import org.jetbrains.kotlin.gradle.plugin.statistics.KotlinBuildStatsService
|
import org.jetbrains.kotlin.gradle.plugin.statistics.KotlinBuildStatsService
|
||||||
import org.jetbrains.kotlin.gradle.targets.native.internal.*
|
import org.jetbrains.kotlin.gradle.targets.native.internal.*
|
||||||
import org.jetbrains.kotlin.gradle.tasks.*
|
import org.jetbrains.kotlin.gradle.tasks.*
|
||||||
import org.jetbrains.kotlin.gradle.utils.addExtendsFromRelation
|
|
||||||
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
||||||
import org.jetbrains.kotlin.statistics.metrics.BooleanMetrics
|
import org.jetbrains.kotlin.statistics.metrics.BooleanMetrics
|
||||||
import java.util.concurrent.Callable
|
import java.util.concurrent.Callable
|
||||||
@@ -387,7 +386,7 @@ class KotlinMetadataTargetConfigurator :
|
|||||||
configuration.exclude(mapOf("group" to group, "module" to name))
|
configuration.exclude(mapOf("group" to group, "module" to name))
|
||||||
}
|
}
|
||||||
|
|
||||||
requested.filter { it.dependency.projectIdOrNull == null }.forEach {
|
requested.filter { it.dependency.currentBuildProjectIdOrNull == null }.forEach {
|
||||||
val (group, name) = ModuleIds.fromComponent(project, it.dependency)
|
val (group, name) = ModuleIds.fromComponent(project, it.dependency)
|
||||||
val notation = listOfNotNull(group.orEmpty(), name, it.dependency.moduleVersion?.version).joinToString(":")
|
val notation = listOfNotNull(group.orEmpty(), name, it.dependency.moduleVersion?.version).joinToString(":")
|
||||||
configuration.resolutionStrategy.force(notation)
|
configuration.resolutionStrategy.force(notation)
|
||||||
|
|||||||
Reference in New Issue
Block a user