diff --git a/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-multiplatform.gradle.kts b/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-multiplatform.gradle.kts index 8dc93f5c3..19ed95179 100644 --- a/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-multiplatform.gradle.kts +++ b/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-multiplatform.gradle.kts @@ -46,6 +46,12 @@ kotlin { binaries.executable() } + @OptIn(org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl::class) + wasmWasi { + nodejs() + binaries.executable() + } + sourceSets { commonTest { dependencies { @@ -90,12 +96,8 @@ kotlin { createSourceSet("linuxTest", parent = unixTest, children = linuxTargets()) createSourceSet("androidMain", parent = unixMain, children = androidTargets()) createSourceSet("androidTest", parent = unixTest, children = androidTargets()) - getByName("wasmJsMain") { - kotlin.srcDir(File(File(projectDir, "wasm"), "src")) - } - getByName("wasmJsTest") { - kotlin.srcDir(File(File(projectDir, "wasm"), "test")) - } + createSourceSet("wasmMain", parent = commonMain.get(), children = wasmTargets()) + createSourceSet("wasmTest", parent = commonTest.get(), children = wasmTargets()) } } @@ -198,6 +200,8 @@ fun androidTargets() = listOf( "androidNativeX86" ) +fun wasmTargets() = listOf("wasmJs", "wasmWasi") + rootProject.the().apply { nodeVersion = "21.0.0-v8-canary202310177990572111" nodeDownloadBaseUrl = "https://nodejs.org/download/v8-canary" diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 26b89e9b8..fefa361f4 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -4,6 +4,7 @@ */ import org.jetbrains.dokka.gradle.DokkaTaskPartial +import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinTargetWithNodeJsDsl plugins { id("kotlinx-io-multiplatform") @@ -31,9 +32,8 @@ kotlin { } } - @OptIn(org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl::class) - wasmJs { - nodejs { + fun KotlinTargetWithNodeJsDsl.filterSmokeTests() { + this.nodejs { testTask(Action { useMocha { timeout = "300s" @@ -43,6 +43,16 @@ kotlin { } } + @OptIn(org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl::class) + wasmJs { + filterSmokeTests() + } + + @OptIn(org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl::class) + wasmWasi { + filterSmokeTests() + } + sourceSets { commonMain { dependencies {