From ff1dbab2906dfa537d4696b87b1dcfac2522221d Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Fri, 14 Jul 2023 23:11:29 +0200 Subject: [PATCH] [stdlib-mpp] Extract separate variants of kotlin-test for jsIR and jsV1 Otherwise stdlib-js dependency can't be resolved by spdx plugin because stdlib has different variants for legacy and IR JS. KT-56106 --- libraries/kotlin.test/build.gradle.kts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/libraries/kotlin.test/build.gradle.kts b/libraries/kotlin.test/build.gradle.kts index d0c602504ca..947f4591e9e 100644 --- a/libraries/kotlin.test/build.gradle.kts +++ b/libraries/kotlin.test/build.gradle.kts @@ -4,6 +4,7 @@ import plugins.configureDefaultPublishing import plugins.configureKotlinPomAttributes import groovy.util.Node import groovy.util.NodeList +import org.jetbrains.kotlin.gradle.targets.js.KotlinJsCompilerAttribute plugins { id("org.jetbrains.kotlin.multiplatform") apply false @@ -260,19 +261,36 @@ val (jsApi, jsRuntime) = listOf("api", "runtime").map { usage -> attributes { attribute(Usage.USAGE_ATTRIBUTE, objects.named("kotlin-$usage")) attribute(KotlinPlatformType.attribute, KotlinPlatformType.js) + attribute(KotlinJsCompilerAttribute.jsCompilerAttribute, KotlinJsCompilerAttribute.ir) } } } jsRuntime.extendsFrom(jsApi) +val (jsV1Api, jsV1Runtime) = listOf("api", "runtime").map { usage -> + configurations.create("jsV1${usage.capitalize()}") { + isCanBeConsumed = true + isCanBeResolved = true + attributes { + attribute(Usage.USAGE_ATTRIBUTE, objects.named("kotlin-$usage")) + attribute(KotlinPlatformType.attribute, KotlinPlatformType.js) + attribute(KotlinJsCompilerAttribute.jsCompilerAttribute, KotlinJsCompilerAttribute.legacy) + } + } +} +jsV1Runtime.extendsFrom(jsV1Api) + dependencies { jsApi(project(":kotlin-stdlib")) + jsV1Api(project(":kotlin-stdlib")) } artifacts { val jsJar = tasks.getByPath(":kotlin-test:kotlin-test-js:libraryJarWithIr") add(jsApi.name, jsJar) add(jsRuntime.name, jsJar) + add(jsV1Api.name, jsJar) + add(jsV1Runtime.name, jsJar) } val jsComponent = componentFactory.adhoc("js").apply { @@ -282,6 +300,12 @@ val jsComponent = componentFactory.adhoc("js").apply { addVariantsFromConfiguration(jsRuntime) { mapToMavenScope("runtime") } + addVariantsFromConfiguration(jsV1Api) { + mapToMavenScope("compile") + } + addVariantsFromConfiguration(jsV1Runtime) { + mapToMavenScope("runtime") + } } val (wasmApi, wasmRuntime) = listOf("api", "runtime").map { usage ->