[Gradle][MPP] Promote several K/N targets deprecation level to error

This commit is contained in:
Alexander Shabalin
2023-05-17 14:05:14 +02:00
committed by Space Team
parent 1b1cfd45a0
commit 1ef198ead4
9 changed files with 95 additions and 95 deletions
@@ -167,21 +167,21 @@ interface KotlinTargetHierarchyBuilder {
fun withMacosArm64()
fun withLinuxArm64()
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
fun withWatchosX86()
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
fun withMingwX86()
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
fun withLinuxArm32Hfp()
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
fun withLinuxMips32()
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
fun withLinuxMipsel32()
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
fun withWasm32()
}
@@ -62,7 +62,7 @@ private fun generateAbstractKotlinArtifactsExtensionImplementation() {
val deprecatedKonanTargetConstants = KonanTarget.predefinedTargets.values.filter { KonanTarget.deprecatedTargets.contains(it) }
.joinToString("\n") {
"\n@Deprecated(DEPRECATED_TARGET_MESSAGE)\n" + it.generateKonanTargetVal()
"\n@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)\n" + it.generateKonanTargetVal()
}.indented(4)
val code = listOf(
@@ -21,7 +21,7 @@ private fun generateKotlinTargetContainerWithPresetFunctionsInterface() {
// Generate KotlinMultiplatformExtension subclass with member functions for the presets:
val functions = nativePresetEntries.map { kotlinPreset ->
// magic indent is needed to make the result look pretty
val funPrefix = kotlinPreset.deprecation?.let { "\n $it\n @Suppress(\"DEPRECATION\")\n " } ?: ""
val funPrefix = kotlinPreset.deprecation?.let { "\n $it\n @Suppress(\"DEPRECATION_ERROR\")\n " } ?: ""
generatePresetFunctions(kotlinPreset, presetsProperty, "configureOrCreate", funPrefix)
}
@@ -63,7 +63,7 @@ internal val nativePresetEntries = HostManager().targets
else ->
Presets.simple to Targets.base
}
val deprecation = "@Deprecated(DEPRECATED_TARGET_MESSAGE)".takeIf { target in KonanTarget.deprecatedTargets }
val deprecation = "@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)".takeIf { target in KonanTarget.deprecatedTargets }
KotlinPresetEntry(target.presetName, typeName(presetType), typeName(targetType), deprecation)
}
@@ -75,8 +75,8 @@ interface KotlinTargetContainerWithNativePresetFunctions : KotlinTargetsContaine
fun androidNativeArm64(configure: Action<KotlinNativeTarget>) = androidNativeArm64 { configure.execute(this) }
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun iosArm32(
name: String = "iosArm32",
configure: KotlinNativeTarget.() -> Unit = { }
@@ -88,20 +88,20 @@ interface KotlinTargetContainerWithNativePresetFunctions : KotlinTargetsContaine
)
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun iosArm32() = iosArm32("iosArm32") { }
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun iosArm32(name: String) = iosArm32(name) { }
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun iosArm32(name: String, configure: Action<KotlinNativeTarget>) = iosArm32(name) { configure.execute(this) }
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun iosArm32(configure: Action<KotlinNativeTarget>) = iosArm32 { configure.execute(this) }
fun iosArm64(
@@ -180,8 +180,8 @@ interface KotlinTargetContainerWithNativePresetFunctions : KotlinTargetsContaine
fun watchosArm64(configure: Action<KotlinNativeTarget>) = watchosArm64 { configure.execute(this) }
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun watchosX86(
name: String = "watchosX86",
configure: KotlinNativeTargetWithSimulatorTests.() -> Unit = { }
@@ -193,20 +193,20 @@ interface KotlinTargetContainerWithNativePresetFunctions : KotlinTargetsContaine
)
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun watchosX86() = watchosX86("watchosX86") { }
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun watchosX86(name: String) = watchosX86(name) { }
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun watchosX86(name: String, configure: Action<KotlinNativeTargetWithSimulatorTests>) = watchosX86(name) { configure.execute(this) }
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun watchosX86(configure: Action<KotlinNativeTargetWithSimulatorTests>) = watchosX86 { configure.execute(this) }
fun watchosX64(
@@ -315,8 +315,8 @@ interface KotlinTargetContainerWithNativePresetFunctions : KotlinTargetsContaine
fun linuxX64(configure: Action<KotlinNativeTargetWithHostTests>) = linuxX64 { configure.execute(this) }
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun mingwX86(
name: String = "mingwX86",
configure: KotlinNativeTarget.() -> Unit = { }
@@ -328,20 +328,20 @@ interface KotlinTargetContainerWithNativePresetFunctions : KotlinTargetsContaine
)
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun mingwX86() = mingwX86("mingwX86") { }
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun mingwX86(name: String) = mingwX86(name) { }
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun mingwX86(name: String, configure: Action<KotlinNativeTarget>) = mingwX86(name) { configure.execute(this) }
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun mingwX86(configure: Action<KotlinNativeTarget>) = mingwX86 { configure.execute(this) }
fun mingwX64(
@@ -405,8 +405,8 @@ interface KotlinTargetContainerWithNativePresetFunctions : KotlinTargetsContaine
fun linuxArm64(configure: Action<KotlinNativeTarget>) = linuxArm64 { configure.execute(this) }
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun linuxArm32Hfp(
name: String = "linuxArm32Hfp",
configure: KotlinNativeTarget.() -> Unit = { }
@@ -418,25 +418,25 @@ interface KotlinTargetContainerWithNativePresetFunctions : KotlinTargetsContaine
)
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun linuxArm32Hfp() = linuxArm32Hfp("linuxArm32Hfp") { }
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun linuxArm32Hfp(name: String) = linuxArm32Hfp(name) { }
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun linuxArm32Hfp(name: String, configure: Action<KotlinNativeTarget>) = linuxArm32Hfp(name) { configure.execute(this) }
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun linuxArm32Hfp(configure: Action<KotlinNativeTarget>) = linuxArm32Hfp { configure.execute(this) }
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun linuxMips32(
name: String = "linuxMips32",
configure: KotlinNativeTarget.() -> Unit = { }
@@ -448,25 +448,25 @@ interface KotlinTargetContainerWithNativePresetFunctions : KotlinTargetsContaine
)
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun linuxMips32() = linuxMips32("linuxMips32") { }
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun linuxMips32(name: String) = linuxMips32(name) { }
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun linuxMips32(name: String, configure: Action<KotlinNativeTarget>) = linuxMips32(name) { configure.execute(this) }
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun linuxMips32(configure: Action<KotlinNativeTarget>) = linuxMips32 { configure.execute(this) }
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun linuxMipsel32(
name: String = "linuxMipsel32",
configure: KotlinNativeTarget.() -> Unit = { }
@@ -478,25 +478,25 @@ interface KotlinTargetContainerWithNativePresetFunctions : KotlinTargetsContaine
)
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun linuxMipsel32() = linuxMipsel32("linuxMipsel32") { }
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun linuxMipsel32(name: String) = linuxMipsel32(name) { }
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun linuxMipsel32(name: String, configure: Action<KotlinNativeTarget>) = linuxMipsel32(name) { configure.execute(this) }
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun linuxMipsel32(configure: Action<KotlinNativeTarget>) = linuxMipsel32 { configure.execute(this) }
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun wasm32(
name: String = "wasm32",
configure: KotlinNativeTarget.() -> Unit = { }
@@ -508,20 +508,20 @@ interface KotlinTargetContainerWithNativePresetFunctions : KotlinTargetsContaine
)
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun wasm32() = wasm32("wasm32") { }
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun wasm32(name: String) = wasm32(name) { }
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun wasm32(name: String, configure: Action<KotlinNativeTarget>) = wasm32(name) { configure.execute(this) }
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Suppress("DEPRECATION")
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
@Suppress("DEPRECATION_ERROR")
fun wasm32(configure: Action<KotlinNativeTarget>) = wasm32 { configure.execute(this) }
}
@@ -22,9 +22,9 @@ object KotlinToolingDiagnostics {
)
}
object DeprecatedKotlinNativeTargetsDiagnostic : ToolingDiagnosticFactory(WARNING) {
object DeprecatedKotlinNativeTargetsDiagnostic : ToolingDiagnosticFactory(ERROR) {
operator fun invoke(usedTargetIds: List<String>) = build(
"The following deprecated Kotlin/Native targets were used in the project: ${usedTargetIds.joinToString()}"
"The following removed Kotlin/Native targets were used in the project: ${usedTargetIds.joinToString()}"
)
}
@@ -250,32 +250,32 @@ private class KotlinTargetHierarchyBuilderImpl(
it is KotlinNativeTarget && it.konanTarget == KonanTarget.LINUX_ARM64
}
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
override fun withWatchosX86() = withTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.WATCHOS_X86
}
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
override fun withMingwX86() = withTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.MINGW_X86
}
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
override fun withLinuxArm32Hfp() = withTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.LINUX_ARM32_HFP
}
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
override fun withLinuxMips32() = withTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.LINUX_MIPS32
}
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
override fun withLinuxMipsel32() = withTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.LINUX_MIPSEL32
}
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
override fun withWasm32() = withTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.WASM32
}
@@ -52,25 +52,25 @@ abstract class KotlinArtifactsExtensionImpl @Inject constructor(project: Project
val linuxArm64 = KonanTarget.LINUX_ARM64
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
val iosArm32 = KonanTarget.IOS_ARM32
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
val watchosX86 = KonanTarget.WATCHOS_X86
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
val mingwX86 = KonanTarget.MINGW_X86
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
val linuxArm32Hfp = KonanTarget.LINUX_ARM32_HFP
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
val linuxMips32 = KonanTarget.LINUX_MIPS32
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
val linuxMipsel32 = KonanTarget.LINUX_MIPSEL32
@Deprecated(DEPRECATED_TARGET_MESSAGE)
@Deprecated(DEPRECATED_TARGET_MESSAGE, level = DeprecationLevel.ERROR)
val wasm32 = KonanTarget.WASM32
}
@@ -9,7 +9,7 @@ import org.jetbrains.kotlin.konan.util.Named
import java.io.Serializable
private const val DEPRECATION_LINK = "https://kotl.in/native-targets-tiers"
const val DEPRECATED_TARGET_MESSAGE = "Target is deprecated and will be removed soon. See: $DEPRECATION_LINK"
const val DEPRECATED_TARGET_MESSAGE = "Target is no longer available. See: $DEPRECATION_LINK"
sealed class KonanTarget(override val name: String, val family: Family, val architecture: Architecture) : Named, Serializable {
object ANDROID_X64 : KonanTarget("android_x64", Family.ANDROID, Architecture.X64)