Skip to content

Commit 64d3913

Browse files
authored
Kotlin/Wasm support (#1099)
1 parent 33e896d commit 64d3913

70 files changed

Lines changed: 403 additions & 256 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

gradle/libs.versions.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ atomicfu = "0.29.0"
55
coroutines = "1.10.2"
66
jna = "5.18.1"
77
jvm-toolchain = "17"
8-
kotlin = "2.2.20"
8+
kotlin = "2.2.21"
99
tuulbox = "8.1.0"
1010

1111
[libraries]
@@ -16,6 +16,7 @@ equalsverifier = { module = "nl.jqno.equalsverifier:equalsverifier", version = "
1616
jna = { module = "net.java.dev.jna:jna", version.ref = "jna" }
1717
khronicle = { module = "com.juul.khronicle:khronicle-core", version = "0.6.0" }
1818
kotlin-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
19+
kotlinx-browser = { module = "org.jetbrains.kotlinx:kotlinx-browser", version = "0.5.0" }
1920
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines" }
2021
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
2122
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" }
@@ -26,6 +27,7 @@ tomlkt = { module = "net.peanuuutz.tomlkt:tomlkt", version = "0.5.0" }
2627
tuulbox-collections = { module = "com.juul.tuulbox:collections", version.ref = "tuulbox" }
2728
tuulbox-coroutines = { module = "com.juul.tuulbox:coroutines", version.ref = "tuulbox" }
2829
wrappers-bom = { module = "org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom", version = "2025.12.6" }
30+
wrappers-browser = { module = "org.jetbrains.kotlin-wrappers:kotlin-browser" }
2931
wrappers-web = { module = "org.jetbrains.kotlin-wrappers:kotlin-web" }
3032

3133
[plugins]

kable-core/build.gradle.kts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,19 @@ kotlin {
2020
macosArm64()
2121
macosX64()
2222
jvm()
23+
wasmJs().browser()
2324

2425
sourceSets {
2526
all {
2627
languageSettings {
28+
optIn("kotlin.js.ExperimentalWasmJsInterop")
2729
optIn("kotlin.uuid.ExperimentalUuidApi")
2830
}
2931
}
3032

3133
commonMain.dependencies {
3234
api(libs.kotlinx.coroutines.core)
3335
api(libs.kotlinx.io)
34-
implementation(libs.tuulbox.collections)
3536
}
3637

3738
commonTest.dependencies {
@@ -59,7 +60,9 @@ kotlin {
5960
implementation(libs.robolectric)
6061
}
6162

62-
jsMain.dependencies {
63+
webMain.dependencies {
64+
api(libs.kotlinx.browser)
65+
api(libs.wrappers.browser)
6366
api(libs.wrappers.web)
6467
api(project.dependencies.platform(libs.wrappers.bom))
6568
}

kable-core/src/commonTest/kotlin/SharedRepeatableActionTests.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.juul.kable
22

3-
import kotlinx.coroutines.CancellationException
43
import kotlinx.coroutines.CoroutineScope
54
import kotlinx.coroutines.CoroutineStart.UNDISPATCHED
65
import kotlinx.coroutines.Job
@@ -22,6 +21,7 @@ import kotlinx.coroutines.launch
2221
import kotlinx.coroutines.supervisorScope
2322
import kotlinx.coroutines.test.runTest
2423
import kotlinx.coroutines.yield
24+
import kotlin.coroutines.cancellation.CancellationException
2525
import kotlin.test.Test
2626
import kotlin.test.assertEquals
2727
import kotlin.test.assertFailsWith

kable-core/src/jsMain/kotlin/Bluetooth.kt

Lines changed: 0 additions & 36 deletions
This file was deleted.

kable-core/src/jsMain/kotlin/bluetooth/WatchingAdvertisementsSupport.kt

Lines changed: 0 additions & 11 deletions
This file was deleted.

kable-core/src/jsMain/kotlin/external/Navigator.kt

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.juul.kable.interop
2+
3+
import kotlin.js.Promise
4+
import kotlinx.coroutines.await as kotlinxAwait
5+
6+
internal actual suspend fun <T : JsAny?> Promise<T>.await(): T = kotlinxAwait()

kable-core/src/jsMain/kotlin/logs/SystemLogEngine.kt

Lines changed: 0 additions & 48 deletions
This file was deleted.

kable-core/src/jsTest/kotlin/Environment.kt

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.juul.kable.interop
2+
3+
import kotlin.js.Promise
4+
import kotlinx.coroutines.await as kotlinxAwait
5+
6+
internal actual suspend fun <T : JsAny?> Promise<T>.await(): T = kotlinxAwait()

0 commit comments

Comments
 (0)