Skip to content

Commit 7697fff

Browse files
authored
Conditionally remove targets that are removed after 1.9.20. (#320)
1 parent 33fbf92 commit 7697fff

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

atomicfu-gradle-plugin/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ dependencies {
9393
}
9494

9595
// Skip these tests if Kotlin version >= 1.9.0, as JS Legacy is no longer supported there
96-
if (isKotlinVersionAtLeast(ext.kotlin_version, 1, 9)) {
96+
if (isKotlinVersionAtLeast(ext.kotlin_version, 1, 9, 0)) {
9797
test {
9898
exclude "**/JsLegacyTransformationTest*", "**/MppLegacyTransformationTest*"
9999
}

atomicfu/build.gradle

+11-5
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@ ext {
2121
}
2222

2323
// TODO: this block should be removed when Kotlin version is updated to 1.9.0
24-
// (right now it implements a toggle between IR and BOTH JS compiler types for testing of Kotlin dev builds)
25-
def isJsLegacyCompilerEnabled = !isKotlinVersionAtLeast(ext.kotlin_version, 1, 9)
24+
// Right now it implements a toggle between IR and BOTH JS compiler types for testing of Kotlin dev builds
25+
def isJsLegacyCompilerEnabled = !isKotlinVersionAtLeast(ext.kotlin_version, 1, 9, 0)
26+
// TODO: this block should be removed when Kotlin version is updated to 1.9.20
27+
// Right now it is used for conditional removal of native targets that will be removed in 1.9.20 (iosArm32, watchosX86)
28+
// and is necessary for testing of Kotlin dev builds.
29+
def enableDeprecatedNativeTargets = !isKotlinVersionAtLeast(ext.kotlin_version, 1, 9, 20)
2630

2731
kotlin {
2832
targets {
@@ -119,9 +123,11 @@ if (rootProject.ext.native_targets_enabled) {
119123
addTarget(presets.mingwX64)
120124
addTarget(presets.watchosDeviceArm64)
121125

122-
// Deprecated, remove after 1.9.0
123-
addTarget(presets.iosArm32)
124-
addTarget(presets.watchosX86)
126+
// These targets will be removed in 1.9.20, remove them conditionally for the train builds
127+
if (enableDeprecatedNativeTargets) {
128+
addTarget(presets.iosArm32)
129+
addTarget(presets.watchosX86)
130+
}
125131
}
126132
}
127133

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
@file:JvmName("KotlinVersion")
22

3-
fun isKotlinVersionAtLeast(kotlinVersion: String, atLeastMajor: Int, atLeastMinor: Int): Boolean {
3+
fun isKotlinVersionAtLeast(kotlinVersion: String, atLeastMajor: Int, atLeastMinor: Int, atLeastPatch: Int): Boolean {
44
val (major, minor) = kotlinVersion
55
.split('.')
66
.take(2)
77
.map { it.toInt() }
8+
val patch = kotlinVersion.substringAfterLast('.').substringBefore('-').toInt()
89
return when {
910
major > atLeastMajor -> true
1011
major < atLeastMajor -> false
11-
else -> minor >= atLeastMinor
12+
else -> (minor == atLeastMinor && patch >= atLeastPatch) || minor > atLeastMinor
1213
}
1314
}

0 commit comments

Comments
 (0)