Skip to content

Commit be53cd3

Browse files
authored
Remove dependency on native-mt version of Coroutines (#134)
1 parent 664e766 commit be53cd3

3 files changed

Lines changed: 29 additions & 15 deletions

File tree

README.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,32 @@ kotlin {
282282
sourceSets {
283283
val commonMain by getting {
284284
dependencies {
285-
implementation("com.juul.kable:core:$version")
285+
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${coroutinesVersion}")
286+
implementation("com.juul.kable:core:${kableVersion}")
286287
}
287288
}
289+
290+
val nativeMain by creating {
291+
dependencies {
292+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${coroutinesVersion}-native-mt") {
293+
version {
294+
strictly("${coroutinesVersion}-native-mt")
295+
}
296+
}
297+
}
298+
}
299+
300+
val macosX64Main by getting {
301+
dependsOn(nativeMain)
302+
}
303+
304+
val iosX64Main by getting {
305+
dependsOn(nativeMain)
306+
}
307+
308+
val iosArm64Main by getting {
309+
dependsOn(nativeMain)
310+
}
288311
}
289312
}
290313

@@ -293,9 +316,9 @@ android {
293316
}
294317
```
295318

296-
_Note that Apple-based targets (e.g. `macosX64`) require [Coroutines with multithread support for Kotlin/Native] (more
297-
specifically: Coroutines library artifacts that are suffixed with `-native-mt`). Kable is configured to use `-native-mt`
298-
as a transitive dependency for Apple-based targets._
319+
_Note that for compatibility with Kable, Native targets (e.g. `macosX64`) require
320+
[Coroutines with multithread support for Kotlin/Native] (more specifically: Coroutines library artifacts that are
321+
suffixed with `-native-mt`)._
299322

300323
#### Platform-specific
301324

buildSrc/src/main/kotlin/Dependencies.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
fun coroutines(
2-
module: String,
2+
module: String = "core",
33
version: String = "1.5.0"
44
): String = "org.jetbrains.kotlinx:kotlinx-coroutines-$module:$version"
55

core/build.gradle.kts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,11 @@ kotlin {
2222
sourceSets {
2323
val commonMain by getting {
2424
dependencies {
25-
api(coroutines("core", version = "1.5.0-native-mt"))
25+
api(coroutines())
2626
api(uuid())
2727
}
2828
}
2929

30-
val jsMain by getting {
31-
dependencies {
32-
api(coroutines("core"))
33-
}
34-
}
35-
3630
val androidMain by getting {
3731
dependencies {
3832
api(coroutines("android"))
@@ -43,21 +37,18 @@ kotlin {
4337

4438
val macosX64Main by getting {
4539
dependencies {
46-
api(coroutines("core", version = "1.5.0-native-mt!!"))
4740
implementation(stately("isolate-macosx64"))
4841
}
4942
}
5043

5144
val iosX64Main by getting {
5245
dependencies {
53-
api(coroutines("core", version = "1.5.0-native-mt!!"))
5446
implementation(stately("isolate-iosx64"))
5547
}
5648
}
5749

5850
val iosArm64Main by getting {
5951
dependencies {
60-
api(coroutines("core", version = "1.5.0-native-mt!!"))
6152
implementation(stately("isolate-iosarm64"))
6253
}
6354
}

0 commit comments

Comments
 (0)