Skip to content

Commit

Permalink
Enable WasmWasi target (#236)
Browse files Browse the repository at this point in the history
Added WasmWasi target sharing the same source code with WasmJs target for now.

Closes #234
  • Loading branch information
fzhinkin authored Dec 1, 2023
1 parent 2f01d92 commit 080b027
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ kotlin {
binaries.executable()
}

@OptIn(org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl::class)
wasmWasi {
nodejs()
binaries.executable()
}

sourceSets {
commonTest {
dependencies {
Expand Down Expand Up @@ -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())
}
}

Expand Down Expand Up @@ -198,6 +200,8 @@ fun androidTargets() = listOf(
"androidNativeX86"
)

fun wasmTargets() = listOf("wasmJs", "wasmWasi")

rootProject.the<NodeJsRootExtension>().apply {
nodeVersion = "21.0.0-v8-canary202310177990572111"
nodeDownloadBaseUrl = "https://nodejs.org/download/v8-canary"
Expand Down
16 changes: 13 additions & 3 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

import org.jetbrains.dokka.gradle.DokkaTaskPartial
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinTargetWithNodeJsDsl

plugins {
id("kotlinx-io-multiplatform")
Expand Down Expand Up @@ -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"
Expand All @@ -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 {
Expand Down

0 comments on commit 080b027

Please sign in to comment.