Skip to content

Commit fca907a

Browse files
committed
fix build warnings
- The Kotlin compiler option `-Xexpect-actual-classes` has been added to the `core/domain`, `core/data/db-sqldelight`, `ui/shared`, and `ui/test` modules to support the new class hierarchy model. - The `runBlockingAll` implementation for the `wasmJs` target has been updated to use `startCoroutine` instead of the now-removed `promise` API. - The `kotlin.js.ExperimentalWasmJsInterop` opt-in has been enabled for the `ui/test` module. - In `app/desktop/build.gradle.kts`, the `languageSettings.optIn("kotlin.RequiresOptIn")` block has been moved to after the `dependencies` block for better organization.
1 parent a39ef73 commit fca907a

File tree

6 files changed

+16
-5
lines changed

6 files changed

+16
-5
lines changed

app/desktop/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ kotlin {
1616
applyDefaultHierarchyTemplate()
1717

1818
sourceSets {
19-
all {
20-
languageSettings.optIn("kotlin.RequiresOptIn")
21-
}
2219
jvmMain.dependencies {
2320
implementation(projects.core.domain)
2421
implementation(projects.core.presentation)
@@ -44,6 +41,9 @@ kotlin {
4441
implementation(libs.kotlinx.datetime)
4542
implementation(libs.androidx.lifecycle.runtime.testing)
4643
}
44+
all {
45+
languageSettings.optIn("kotlin.RequiresOptIn")
46+
}
4747
}
4848
}
4949

core/data/db-sqldelight/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ kotlin {
9292
}
9393
if (!OperatingSystem.current().isMacOsX) noPodspec()
9494
}
95+
compilerOptions.freeCompilerArgs.add("-Xexpect-actual-classes")
9596
}
9697

9798
android {

core/domain/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ kotlin {
4949
wasmJsTest.dependencies {
5050
}
5151
}
52+
compilerOptions.freeCompilerArgs.add("-Xexpect-actual-classes")
5253
}
5354
android {
5455
namespace = "com.softartdev.notedelight.core.domain"

core/domain/src/wasmJsMain/kotlin/com/softartdev/notedelight/util/runBlockingAll.wasmJs.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@ package com.softartdev.notedelight.util
66
import kotlinx.coroutines.CoroutineScope
77
import kotlinx.coroutines.DelicateCoroutinesApi
88
import kotlinx.coroutines.GlobalScope
9-
import kotlinx.coroutines.promise
9+
import kotlin.coroutines.Continuation
1010
import kotlin.coroutines.CoroutineContext
11+
import kotlin.coroutines.startCoroutine
1112

1213
actual fun <T> runBlockingAll(context: CoroutineContext, block: suspend CoroutineScope.() -> T): T {
13-
return GlobalScope.promise(context) { block() } as T
14+
var out: Result<T>? = null
15+
val continuation: Continuation<T> = Continuation(context) { out = it }
16+
block.startCoroutine(receiver = GlobalScope, completion = continuation)
17+
return out!!.getOrThrow()
1418
}

ui/shared/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ kotlin {
9797
}
9898
if (!OperatingSystem.current().isMacOsX) noPodspec()
9999
}
100+
compilerOptions.freeCompilerArgs.add("-Xexpect-actual-classes")
100101
}
101102

102103
android {

ui/test/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ kotlin {
6868
}
6969
}
7070
val androidInstrumentedTest by getting
71+
all {
72+
languageSettings.optIn("kotlin.js.ExperimentalWasmJsInterop")
73+
}
7174
}
7275
cocoapods {
7376
summary = "UI test library for the NoteDelight app"
@@ -80,6 +83,7 @@ kotlin {
8083
}
8184
if (!OperatingSystem.current().isMacOsX) noPodspec()
8285
}
86+
compilerOptions.freeCompilerArgs.add("-Xexpect-actual-classes")
8387
}
8488

8589
android {

0 commit comments

Comments
 (0)