From ee3034328baa159a6188b3b372a7e3f16e57b7d0 Mon Sep 17 00:00:00 2001 From: Anton Lakotka Date: Fri, 6 Jan 2023 10:48:02 +0100 Subject: [PATCH] [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. --- .../kotlin/gradle/NewMultiplatformIT.kt | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/NewMultiplatformIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/NewMultiplatformIT.kt index 1c6cd34a531..85f81763ea5 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/NewMultiplatformIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/NewMultiplatformIT.kt @@ -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", ) } }