[native] Drop deprecated Kotlin/Native targets (5/8)
Adjust KGP: drop usages of deprecated KonanTargets, leave @Deprecated-stubs in public APIs for readable errors ^KT-64517
This commit is contained in:
committed by
Space Team
parent
4957d99fd6
commit
8f3c0e71fa
+11
-8
@@ -1,7 +1,7 @@
|
||||
package org.jetbrains.kotlin.gradle.plugin
|
||||
|
||||
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
|
||||
import org.jetbrains.kotlin.konan.target.DEPRECATED_TARGET_MESSAGE
|
||||
import org.jetbrains.kotlin.konan.target.REMOVED_TARGET_MESSAGE
|
||||
|
||||
@KotlinTargetsDsl
|
||||
@ExperimentalKotlinGradlePluginApi
|
||||
@@ -150,7 +150,7 @@ interface KotlinHierarchyBuilder {
|
||||
fun withAndroidNativeX86()
|
||||
fun withAndroidNativeArm32()
|
||||
fun withAndroidNativeArm64()
|
||||
fun withIosArm32()
|
||||
|
||||
fun withIosArm64()
|
||||
fun withIosX64()
|
||||
fun withIosSimulatorArm64()
|
||||
@@ -168,21 +168,24 @@ interface KotlinHierarchyBuilder {
|
||||
fun withMacosArm64()
|
||||
fun withLinuxArm64()
|
||||
|
||||
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
@Deprecated(message = REMOVED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
fun withIosArm32()
|
||||
|
||||
@Deprecated(REMOVED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
fun withWatchosX86()
|
||||
|
||||
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
@Deprecated(REMOVED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
fun withMingwX86()
|
||||
|
||||
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
@Deprecated(REMOVED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
fun withLinuxArm32Hfp()
|
||||
|
||||
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
@Deprecated(REMOVED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
fun withLinuxMips32()
|
||||
|
||||
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
@Deprecated(REMOVED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
fun withLinuxMipsel32()
|
||||
|
||||
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
@Deprecated(REMOVED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
fun withWasm32()
|
||||
}
|
||||
|
||||
+2
-6
@@ -52,16 +52,12 @@ enum class NativeOutputKind(
|
||||
CompilerOutputKind.DYNAMIC,
|
||||
"shared",
|
||||
description = "a dynamic library"
|
||||
) {
|
||||
override fun availableFor(target: KonanTarget) = target != KonanTarget.WASM32
|
||||
},
|
||||
),
|
||||
STATIC(
|
||||
CompilerOutputKind.STATIC,
|
||||
"static",
|
||||
description = "a static library"
|
||||
) {
|
||||
override fun availableFor(target: KonanTarget) = target != KonanTarget.WASM32
|
||||
},
|
||||
),
|
||||
FRAMEWORK(
|
||||
CompilerOutputKind.FRAMEWORK,
|
||||
"framework",
|
||||
|
||||
-1
@@ -91,7 +91,6 @@ private val nativeTargetsWithSimulatorTests =
|
||||
KonanTarget.IOS_X64,
|
||||
KonanTarget.IOS_SIMULATOR_ARM64,
|
||||
|
||||
KonanTarget.WATCHOS_X86,
|
||||
KonanTarget.WATCHOS_X64,
|
||||
KonanTarget.WATCHOS_SIMULATOR_ARM64,
|
||||
|
||||
|
||||
-1
@@ -1,6 +1,5 @@
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.AbstractKotlinNativeTargetPreset
|
||||
import org.jetbrains.kotlin.konan.target.HostManager.Companion.hostIsLinux
|
||||
import org.jetbrains.kotlin.konan.target.KonanTarget.LINUX_MIPS32
|
||||
|
||||
plugins {
|
||||
kotlin("multiplatform")
|
||||
|
||||
+15
-27
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
|
||||
import org.jetbrains.kotlin.konan.target.DEPRECATED_TARGET_MESSAGE
|
||||
import org.jetbrains.kotlin.konan.target.Family
|
||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||
import org.jetbrains.kotlin.konan.target.REMOVED_TARGET_MESSAGE
|
||||
import org.jetbrains.kotlin.tooling.core.closure
|
||||
|
||||
|
||||
@@ -192,9 +193,8 @@ private class KotlinHierarchyBuilderImpl(
|
||||
it is KotlinNativeTarget && it.konanTarget == KonanTarget.ANDROID_ARM64
|
||||
}
|
||||
|
||||
override fun withIosArm32() = withTargets {
|
||||
it is KotlinNativeTarget && it.konanTarget == KonanTarget.IOS_ARM32
|
||||
}
|
||||
@Deprecated(message = REMOVED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
override fun withIosArm32() = Unit
|
||||
|
||||
override fun withIosArm64() = withTargets {
|
||||
it is KotlinNativeTarget && it.konanTarget == KonanTarget.IOS_ARM64
|
||||
@@ -260,35 +260,23 @@ private class KotlinHierarchyBuilderImpl(
|
||||
it is KotlinNativeTarget && it.konanTarget == KonanTarget.LINUX_ARM64
|
||||
}
|
||||
|
||||
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
override fun withWatchosX86() = withTargets {
|
||||
it is KotlinNativeTarget && it.konanTarget == KonanTarget.WATCHOS_X86
|
||||
}
|
||||
@Deprecated(REMOVED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
override fun withWatchosX86() = Unit
|
||||
|
||||
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
override fun withMingwX86() = withTargets {
|
||||
it is KotlinNativeTarget && it.konanTarget == KonanTarget.MINGW_X86
|
||||
}
|
||||
@Deprecated(REMOVED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
override fun withMingwX86() = Unit
|
||||
|
||||
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
override fun withLinuxArm32Hfp() = withTargets {
|
||||
it is KotlinNativeTarget && it.konanTarget == KonanTarget.LINUX_ARM32_HFP
|
||||
}
|
||||
@Deprecated(REMOVED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
override fun withLinuxArm32Hfp() = Unit
|
||||
|
||||
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
override fun withLinuxMips32() = withTargets {
|
||||
it is KotlinNativeTarget && it.konanTarget == KonanTarget.LINUX_MIPS32
|
||||
}
|
||||
@Deprecated(REMOVED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
override fun withLinuxMips32() = Unit
|
||||
|
||||
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
override fun withLinuxMipsel32() = withTargets {
|
||||
it is KotlinNativeTarget && it.konanTarget == KonanTarget.LINUX_MIPSEL32
|
||||
}
|
||||
@Deprecated(REMOVED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
override fun withLinuxMipsel32() = Unit
|
||||
|
||||
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
override fun withWasm32() = withTargets {
|
||||
it is KotlinNativeTarget && it.konanTarget == KonanTarget.WASM32
|
||||
}
|
||||
@Deprecated(REMOVED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
override fun withWasm32() = Unit
|
||||
|
||||
override fun toString(): String {
|
||||
return "KotlinHierarchyBuilder($node)"
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ internal val KotlinMultiplatformTargetPresetAction = KotlinProjectSetupAction {
|
||||
val nativeTargetsWithHostTests = setOf(LINUX_X64, MACOS_X64, MACOS_ARM64, MINGW_X64)
|
||||
val nativeTargetsWithSimulatorTests = setOf(
|
||||
IOS_X64, IOS_SIMULATOR_ARM64,
|
||||
WATCHOS_X86, WATCHOS_X64, WATCHOS_SIMULATOR_ARM64,
|
||||
WATCHOS_X64, WATCHOS_SIMULATOR_ARM64,
|
||||
TVOS_X64, TVOS_SIMULATOR_ARM64
|
||||
)
|
||||
|
||||
|
||||
-2
@@ -19,7 +19,6 @@ internal object AppleSdk {
|
||||
targets.addAll(archs.map { arch ->
|
||||
when (arch) {
|
||||
"arm64", "arm64e" -> KonanTarget.IOS_ARM64
|
||||
"armv7", "armv7s" -> KonanTarget.IOS_ARM32
|
||||
else -> throw UnknownArchitectureException(platform, arch)
|
||||
}
|
||||
})
|
||||
@@ -47,7 +46,6 @@ internal object AppleSdk {
|
||||
targets.addAll(archs.map { arch ->
|
||||
when (arch) {
|
||||
"arm64", "arm64e" -> KonanTarget.WATCHOS_SIMULATOR_ARM64
|
||||
"i386" -> KonanTarget.WATCHOS_X86
|
||||
"x86_64" -> KonanTarget.WATCHOS_X64
|
||||
else -> throw UnknownArchitectureException(platform, arch)
|
||||
}
|
||||
|
||||
+2
-2
@@ -35,10 +35,10 @@ internal enum class AppleTarget(
|
||||
val targets: List<KonanTarget>
|
||||
) {
|
||||
MACOS_DEVICE("macos", listOf(KonanTarget.MACOS_X64, KonanTarget.MACOS_ARM64)),
|
||||
IPHONE_DEVICE("ios", listOf(KonanTarget.IOS_ARM32, KonanTarget.IOS_ARM64)),
|
||||
IPHONE_DEVICE("ios", listOf(KonanTarget.IOS_ARM64)),
|
||||
IPHONE_SIMULATOR("iosSimulator", listOf(KonanTarget.IOS_X64, KonanTarget.IOS_SIMULATOR_ARM64)),
|
||||
WATCHOS_DEVICE("watchos", listOf(KonanTarget.WATCHOS_ARM32, KonanTarget.WATCHOS_ARM64, KonanTarget.WATCHOS_DEVICE_ARM64)),
|
||||
WATCHOS_SIMULATOR("watchosSimulator", listOf(KonanTarget.WATCHOS_X86, KonanTarget.WATCHOS_X64, KonanTarget.WATCHOS_SIMULATOR_ARM64)),
|
||||
WATCHOS_SIMULATOR("watchosSimulator", listOf(KonanTarget.WATCHOS_X64, KonanTarget.WATCHOS_SIMULATOR_ARM64)),
|
||||
TVOS_DEVICE("tvos", listOf(KonanTarget.TVOS_ARM64)),
|
||||
TVOS_SIMULATOR("tvosSimulator", listOf(KonanTarget.TVOS_X64, KonanTarget.TVOS_SIMULATOR_ARM64))
|
||||
}
|
||||
|
||||
+2
-2
@@ -114,8 +114,8 @@ private fun String.toBuildDependenciesTaskName(pod: CocoapodsDependency): String
|
||||
private val KotlinNativeTarget.toValidSDK: String
|
||||
get() = when (konanTarget) {
|
||||
IOS_X64, IOS_SIMULATOR_ARM64 -> "iphonesimulator"
|
||||
IOS_ARM32, IOS_ARM64 -> "iphoneos"
|
||||
WATCHOS_X86, WATCHOS_X64, WATCHOS_SIMULATOR_ARM64 -> "watchsimulator"
|
||||
IOS_ARM64 -> "iphoneos"
|
||||
WATCHOS_X64, WATCHOS_SIMULATOR_ARM64 -> "watchsimulator"
|
||||
WATCHOS_ARM32, WATCHOS_ARM64, WATCHOS_DEVICE_ARM64 -> "watchos"
|
||||
TVOS_X64, TVOS_SIMULATOR_ARM64 -> "appletvsimulator"
|
||||
TVOS_ARM64 -> "appletvos"
|
||||
|
||||
+1
-2
@@ -340,8 +340,7 @@ constructor(
|
||||
when {
|
||||
outputKind == CompilerOutputKind.FRAMEWORK ->
|
||||
it.asValidFrameworkName()
|
||||
outputKind in listOf(CompilerOutputKind.STATIC, CompilerOutputKind.DYNAMIC) ||
|
||||
outputKind == CompilerOutputKind.PROGRAM && konanTarget == KonanTarget.WASM32 ->
|
||||
outputKind in listOf(CompilerOutputKind.STATIC, CompilerOutputKind.DYNAMIC) ->
|
||||
it.replace('-', '_')
|
||||
else -> it
|
||||
}
|
||||
|
||||
+1
-1
@@ -226,7 +226,7 @@ abstract class AbstractKotlinNativeCompile<
|
||||
outputKind == FRAMEWORK ->
|
||||
it.asValidFrameworkName()
|
||||
|
||||
outputKind in listOf(STATIC, DYNAMIC) || outputKind == PROGRAM && konanTarget == KonanTarget.WASM32 ->
|
||||
outputKind in listOf(STATIC, DYNAMIC) ->
|
||||
it.replace('-', '_')
|
||||
|
||||
else -> it
|
||||
|
||||
+15
-16
@@ -6,8 +6,8 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinArtifactConfig
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinArtifactsExtension
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.BitcodeEmbeddingMode
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType
|
||||
import org.jetbrains.kotlin.konan.target.DEPRECATED_TARGET_MESSAGE
|
||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||
import org.jetbrains.kotlin.konan.target.REMOVED_TARGET_MESSAGE
|
||||
import javax.inject.Inject
|
||||
|
||||
// DO NOT EDIT MANUALLY! Generated by org.jetbrains.kotlin.generators.gradle.dsl.KotlinArtifactsDSLCodegenKt
|
||||
@@ -52,25 +52,24 @@ abstract class KotlinArtifactsExtensionImpl @Inject constructor(project: Project
|
||||
val linuxArm64 = KonanTarget.LINUX_ARM64
|
||||
|
||||
|
||||
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
val iosArm32 = KonanTarget.IOS_ARM32
|
||||
@Deprecated(REMOVED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
val iosArm32 = Unit
|
||||
|
||||
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
val watchosX86 = KonanTarget.WATCHOS_X86
|
||||
@Deprecated(REMOVED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
val watchosX86 = Unit
|
||||
|
||||
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
val mingwX86 = KonanTarget.MINGW_X86
|
||||
@Deprecated(REMOVED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
val mingwX86 = Unit
|
||||
|
||||
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
val linuxArm32Hfp = KonanTarget.LINUX_ARM32_HFP
|
||||
@Deprecated(REMOVED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
val linuxArm32Hfp = Unit
|
||||
|
||||
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
val linuxMips32 = KonanTarget.LINUX_MIPS32
|
||||
@Deprecated(REMOVED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
val linuxMips32 = Unit
|
||||
|
||||
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
val linuxMipsel32 = KonanTarget.LINUX_MIPSEL32
|
||||
|
||||
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
val wasm32 = KonanTarget.WASM32
|
||||
@Deprecated(REMOVED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
val linuxMipsel32 = Unit
|
||||
|
||||
@Deprecated(REMOVED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
|
||||
val wasm32 = Unit
|
||||
}
|
||||
-6
@@ -32,13 +32,11 @@ enum class StringMetrics(val type: StringOverridePolicy, val anonymization: Stri
|
||||
"androidJvm",
|
||||
"android_arm32",
|
||||
"android_arm64",
|
||||
"ios_arm32",
|
||||
"ios_arm64",
|
||||
"ios_simulator_arm64",
|
||||
"ios_x64",
|
||||
"watchos_arm32",
|
||||
"watchos_arm64",
|
||||
"watchos_x86",
|
||||
"watchos_x64",
|
||||
"watchos_simulator_arm64",
|
||||
"watchos_device_arm64",
|
||||
@@ -46,15 +44,11 @@ enum class StringMetrics(val type: StringOverridePolicy, val anonymization: Stri
|
||||
"tvos_x64",
|
||||
"tvos_simulator_arm64",
|
||||
"linux_arm32_hfp",
|
||||
"linux_mips32",
|
||||
"linux_mipsel32",
|
||||
"linux_arm64",
|
||||
"linux_x64",
|
||||
"macos_x64",
|
||||
"macos_arm64",
|
||||
"mingw_x64",
|
||||
"mingw_x86",
|
||||
"wasm32",
|
||||
"wasm"
|
||||
)
|
||||
)
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ public class CommonizeNativeDistributionTest {
|
||||
LINUX_X64, LINUX_ARM64,
|
||||
MACOS_X64, MACOS_ARM64,
|
||||
IOS_X64, IOS_ARM64,
|
||||
WATCHOS_ARM64, WATCHOS_ARM32, WATCHOS_X86, WATCHOS_DEVICE_ARM64,
|
||||
WATCHOS_ARM64, WATCHOS_ARM32, WATCHOS_DEVICE_ARM64,
|
||||
TVOS_ARM64, TVOS_X64
|
||||
)
|
||||
|
||||
|
||||
@@ -19,13 +19,11 @@ enum class PlatformIntWidth {
|
||||
|
||||
object PlatformWidthIndex {
|
||||
private val widthByLeafTargets = mapOf(
|
||||
LeafCommonizerTarget(KonanTarget.IOS_ARM32) to PlatformIntWidth.INT,
|
||||
LeafCommonizerTarget(KonanTarget.IOS_ARM64) to PlatformIntWidth.LONG,
|
||||
LeafCommonizerTarget(KonanTarget.IOS_X64) to PlatformIntWidth.LONG,
|
||||
LeafCommonizerTarget(KonanTarget.IOS_SIMULATOR_ARM64) to PlatformIntWidth.LONG,
|
||||
LeafCommonizerTarget(KonanTarget.WATCHOS_ARM32) to PlatformIntWidth.INT,
|
||||
LeafCommonizerTarget(KonanTarget.WATCHOS_ARM64) to PlatformIntWidth.INT,
|
||||
LeafCommonizerTarget(KonanTarget.WATCHOS_X86) to PlatformIntWidth.INT,
|
||||
LeafCommonizerTarget(KonanTarget.WATCHOS_X64) to PlatformIntWidth.LONG,
|
||||
LeafCommonizerTarget(KonanTarget.WATCHOS_SIMULATOR_ARM64) to PlatformIntWidth.LONG,
|
||||
LeafCommonizerTarget(KonanTarget.WATCHOS_DEVICE_ARM64) to PlatformIntWidth.LONG,
|
||||
@@ -33,15 +31,11 @@ object PlatformWidthIndex {
|
||||
LeafCommonizerTarget(KonanTarget.TVOS_X64) to PlatformIntWidth.LONG,
|
||||
LeafCommonizerTarget(KonanTarget.TVOS_SIMULATOR_ARM64) to PlatformIntWidth.LONG,
|
||||
LeafCommonizerTarget(KonanTarget.LINUX_X64) to PlatformIntWidth.LONG,
|
||||
LeafCommonizerTarget(KonanTarget.MINGW_X86) to PlatformIntWidth.INT,
|
||||
LeafCommonizerTarget(KonanTarget.MINGW_X64) to PlatformIntWidth.LONG,
|
||||
LeafCommonizerTarget(KonanTarget.MACOS_X64) to PlatformIntWidth.LONG,
|
||||
LeafCommonizerTarget(KonanTarget.MACOS_ARM64) to PlatformIntWidth.LONG,
|
||||
LeafCommonizerTarget(KonanTarget.LINUX_ARM64) to PlatformIntWidth.LONG,
|
||||
LeafCommonizerTarget(KonanTarget.LINUX_ARM32_HFP) to PlatformIntWidth.INT,
|
||||
LeafCommonizerTarget(KonanTarget.LINUX_MIPS32) to PlatformIntWidth.INT,
|
||||
LeafCommonizerTarget(KonanTarget.LINUX_MIPSEL32) to PlatformIntWidth.INT,
|
||||
LeafCommonizerTarget(KonanTarget.WASM32) to PlatformIntWidth.INT,
|
||||
)
|
||||
|
||||
fun platformWidthOf(target: CommonizerTarget): PlatformIntWidth? {
|
||||
@@ -56,4 +50,3 @@ object PlatformWidthIndex {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ class PlatformBitWidthTest {
|
||||
fun `test leaf int`() {
|
||||
assertEquals(
|
||||
PlatformIntWidth.INT,
|
||||
createPlatformBitWidthIndex().platformWidthOf(CommonizerTarget(KonanTarget.IOS_ARM32))
|
||||
createPlatformBitWidthIndex().platformWidthOf(CommonizerTarget(KonanTarget.WATCHOS_ARM32))
|
||||
)
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class PlatformBitWidthTest {
|
||||
fun `test shared int`() {
|
||||
assertEquals(
|
||||
PlatformIntWidth.INT,
|
||||
createPlatformBitWidthIndex().platformWidthOf(CommonizerTarget(KonanTarget.IOS_ARM32, KonanTarget.LINUX_MIPS32))
|
||||
createPlatformBitWidthIndex().platformWidthOf(CommonizerTarget(KonanTarget.WATCHOS_ARM32, KonanTarget.LINUX_ARM32_HFP))
|
||||
)
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ class PlatformBitWidthTest {
|
||||
fun `test int and long`() {
|
||||
assertEquals(
|
||||
PlatformIntWidth.MIXED,
|
||||
createPlatformBitWidthIndex().platformWidthOf(CommonizerTarget(KonanTarget.IOS_ARM32, KonanTarget.MACOS_X64))
|
||||
createPlatformBitWidthIndex().platformWidthOf(CommonizerTarget(KonanTarget.WATCHOS_ARM32, KonanTarget.MACOS_X64))
|
||||
)
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ class PlatformBitWidthTest {
|
||||
null,
|
||||
createPlatformBitWidthIndex().platformWidthOf(
|
||||
CommonizerTarget(
|
||||
LeafCommonizerTarget(KonanTarget.IOS_ARM32),
|
||||
LeafCommonizerTarget(KonanTarget.WATCHOS_ARM32),
|
||||
LeafCommonizerTarget("unknown_target")
|
||||
)
|
||||
)
|
||||
@@ -87,7 +87,7 @@ class PlatformBitWidthTest {
|
||||
createPlatformBitWidthIndex().platformWidthOf(
|
||||
CommonizerTarget(
|
||||
LeafCommonizerTarget(KonanTarget.MACOS_X64),
|
||||
LeafCommonizerTarget(KonanTarget.IOS_ARM32),
|
||||
LeafCommonizerTarget(KonanTarget.WATCHOS_ARM32),
|
||||
LeafCommonizerTarget("unknown_target"),
|
||||
)
|
||||
)
|
||||
|
||||
@@ -20,12 +20,12 @@ class RootCommonizerTest : AbstractCommonizerTest<CirRoot, CirRoot>() {
|
||||
setOf(
|
||||
LeafCommonizerTarget(KonanTarget.IOS_X64),
|
||||
LeafCommonizerTarget(KonanTarget.IOS_ARM64),
|
||||
LeafCommonizerTarget(KonanTarget.IOS_ARM32)
|
||||
LeafCommonizerTarget(KonanTarget.WATCHOS_ARM32)
|
||||
)
|
||||
).toMock(),
|
||||
LeafCommonizerTarget(KonanTarget.IOS_X64).toMock(),
|
||||
LeafCommonizerTarget(KonanTarget.IOS_ARM64).toMock(),
|
||||
LeafCommonizerTarget(KonanTarget.IOS_ARM32).toMock()
|
||||
LeafCommonizerTarget(KonanTarget.WATCHOS_ARM32).toMock()
|
||||
)
|
||||
|
||||
@Test
|
||||
|
||||
+29
-73
@@ -438,19 +438,15 @@ class HierarchicalPlatformIntegerCommonizationTest : AbstractInlineSourcesCommon
|
||||
|
||||
fun `test platform integers in multi-target commonization`() {
|
||||
val intTarget1 = LINUX_ARM32_HFP.name
|
||||
val intTarget2 = LINUX_MIPS32.name
|
||||
val intTarget3 = LINUX_MIPSEL32.name
|
||||
val intTarget2 = WATCHOS_ARM64.name
|
||||
val longTarget1 = LINUX_X64.name
|
||||
val longTarget2 = LINUX_ARM64.name
|
||||
val longTarget3 = MACOS_X64.name
|
||||
|
||||
val outputCommonizerTargets = arrayOf(
|
||||
"($intTarget1, $intTarget2)", "($longTarget1, $longTarget2)", "($intTarget3, $longTarget3)",
|
||||
"($intTarget1, $intTarget2, $intTarget3)", "($longTarget1, $longTarget2, $longTarget3)",
|
||||
"($intTarget1, $intTarget2, $intTarget3, $longTarget1)",
|
||||
"($intTarget1, $intTarget2)", "($longTarget1, $longTarget2)", "($intTarget1, $longTarget1)",
|
||||
"($intTarget1, $intTarget2, $longTarget1)",
|
||||
"($longTarget1, $longTarget2, $intTarget1)",
|
||||
"($intTarget1, $intTarget2, $longTarget1, $longTarget2)",
|
||||
"($longTarget1, $longTarget2, $longTarget3, $intTarget1)",
|
||||
"($intTarget1, $intTarget2, $intTarget3, $longTarget1, $longTarget2, $longTarget3)",
|
||||
)
|
||||
|
||||
val result = commonize {
|
||||
@@ -472,13 +468,6 @@ class HierarchicalPlatformIntegerCommonizationTest : AbstractInlineSourcesCommon
|
||||
typealias XV = IntVarOf<X>
|
||||
""".trimIndent()
|
||||
|
||||
intTarget3 withSource """
|
||||
import kotlinx.cinterop.*
|
||||
|
||||
typealias X = Int
|
||||
typealias XV = IntVarOf<X>
|
||||
""".trimIndent()
|
||||
|
||||
longTarget1 withSource """
|
||||
import kotlinx.cinterop.*
|
||||
|
||||
@@ -493,12 +482,6 @@ class HierarchicalPlatformIntegerCommonizationTest : AbstractInlineSourcesCommon
|
||||
typealias XV = LongVarOf<X>
|
||||
""".trimIndent()
|
||||
|
||||
longTarget3 withSource """
|
||||
import kotlinx.cinterop.*
|
||||
|
||||
typealias X = Long
|
||||
typealias XV = LongVarOf<X>
|
||||
""".trimIndent()
|
||||
}
|
||||
|
||||
result.assertCommonized(
|
||||
@@ -510,15 +493,6 @@ class HierarchicalPlatformIntegerCommonizationTest : AbstractInlineSourcesCommon
|
||||
""".trimIndent()
|
||||
)
|
||||
|
||||
result.assertCommonized(
|
||||
"($intTarget1, $intTarget2, $intTarget3)", """
|
||||
import kotlinx.cinterop.*
|
||||
|
||||
typealias X = Int
|
||||
typealias XV = IntVarOf<X>
|
||||
""".trimIndent()
|
||||
)
|
||||
|
||||
result.assertCommonized(
|
||||
"($longTarget1, $longTarget2)", """
|
||||
import kotlinx.cinterop.*
|
||||
@@ -529,16 +503,25 @@ class HierarchicalPlatformIntegerCommonizationTest : AbstractInlineSourcesCommon
|
||||
)
|
||||
|
||||
result.assertCommonized(
|
||||
"($longTarget1, $longTarget2, $longTarget3)", """
|
||||
"($intTarget1, $longTarget1)", """
|
||||
import kotlinx.cinterop.*
|
||||
|
||||
typealias X = Long
|
||||
typealias XV = LongVarOf<X>
|
||||
typealias X = PlatformInt
|
||||
typealias XV = PlatformIntVarOf<X>
|
||||
""".trimIndent()
|
||||
)
|
||||
|
||||
result.assertCommonized(
|
||||
"($intTarget3, $longTarget3)", """
|
||||
"($intTarget1, $intTarget2, $longTarget1)", """
|
||||
import kotlinx.cinterop.*
|
||||
|
||||
typealias X = PlatformInt
|
||||
typealias XV = PlatformIntVarOf<X>
|
||||
""".trimIndent()
|
||||
)
|
||||
|
||||
result.assertCommonized(
|
||||
"($longTarget1, $longTarget2, $intTarget1)", """
|
||||
import kotlinx.cinterop.*
|
||||
|
||||
typealias X = PlatformInt
|
||||
@@ -554,40 +537,13 @@ class HierarchicalPlatformIntegerCommonizationTest : AbstractInlineSourcesCommon
|
||||
typealias XV = PlatformIntVarOf<X>
|
||||
""".trimIndent()
|
||||
)
|
||||
|
||||
result.assertCommonized(
|
||||
"($intTarget1, $intTarget2, $intTarget3, $longTarget1)", """
|
||||
import kotlinx.cinterop.*
|
||||
|
||||
typealias X = PlatformInt
|
||||
typealias XV = PlatformIntVarOf<X>
|
||||
""".trimIndent()
|
||||
)
|
||||
|
||||
result.assertCommonized(
|
||||
"($longTarget1, $longTarget2, $longTarget3, $intTarget1)", """
|
||||
import kotlinx.cinterop.*
|
||||
|
||||
typealias X = PlatformInt
|
||||
typealias XV = PlatformIntVarOf<X>
|
||||
""".trimIndent()
|
||||
)
|
||||
|
||||
result.assertCommonized(
|
||||
"($intTarget1, $intTarget2, $intTarget3, $longTarget1, $longTarget2, $longTarget3)", """
|
||||
import kotlinx.cinterop.*
|
||||
|
||||
typealias X = PlatformInt
|
||||
typealias XV = PlatformIntVarOf<X>
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
fun `test platform types from known leaf targets are commonized`() {
|
||||
val result = commonize {
|
||||
outputTarget("(${LINUX_X64.name}, ${IOS_ARM32.name})")
|
||||
outputTarget("(${LINUX_X64.name}, ${WATCHOS_ARM64.name})")
|
||||
setting(PlatformIntegerCommonizationEnabledKey, true)
|
||||
registerFakeStdlibIntegersDependency("(${LINUX_X64.name}, ${IOS_ARM32.name})")
|
||||
registerFakeStdlibIntegersDependency("(${LINUX_X64.name}, ${WATCHOS_ARM64.name})")
|
||||
|
||||
LINUX_X64.name withSource """
|
||||
val platformPropertyInOneLeafTarget: PlatformInt
|
||||
@@ -596,7 +552,7 @@ class HierarchicalPlatformIntegerCommonizationTest : AbstractInlineSourcesCommon
|
||||
get() = null!!
|
||||
""".trimIndent()
|
||||
|
||||
IOS_ARM32.name withSource """
|
||||
WATCHOS_ARM64.name withSource """
|
||||
val platformPropertyInOneLeafTarget: Int
|
||||
get() = 42
|
||||
val platformPropertyInBothLeafTargets: PlatformInt
|
||||
@@ -605,7 +561,7 @@ class HierarchicalPlatformIntegerCommonizationTest : AbstractInlineSourcesCommon
|
||||
}
|
||||
|
||||
result.assertCommonized(
|
||||
"(${LINUX_X64.name}, ${IOS_ARM32.name})", """
|
||||
"(${LINUX_X64.name}, ${WATCHOS_ARM64.name})", """
|
||||
expect val platformPropertyInOneLeafTarget: PlatformInt
|
||||
expect val platformPropertyInBothLeafTargets: PlatformInt
|
||||
""".trimIndent()
|
||||
@@ -614,9 +570,9 @@ class HierarchicalPlatformIntegerCommonizationTest : AbstractInlineSourcesCommon
|
||||
|
||||
fun `test platform types from unknown targets are not commonized`() {
|
||||
val result = commonize {
|
||||
outputTarget("(unknown, ${IOS_ARM32.name})")
|
||||
outputTarget("(unknown, ${WATCHOS_ARM64.name})")
|
||||
setting(PlatformIntegerCommonizationEnabledKey, true)
|
||||
registerFakeStdlibIntegersDependency("(unknown, ${IOS_ARM32.name})")
|
||||
registerFakeStdlibIntegersDependency("(unknown, ${WATCHOS_ARM64.name})")
|
||||
|
||||
"unknown" withSource """
|
||||
val platformPropertyInOneLeafTarget: PlatformInt
|
||||
@@ -625,7 +581,7 @@ class HierarchicalPlatformIntegerCommonizationTest : AbstractInlineSourcesCommon
|
||||
get() = null!!
|
||||
""".trimIndent()
|
||||
|
||||
IOS_ARM32.name withSource """
|
||||
WATCHOS_ARM64.name withSource """
|
||||
val platformPropertyInOneLeafTarget: Int
|
||||
get() = 42
|
||||
val platformPropertyInOtherLeafTarget: PlatformInt
|
||||
@@ -634,18 +590,18 @@ class HierarchicalPlatformIntegerCommonizationTest : AbstractInlineSourcesCommon
|
||||
}
|
||||
|
||||
result.assertCommonized(
|
||||
"(unknown, ${IOS_ARM32.name})", "".trimIndent()
|
||||
"(unknown, ${WATCHOS_ARM64.name})", "".trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
// Issue: KT-51528
|
||||
fun `test multiple argument function with over the edge type alias available`() {
|
||||
val result = commonize {
|
||||
outputTarget("(${IOS_ARM32.name}, ${IOS_ARM64.name})")
|
||||
outputTarget("(${WATCHOS_ARM64.name}, ${IOS_ARM64.name})")
|
||||
setting(PlatformIntegerCommonizationEnabledKey, true)
|
||||
registerFakeStdlibIntegersDependency("(${IOS_ARM32.name}, ${IOS_ARM64.name})")
|
||||
registerFakeStdlibIntegersDependency("(${WATCHOS_ARM64.name}, ${IOS_ARM64.name})")
|
||||
|
||||
IOS_ARM32.name withSource """
|
||||
WATCHOS_ARM64.name withSource """
|
||||
typealias Arm32Alias = UInt
|
||||
typealias OtherAlias = UInt
|
||||
|
||||
@@ -671,7 +627,7 @@ class HierarchicalPlatformIntegerCommonizationTest : AbstractInlineSourcesCommon
|
||||
}
|
||||
|
||||
result.assertCommonized(
|
||||
"(${IOS_ARM32.name}, ${IOS_ARM64.name})", """
|
||||
"(${WATCHOS_ARM64.name}, ${IOS_ARM64.name})", """
|
||||
typealias OtherAlias = PlatformUInt
|
||||
|
||||
expect class Box<T>()
|
||||
|
||||
Reference in New Issue
Block a user