[Gradle] Always add kotlin-stdlib-wasm

Published kotlin-stdlib with Gradle metadata does not yet include
kotlin-stdlib-wasm variant, so KGP should always add it separately even
if kotlin-stdlib was added into a common source set.

^KT-59000
This commit is contained in:
Yahor Berdnikau
2023-07-30 13:15:27 +02:00
committed by Space Team
parent 94013b1ff2
commit 73e8fc6183
2 changed files with 14 additions and 1 deletions
@@ -280,6 +280,19 @@ class KotlinSpecificDependenciesIT : KGPBaseTest() {
}
}
@JsGradlePluginTests
@DisplayName("Stdlib should be added into wasm compilations")
@GradleTest
fun testStdlibAddedIntoWasmCompilationDependencies(gradleVersion: GradleVersion) {
project("wasm-d8-simple-project", gradleVersion) {
checkTaskCompileClasspath(
"compileKotlinWasmJs",
listOf("kotlin-stdlib-wasm"),
isBuildGradleKts = true
)
}
}
@JvmGradlePluginTests
@DisplayName("KT-41642: adding stdlib should not resolve dependencies eagerly")
@GradleTest
@@ -140,7 +140,7 @@ private fun KotlinTarget.addStdlibDependency(
// except standalone compilations which as not using 'common'
if (isMppProject &&
stdlibVersion >= kotlin1920Version &&
compilation.platformType != KotlinPlatformType.common &&
(compilation.platformType != KotlinPlatformType.common && compilation.platformType != KotlinPlatformType.wasm) &&
kotlinSourceSet.hasDependencyOnCommon()
) return@withDependencies