Skip to content
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

Add support for wasmJs #567

Merged
merged 9 commits into from
Jun 16, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This library adds YAML support to [kotlinx.serialization](https://github.com/Kot

Currently, only Kotlin/JVM is fully supported.

Kotlin/JS support is considered highly experimental. It is not yet fully functional, and may be removed or modified at any time.
Kotlin/JS and Kotlin/Wasm support are considered highly experimental. It is not yet fully functional, and may be removed or modified at any time.

(Follow [this issue](https://github.com/charleskorn/kaml/issues/232) for a discussion of adding support for other targets.)

Expand Down
16 changes: 16 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import com.charleskorn.kaml.build.configureTesting
import com.charleskorn.kaml.build.configureVersioning
import com.charleskorn.kaml.build.configureWrapper
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrLink
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
Expand Down Expand Up @@ -60,6 +61,12 @@ kotlin {
binaries.executable()
}

wasmJs {
binaries.library()
browser()
nodejs()
}

sourceSets {
commonMain {
dependencies {
Expand Down Expand Up @@ -92,6 +99,15 @@ tasks.withType<KotlinCompile>().configureEach {
}
}

tasks.withType<KotlinJsIrLink>().configureEach {
compilerOptions {
// Catching IndexOutOfBoundsException in Kotlin/Wasm is impossible by default,
krzema12 marked this conversation as resolved.
Show resolved Hide resolved
// unless we enable "-Xwasm-enable-array-range-checks" compiler flag.
// See https://youtrack.jetbrains.com/issue/KT-59081/
freeCompilerArgs.add("-Xwasm-enable-array-range-checks")
}
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
kotlin.code.style=official
kotlin.daemon.jvmargs=-Xmx512g
krzema12 marked this conversation as resolved.
Show resolved Hide resolved
Loading
Loading