[Gradle] Fix CInterop commonization for included builds

KT-58471 Verification Pending
This commit is contained in:
Anton Lakotka
2023-05-19 13:10:58 +02:00
committed by Space Team
parent b6a3a60f36
commit 9ead1d84b1
2 changed files with 9 additions and 2 deletions
@@ -82,7 +82,7 @@ internal class MetadataDependencyTransformationTaskInputs(
private fun Configuration.withoutProjectDependencies(): FileCollection {
return incoming.artifactView { view ->
view.componentFilter { componentIdentifier ->
componentIdentifier !is ProjectComponentIdentifier
componentIdentifier !is ProjectComponentIdentifier || !componentIdentifier.build.isCurrentBuild
}
}.files
}
@@ -197,7 +197,14 @@ internal open class CInteropMetadataDependencyTransformationTask @Inject constru
private fun Iterable<MetadataDependencyResolution>.resolutionsToTransform(): List<ChooseVisibleSourceSets> {
return filterIsInstance<ChooseVisibleSourceSets>()
.applyIf(skipProjectDependencies) { filter { it.dependency.id !is ProjectComponentIdentifier } }
.applyIf(skipProjectDependencies) {
filterNot {
val dependencyId = it.dependency.id
// filter out ProjectDependencies but keep the ones which are coming from included builds
// i.e. they are ProjectDependencies but have isCurrentBuild = false
dependencyId is ProjectComponentIdentifier && dependencyId.build.isCurrentBuild
}
}
}
}