Revert "[Gradle/MPP] Refactored KotlinTargetContainerWithPresetFunctions"

This reverts commit becf50ee

These changes are binary incompatible due to move of methods with
default arguments.

^KT-59049 In Progress
^KT-57903 In Progress
This commit is contained in:
Anton Lakotka
2023-06-02 16:58:23 +02:00
committed by Space Team
parent 0cfe2b04f5
commit 5a8b6e9603
8 changed files with 59 additions and 99 deletions
@@ -19,7 +19,7 @@ private val presetsProperty = KotlinTargetsContainerWithPresets::presets.name
private fun generateKotlinTargetContainerWithPresetFunctionsInterface() {
// Generate KotlinMultiplatformExtension subclass with member functions for the presets:
val functions = nativePresetEntries.map { kotlinPreset ->
val functions = allPresetEntries.map { kotlinPreset ->
// magic indent is needed to make the result look pretty
val funPrefix = kotlinPreset.deprecation?.let { "\n $it\n @Suppress(\"DEPRECATION_ERROR\")\n " } ?: ""
generatePresetFunctions(kotlinPreset, presetsProperty, "configureOrCreate", funPrefix)
@@ -29,11 +29,11 @@ private fun generateKotlinTargetContainerWithPresetFunctionsInterface() {
typeName(parentInterface.java.canonicalName)
val className =
typeName("org.jetbrains.kotlin.gradle.dsl.KotlinTargetContainerWithNativePresetFunctions")
typeName("org.jetbrains.kotlin.gradle.dsl.KotlinTargetContainerWithPresetFunctions")
val deprecatedMessageVal = typeName("org.jetbrains.kotlin.konan.target.DEPRECATED_TARGET_MESSAGE")
val imports = nativePresetEntries
val imports = allPresetEntries
.flatMap { it.typeNames() }
.plus(parentInterfaceName)
.plus(deprecatedMessageVal)
@@ -36,6 +36,18 @@ internal object NativeFQNames {
}
}
internal val jvmPresetEntry = KotlinPresetEntry(
"jvm",
typeName("$MPP_PACKAGE.KotlinJvmTargetPreset"),
typeName("org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget")
)
internal val androidPresetEntry = KotlinPresetEntry(
"android",
typeName("$MPP_PACKAGE.KotlinAndroidTargetPreset"),
typeName("$MPP_PACKAGE.KotlinAndroidTarget")
)
// Note: modifying these sets should also be reflected in the MPP plugin code, see 'setupDefaultPresets'
private val nativeTargetsWithHostTests =
setOf(KonanTarget.LINUX_X64, KonanTarget.MACOS_X64, KonanTarget.MACOS_ARM64, KonanTarget.MINGW_X64)
@@ -67,3 +79,8 @@ internal val nativePresetEntries = HostManager().targets
KotlinPresetEntry(target.presetName, typeName(presetType), typeName(targetType), deprecation)
}
internal val allPresetEntries = listOf(
jvmPresetEntry,
androidPresetEntry
) + nativePresetEntries