From 5d062c962ec342195873abcb098fa7e571e1094c Mon Sep 17 00:00:00 2001 From: Jun Sekine Date: Thu, 14 May 2026 00:28:28 +0900 Subject: [PATCH] Add wasmWasi target - Declare wasmWasi(nodejs) in build.gradle.kts so commonMain (kotlinx-io based reader/writer) compiles for WASI runtimes. - Disable compileTestKotlinWasmWasi / wasmWasiTest / wasmWasiNodeTest until Kotest publishes wasmWasi artifacts; commonTest cannot be compiled for this target otherwise. - Add compileKotlinWasmWasi to the Linux CI job to guard against regressions. --- .github/workflows/build_and_test.yml | 2 +- build.gradle.kts | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index bc27ed9..e13b65a 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -26,7 +26,7 @@ jobs: - name: Run Linux, JVM, JS checks and generate coverage report run: | - ./gradlew clean jvmTest jsNodeTest linuxX64Test compileKotlinLinuxArm64 compileTestKotlinLinuxArm64 checkKotlinAbi koverXmlReport + ./gradlew clean jvmTest jsNodeTest linuxX64Test compileKotlinLinuxArm64 compileTestKotlinLinuxArm64 compileKotlinWasmWasi checkKotlinAbi koverXmlReport - name: Upload coverage report to Codecov uses: codecov/codecov-action@v4 diff --git a/build.gradle.kts b/build.gradle.kts index 8e9b35c..79a22d2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,7 @@ import com.vanniktech.maven.publish.JavadocJar import com.vanniktech.maven.publish.KotlinMultiplatform import com.vanniktech.maven.publish.SourcesJar +import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile @@ -40,6 +41,11 @@ kotlin { linuxArm64() mingwX64() + @OptIn(ExperimentalWasmDsl::class) + wasmWasi { + nodejs() + } + sourceSets { commonMain { dependencies { @@ -73,6 +79,12 @@ tasks.withType().configureEach { useJUnitPlatform() } +// Kotest 6.x does not publish wasmWasi artifacts yet, so commonTest cannot be +// compiled for this target. Validate main compilation only until upstream support lands. +listOf("compileTestKotlinWasmWasi", "wasmWasiTest", "wasmWasiNodeTest").forEach { taskName -> + tasks.matching { it.name == taskName }.configureEach { enabled = false } +} + // Kotest 6.x JVM artifacts are built with Java 11 bytecode, while the library // artifact itself still targets Java 8 for consumer compatibility. tasks.named("compileTestKotlinJvm") {