[Gradle] CInteropMetadataDependencyTransformationTask: Ignore project dependencies

Included builds will still resolve using a regular
ArtifactMetadataProvider (but using a ProjectComponentIdentifier).

Such dependencies shall not try to go through cinterop metadata
transformation. Right now commonized dependencies from
included builds will just not be visible/exported to the
consumer builds.

Using cinterop declarations inside the API surface will
not be enabled until more stability guarantees for cinterops can
be provided

^KT-56115 Verification Pending
This commit is contained in:
Sebastian Sellmair
2023-01-24 11:59:04 +01:00
committed by Space Team
parent d94a9411e0
commit 103fb39306
@@ -158,7 +158,7 @@ internal open class CInteropMetadataDependencyTransformationTask @Inject constru
get() = sourceSet
.compileDependenciesTransformationOrFail
.metadataDependencyResolutions
.filterIsInstance<ChooseVisibleSourceSets>()
.resolutionsToTransform()
@Suppress("unused")
@get:Nested
@@ -188,7 +188,7 @@ internal open class CInteropMetadataDependencyTransformationTask @Inject constru
into this field
*/
val transformation = GranularMetadataTransformation(parameters, ParentSourceSetVisibilityProvider.Empty)
val chooseVisibleSourceSets = transformation.metadataDependencyResolutions.filterIsInstance<ChooseVisibleSourceSets>()
val chooseVisibleSourceSets = transformation.metadataDependencyResolutions.resolutionsToTransform()
val transformedLibraries = chooseVisibleSourceSets.flatMap(::materializeMetadata)
KotlinMetadataLibrariesIndexFile(outputLibrariesFileIndex.get().asFile).write(transformedLibraries)
}
@@ -216,5 +216,11 @@ internal open class CInteropMetadataDependencyTransformationTask @Inject constru
}
}.files
}
private fun Iterable<MetadataDependencyResolution>.resolutionsToTransform(): List<ChooseVisibleSourceSets> {
return filterIsInstance<ChooseVisibleSourceSets>()
/* We do not care about Project to Project dependencies: Those shall use the commonizer output directly (no transformation) */
.filter { it.dependency.id !is ProjectComponentIdentifier }
}
}