Skip to content

Commit 080b027

Browse files
authored
Enable WasmWasi target (#236)
Added WasmWasi target sharing the same source code with WasmJs target for now. Closes #234
1 parent 2f01d92 commit 080b027

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-multiplatform.gradle.kts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ kotlin {
4646
binaries.executable()
4747
}
4848

49+
@OptIn(org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl::class)
50+
wasmWasi {
51+
nodejs()
52+
binaries.executable()
53+
}
54+
4955
sourceSets {
5056
commonTest {
5157
dependencies {
@@ -90,12 +96,8 @@ kotlin {
9096
createSourceSet("linuxTest", parent = unixTest, children = linuxTargets())
9197
createSourceSet("androidMain", parent = unixMain, children = androidTargets())
9298
createSourceSet("androidTest", parent = unixTest, children = androidTargets())
93-
getByName("wasmJsMain") {
94-
kotlin.srcDir(File(File(projectDir, "wasm"), "src"))
95-
}
96-
getByName("wasmJsTest") {
97-
kotlin.srcDir(File(File(projectDir, "wasm"), "test"))
98-
}
99+
createSourceSet("wasmMain", parent = commonMain.get(), children = wasmTargets())
100+
createSourceSet("wasmTest", parent = commonTest.get(), children = wasmTargets())
99101
}
100102
}
101103

@@ -198,6 +200,8 @@ fun androidTargets() = listOf(
198200
"androidNativeX86"
199201
)
200202

203+
fun wasmTargets() = listOf("wasmJs", "wasmWasi")
204+
201205
rootProject.the<NodeJsRootExtension>().apply {
202206
nodeVersion = "21.0.0-v8-canary202310177990572111"
203207
nodeDownloadBaseUrl = "https://nodejs.org/download/v8-canary"

core/build.gradle.kts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
import org.jetbrains.dokka.gradle.DokkaTaskPartial
7+
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinTargetWithNodeJsDsl
78

89
plugins {
910
id("kotlinx-io-multiplatform")
@@ -31,9 +32,8 @@ kotlin {
3132
}
3233
}
3334

34-
@OptIn(org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl::class)
35-
wasmJs {
36-
nodejs {
35+
fun KotlinTargetWithNodeJsDsl.filterSmokeTests() {
36+
this.nodejs {
3737
testTask(Action {
3838
useMocha {
3939
timeout = "300s"
@@ -43,6 +43,16 @@ kotlin {
4343
}
4444
}
4545

46+
@OptIn(org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl::class)
47+
wasmJs {
48+
filterSmokeTests()
49+
}
50+
51+
@OptIn(org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl::class)
52+
wasmWasi {
53+
filterSmokeTests()
54+
}
55+
4656
sourceSets {
4757
commonMain {
4858
dependencies {

0 commit comments

Comments
 (0)