[Gradle] Check if host-specific metadata artifact exists for GMT

In gradle metadata transformations for CInterops in composite builds
it is possible that resolved artifact is not actually created.
For example if host machine is not MacOS but composite build has
projects with enabled Apple targets. So apple-specific tasks will be
disabled but still configured and during dependency resolution
its outputs will be provided in artifact view.

We have already checked for cases when there is no resolved artifact.
But apparently it is not enough, and it is important to check that file
exists physically.

^KT-63197 Verification Pending
This commit is contained in:
Anton Lakotka
2023-11-14 19:58:06 +01:00
committed by Space Team
parent 9fc7d3693e
commit 980708e533
@@ -169,6 +169,11 @@ internal class SourceSetVisibilityProvider(
?.singleOrNull()
?: return@mapNotNull null
// It can happen that host-specific artifact is mentioned in resolve but it doesn't exist physically
// then again gracefully return null
val metadataArtifactFile = metadataArtifact.file
if (!metadataArtifactFile.exists()) return@mapNotNull null
sourceSetName to metadataArtifact.file
}.toMap()
}