Skip to content

Add Wasm-Wasi target to Okio integration #2727

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 11 additions & 20 deletions buildSrc/src/main/kotlin/source-sets-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ tasks.withType<JavaCompile>().configureEach {
options.release = 8
}

// Unfortunately there is no compatible version of okio for Wasm WASI target, so we need to skip to configure WASI for json-okio and json-tests.
// json-tests uses okio with incorporate with other formatter tests so it is hard and not worth to separate it for two projects for WASI.
// So we disable WASI target in it and we hope, that WASI version of compiler and serialization plugin are identical to the WasmJS target so WASI target is being covered.
val isOkIoOrFormatTests = (name == "kotlinx-serialization-json-okio" || name == "kotlinx-serialization-json-tests")

kotlin {
explicitApi()

Expand Down Expand Up @@ -63,10 +58,8 @@ kotlin {
nodejs()
}

if (!isOkIoOrFormatTests) {
wasmWasi {
nodejs()
}
wasmWasi {
nodejs()
}

sourceSets.all {
Expand Down Expand Up @@ -140,19 +133,17 @@ kotlin {
}
}

if (!isOkIoOrFormatTests) {
named("wasmWasiMain") {
dependsOn(named("wasmMain").get())
dependencies {
api("org.jetbrains.kotlin:kotlin-stdlib-wasm-wasi")
}
named("wasmWasiMain") {
dependsOn(named("wasmMain").get())
dependencies {
api("org.jetbrains.kotlin:kotlin-stdlib-wasm-wasi")
}
}

named("wasmWasiTest") {
dependsOn(named("wasmTest").get())
dependencies {
api("org.jetbrains.kotlin:kotlin-test-wasm-wasi")
}
named("wasmWasiTest") {
dependsOn(named("wasmTest").get())
dependencies {
api("org.jetbrains.kotlin:kotlin-test-wasm-wasi")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Klib ABI Dump
// Targets: [iosArm64, iosSimulatorArm64, iosX64, js, linuxArm64, linuxX64, macosArm64, macosX64, mingwX64, tvosArm64, tvosSimulatorArm64, tvosX64, wasmJs, watchosArm32, watchosArm64, watchosSimulatorArm64, watchosX64]
// Targets: [iosArm64, iosSimulatorArm64, iosX64, js, linuxArm64, linuxX64, macosArm64, macosX64, mingwX64, tvosArm64, tvosSimulatorArm64, tvosX64, wasmJs, wasmWasi, watchosArm32, watchosArm64, watchosSimulatorArm64, watchosX64]
// Rendering settings:
// - Signature version: 2
// - Show manifest properties: true
Expand Down
1 change: 1 addition & 0 deletions gradle/artifacts.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ kotlinx-serialization-json-okio-tvosarm64
kotlinx-serialization-json-okio-tvossimulatorarm64
kotlinx-serialization-json-okio-tvosx64
kotlinx-serialization-json-okio-wasm-js
kotlinx-serialization-json-okio-wasm-wasi
kotlinx-serialization-json-okio-watchosarm32
kotlinx-serialization-json-okio-watchosarm64
kotlinx-serialization-json-okio-watchossimulatorarm64
Expand Down
1 change: 1 addition & 0 deletions integration-test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ kotlin {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$serialization_version")
// To check that all expected artifacts are resolvable:
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json-io:$serialization_version")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json-okio:$serialization_version")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-protobuf:$serialization_version")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-cbor:$serialization_version")
}
Expand Down