Skip to content

Commit

Permalink
AMMEND (upgrade kotlin to 1.9.20)
Browse files Browse the repository at this point in the history
AMMEND
  • Loading branch information
igoriakovlev authored and mvicsokolova committed Nov 13, 2023
1 parent 1dadd03 commit b58cc61
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 79 deletions.
59 changes: 11 additions & 48 deletions atomicfu/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/

import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
import static KotlinVersion.*

apply plugin: 'kotlin-multiplatform'
apply from: rootProject.file("gradle/targets.gradle")
Expand All @@ -20,14 +19,6 @@ ext {
}
}

// TODO: this block should be removed when Kotlin version is updated to 1.9.20
// Right now it is used for conditional removal of native targets that will be removed in 1.9.20 (iosArm32, watchosX86)
// and is necessary for testing of Kotlin dev builds.
def enableDeprecatedNativeTargets = !isKotlinVersionAtLeast(ext.kotlin_version, 1, 9, 20)

// Right now it is used for conditional dependency named in wasm stdlib and kotlin.test for 1.9.20
// and is necessary for testing of Kotlin dev builds.
def isNewWasmTargetEnabled = isKotlinVersionAtLeast(ext.kotlin_version, 1, 9, 20)

kotlin {
targets {
Expand All @@ -47,14 +38,9 @@ kotlin {
// JVM -- always
jvm()

if (isNewWasmTargetEnabled) {
wasmJs {
nodejs()
}
} else {
wasm {
nodejs()
}
// Wasm -- always
wasmJs {
nodejs()
}

sourceSets {
Expand Down Expand Up @@ -86,36 +72,19 @@ kotlin {
}
}

if (isNewWasmTargetEnabled) {
wasmJsMain {
dependsOn(sourceSets.jsAndWasmSharedMain)
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-wasm-js'
}
}
} else {
wasmMain {
dependsOn(sourceSets.jsWasmMain)
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-wasm'
}
wasmJsMain {
dependsOn(sourceSets.jsAndWasmSharedMain)
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-wasm-js'
}
}


if (isNewWasmTargetEnabled) {
wasmJsTest {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-test-wasm-js'
}
}
} else {
wasmTest {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-test-wasm'
}
wasmJsTest {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-test-wasm-js'
}
}

jvmMain {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib'
Expand Down Expand Up @@ -167,12 +136,6 @@ if (rootProject.ext.native_targets_enabled) {
addTarget(presets.androidNativeX64)
addTarget(presets.mingwX64)
addTarget(presets.watchosDeviceArm64)

// These targets will be removed in 1.9.20, remove them conditionally for the train builds
if (enableDeprecatedNativeTargets) {
addTarget(presets.iosArm32)
addTarget(presets.watchosX86)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ public actual open class SynchronizedObject {
}
}

// fixme replace the suppress with AllowDifferentMembersInActual once stdlib is updated to 1.9.20 https://github.com/Kotlin/kotlinx-atomicfu/issues/333
@Suppress("NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION")
public fun tryLock(): Boolean {
val currentThreadId = pthread_self()!!
while (true) {
Expand Down
21 changes: 6 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

import org.jetbrains.kotlin.konan.target.HostManager

import static KotlinVersion.isKotlinVersionAtLeast

buildscript {
def overridingKotlinVersion = KotlinConfiguration.getOverridingKotlinVersion(project)
if (overridingKotlinVersion != null) { project.kotlin_version = overridingKotlinVersion }
Expand Down Expand Up @@ -109,20 +107,13 @@ if (build_snapshot_train) {
task deploy(dependsOn: getTasksByName("publish", true) + getTasksByName("publishNpm", true))

// Right now it is used for switching nodejs version which is supports generated wasm bytecode
def isNewWasmTargetEnabled = isKotlinVersionAtLeast(ext.kotlin_version, 1, 9, 20)
extensions.findByType(org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension.class).with {
if (isNewWasmTargetEnabled) {
// canary nodejs that supports recent Wasm GC changes
it.nodeVersion = '21.0.0-v8-canary202309167e82ab1fa2'
it.nodeDownloadBaseUrl = 'https://nodejs.org/download/v8-canary'
} else {
it.nodeVersion = '20.2.0'
}
// canary nodejs that supports recent Wasm GC changes
it.nodeVersion = '21.0.0-v8-canary202309167e82ab1fa2'
it.nodeDownloadBaseUrl = 'https://nodejs.org/download/v8-canary'
}

// We need to ignore unsupported engines (i.e. canary) for npm
if (isNewWasmTargetEnabled) {
tasks.withType(org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask).configureEach {
args.add("--ignore-engines")
}
}
tasks.withType(org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask).configureEach {
args.add("--ignore-engines")
}
14 changes: 0 additions & 14 deletions buildSrc/src/main/kotlin/KotlinVersion.kt

This file was deleted.

0 comments on commit b58cc61

Please sign in to comment.