Skip to content

Commit 7d597c1

Browse files
authored
Remove deprecated K/N targets for 1.9.20 (#2325)
See https://kotl.in/native-targets-tiers for details.
1 parent a269f97 commit 7d597c1

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

gradle/configure-source-sets.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ kotlin {
102102
}
103103
}
104104

105+
// TODO: Remove deprecated linuxArm32Hfp and mingwX86 targets in 1.9.20.
105106
def targetsWithoutTestRunners = ["linuxArm32Hfp", "linuxArm64", "mingwX86"]
106107
configure(targets) {
107108
// Configure additional binaries to run tests in the background

gradle/native-targets.gradle

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,13 @@ kotlin {
9696

9797
targets {
9898
if (project.ext.nativeState == NativeState.DISABLED) return
99+
100+
String[] versionComponents = (~/[.-]/).split(compilerVersion, 4)
101+
String[] versionComponents1920 = ["1", "9", "20"]
102+
def isAtLeast1920 = Arrays.compare(versionComponents, versionComponents1920) { lhs, rhs ->
103+
(lhs as int) <=> (rhs as int)
104+
} >= 0
105+
99106
if (project.ext.singleTargetMode) {
100107
fromPreset(project.ext.ideaPreset, 'native')
101108
} else {
@@ -131,20 +138,22 @@ kotlin {
131138

132139
addTarget(presets.mingwX64)
133140

134-
// Deprecated, but were provided by kotlinx.serialization; can be removed only when K/N drops the target
135-
addTarget(presets.watchosX86)
141+
// Deprecated, but were provided by kotlinx.serialization; can be removed only in 1.9.20 release.
142+
if (!isAtLeast1920) {
143+
addTarget(presets.watchosX86)
136144

137-
if (doesNotDependOnOkio(project)) {
138-
addTarget(presets.iosArm32)
139-
addTarget(presets.linuxArm32Hfp)
140-
addTarget(presets.mingwX86)
145+
if (doesNotDependOnOkio(project)) {
146+
addTarget(presets.iosArm32)
147+
addTarget(presets.linuxArm32Hfp)
148+
addTarget(presets.mingwX86)
149+
}
141150
}
142151

143152
}
144153

145154
if (project.ext.nativeState == NativeState.HOST) {
146155
// linux targets that can cross-compile on all three hosts
147-
def linuxCrossCompileTargets = [linuxX64, linuxArm32Hfp, linuxArm64]
156+
def linuxCrossCompileTargets = isAtLeast1920 ? [presets.linuxX64] : [presets.linuxX64, presets.linuxArm32Hfp, presets.linuxArm64]
148157
if (getHostName() != "linux") {
149158
disableCompilation(linuxCrossCompileTargets)
150159
}

0 commit comments

Comments
 (0)