[Gradle] Update test that resolves jsMain dependencies metadata

This behavior is incorrect and it is not supported by new
resolvable metadata dependencies configurations.
Because this configuration is expected to be resolved to metadata
artifacts only. And the fact that it gets resolvled to some platform
variant is not right. But is not critical as well.

The next steps is to remove metadata configurations from platform
source sets.
This commit is contained in:
Anton Lakotka
2023-01-06 10:48:02 +01:00
committed by Space Team
parent 0e3be164c7
commit ee3034328b
@@ -1013,24 +1013,23 @@ class NewMultiplatformIT : BaseGradleIT() {
}
""".trimIndent()
)
val metadataDependencyRegex = "$pathPrefix(.*?)->(.*)".toRegex()
build(
"printMetadataFiles",
options = buildOptions.copy(jsCompilerType = KotlinJsCompilerType.IR)
) {
assertSuccessful()
// After introducing Resolvable Metadata Dependencies configuration
// resolving nodeJsMainResolvableDependenciesMetadata is expected to fail for dependencies that have published
// both Legacy and IR klibs.
// Previously these Metadata Dependencies Configurations got resolved into platform artifacts which is incorrect
// and is just result of gradle's attempt to resolve to anything.
// TODO: Remove this test after removing Resolvable Metadata Dependencies for platform source sets.
assertFailed()
val expectedFileName = "sample-lib-nodejsir-1.0.klib"
val paths = metadataDependencyRegex
.findAll(output).map { it.groupValues[1] to it.groupValues[2] }
.filter { (_, f) -> "sample-lib" in f }
.toSet()
Assert.assertEquals(
setOf("nodeJsMainResolvable$METADATA_CONFIGURATION_NAME_SUFFIX" to expectedFileName),
paths
assertContains(
"However we cannot choose between the following variants of com.example:sample-lib-nodejs:1.0:",
"- nodeJsIrApiElements-published",
"- nodeJsLegacyApiElements-published",
)
}
}