Skip to content

Commit 60e8acb

Browse files
committed
Revert "WASM target implementation (#3849)"
This reverts commit 85afa72.
1 parent dc5d352 commit 60e8acb

Some content is hidden

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

53 files changed

+165
-981
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ See [Contributing Guidelines](CONTRIBUTING.md).
215215
[Dispatchers.IO]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-i-o.html
216216
[asCoroutineDispatcher]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/as-coroutine-dispatcher.html
217217
[Promise.await]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/await.html
218-
[promise]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/[js]promise.html
218+
[promise]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/promise.html
219219
[Window.asCoroutineDispatcher]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/as-coroutine-dispatcher.html
220220

221221
<!--- INDEX kotlinx.coroutines.flow -->

build.gradle

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,7 @@ configure(subprojects.findAll { !sourceless.contains(it.name) && it.name != core
157157
apply from: rootProject.file("gradle/compile-native-multiplatform.gradle")
158158
}
159159

160-
apply from: rootProject.file("gradle/compile-jsAndWasmShared-multiplatform.gradle")
161-
162160
apply from: rootProject.file("gradle/compile-js-multiplatform.gradle")
163-
164-
apply from: rootProject.file("gradle/compile-wasm-multiplatform.gradle")
165-
166161
kotlin.sourceSets.commonMain.dependencies {
167162
api project(":$coreModule")
168163
}
@@ -340,17 +335,3 @@ if (CacheRedirector.enabled) {
340335
nodeJsExtension.nodeDownloadBaseUrl = CacheRedirector.maybeRedirect(nodeJsExtension.nodeDownloadBaseUrl)
341336
}
342337
}
343-
344-
// Drop this configuration when the Node.JS version in KGP will support wasm gc milestone 4
345-
// check it here:
346-
// https://github.com/JetBrains/kotlin/blob/master/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/nodejs/NodeJsRootExtension.kt
347-
extensions.findByType(org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension.class).with {
348-
// canary nodejs that supports recent Wasm GC changes
349-
it.nodeVersion = "21.0.0-v8-canary202309167e82ab1fa2"
350-
it.nodeDownloadBaseUrl = "https://nodejs.org/download/v8-canary"
351-
}
352-
353-
// Drop this when node js version become stable
354-
tasks.withType(org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask).configureEach {
355-
args.add("--ignore-engines")
356-
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@file:JvmName("KotlinVersion")
2+
3+
fun isKotlinVersionAtLeast(kotlinVersion: String, atLeastMajor: Int, atLeastMinor: Int, atLeastPatch: Int): Boolean {
4+
val (major, minor) = kotlinVersion
5+
.split('.')
6+
.take(2)
7+
.map { it.toInt() }
8+
val patch = kotlinVersion.substringAfterLast('.').substringBefore('-').toInt()
9+
return when {
10+
major > atLeastMajor -> true
11+
major < atLeastMajor -> false
12+
else -> (minor == atLeastMinor && patch >= atLeastPatch) || minor > atLeastMinor
13+
}
14+
}

gradle/compile-js-multiplatform.gradle

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@ kotlin {
1212
}
1313

1414
sourceSets {
15-
jsMain {
16-
dependsOn(jsAndWasmSharedMain)
17-
}
18-
jsTest {
19-
dependsOn(jsAndWasmSharedTest)
20-
}
21-
2215
jsTest.dependencies {
2316
api "org.jetbrains.kotlin:kotlin-test-js:$kotlin_version"
2417
}

gradle/compile-jsAndWasmShared-multiplatform.gradle

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

gradle/compile-native-multiplatform.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import static KotlinVersion.isKotlinVersionAtLeast
2+
13
/*
24
* Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
35
*/

gradle/compile-wasm-multiplatform.gradle

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

gradle/dokka.gradle.kts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ tasks.withType(DokkaTaskPartial::class).configureEach {
4545
}
4646
}
4747

48-
val kotlin_version: String by project
49-
5048
if (project.name == "kotlinx-coroutines-core") {
5149
// Custom configuration for MPP modules
5250
tasks.withType(DokkaTaskPartial::class).configureEach {
@@ -66,10 +64,6 @@ if (project.name == "kotlinx-coroutines-core") {
6664
val jvmMain by getting {
6765
makeLinkMapping(project.file("jvm"))
6866
}
69-
70-
val wasmJsMain by getting {
71-
makeLinkMapping(project.file("wasm"))
72-
}
7367
}
7468
}
7569
}

integration-testing/build.gradle

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,3 @@ compileKotlin {
179179
jvmTarget = "1.8"
180180
}
181181
}
182-
183-
// Drop this when node js version become stable
184-
tasks.withType(org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask.class).configureEach {
185-
it.args.add("--ignore-engines")
186-
}

integration-testing/smokeTest/build.gradle

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,17 @@ plugins {
33
}
44

55
repositories {
6-
mavenCentral()
7-
maven { url "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev" }
86
// Coroutines from the outer project are published by previous CI buils step
97
mavenLocal()
8+
mavenCentral()
9+
maven { url "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev" }
1010
}
1111

1212
kotlin {
1313
jvm()
1414
js(IR) {
1515
nodejs()
1616
}
17-
wasmJs() {
18-
nodejs()
19-
}
2017

2118
sourceSets {
2219
commonMain {
@@ -37,11 +34,6 @@ kotlin {
3734
implementation kotlin('test-js')
3835
}
3936
}
40-
wasmJsTest {
41-
dependencies {
42-
implementation kotlin('test-wasm-js')
43-
}
44-
}
4537
jvmTest {
4638
dependencies {
4739
implementation kotlin('test')
@@ -58,11 +50,3 @@ kotlin {
5850
}
5951
}
6052

61-
// Drop this configuration when the Node.JS version in KGP will support wasm gc milestone 4
62-
// check it here:
63-
// https://github.com/JetBrains/kotlin/blob/master/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/nodejs/NodeJsRootExtension.kt
64-
rootProject.extensions.findByType(org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension.class).with {
65-
// canary nodejs that supports recent Wasm GC changes
66-
it.nodeVersion = "21.0.0-v8-canary202309167e82ab1fa2"
67-
it.nodeDownloadBaseUrl = "https://nodejs.org/download/v8-canary"
68-
}

kotlinx-coroutines-core/build.gradle

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,18 @@ if (rootProject.ext.native_targets_enabled) {
1919
apply from: rootProject.file("gradle/compile-native-multiplatform.gradle")
2020
}
2121

22-
apply from: rootProject.file("gradle/compile-jsAndWasmShared-multiplatform.gradle")
23-
2422
apply from: rootProject.file("gradle/compile-js-multiplatform.gradle")
2523

26-
apply from: rootProject.file("gradle/compile-wasm-multiplatform.gradle")
27-
2824
apply from: rootProject.file('gradle/dokka.gradle.kts')
2925
apply from: rootProject.file('gradle/publish.gradle')
3026
/* ==========================================================================
3127
Configure source sets structure for kotlinx-coroutines-core:
3228
3329
TARGETS SOURCE SETS
3430
------- ----------------------------------------------
35-
wasmJs \----------> jsAndWasmShared --------------------+
36-
js / |
31+
32+
js -----------------------------------------------------+
33+
|
3734
V
3835
jvmCore\ --------> jvm ---------> concurrent -------> common
3936
jdk8 / ^
@@ -245,7 +242,7 @@ kotlin.sourceSets {
245242

246243
kotlin.sourceSets.configureEach {
247244
// Do not apply 'ExperimentalForeignApi' where we have allWarningsAsErrors set
248-
if (it.name in ["jvmMain", "jvmCoreMain", "jsMain", 'wasmJsMain', 'jsAndWasmSharedMain', "concurrentMain", "commonMain"]) return
245+
if (it.name in ["jvmMain", "jvmCoreMain", "jsMain", "concurrentMain", "commonMain"]) return
249246
languageSettings {
250247
optIn('kotlinx.cinterop.ExperimentalForeignApi')
251248
optIn('kotlin.experimental.ExperimentalNativeApi')

kotlinx-coroutines-core/js/src/CoroutineContext.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ private external val navigator: dynamic
1212
private const val UNDEFINED = "undefined"
1313
internal external val process: dynamic
1414

15-
internal actual fun createDefaultDispatcher(): CoroutineDispatcher = when {
15+
internal fun createDefaultDispatcher(): CoroutineDispatcher = when {
1616
// Check if we are running under jsdom. WindowDispatcher doesn't work under jsdom because it accesses MessageEvent#source.
1717
// It is not implemented in jsdom, see https://github.com/jsdom/jsdom/blob/master/Changelog.md
1818
// "It's missing a few semantics, especially around origins, as well as MessageEvent source."

kotlinx-coroutines-core/jsAndWasmShared/src/Dispatchers.kt renamed to kotlinx-coroutines-core/js/src/Dispatchers.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ package kotlinx.coroutines
66

77
import kotlin.coroutines.*
88

9-
internal expect fun createDefaultDispatcher(): CoroutineDispatcher
10-
119
public actual object Dispatchers {
1210
public actual val Default: CoroutineDispatcher = createDefaultDispatcher()
1311
public actual val Main: MainCoroutineDispatcher

0 commit comments

Comments
 (0)