From 406c249d99b7632ef7504eb2bfc63ab42d86d47f Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Mon, 27 Jan 2020 19:28:25 +0300 Subject: [PATCH] [Gradle, JS] Fix mpp generator --- .../gradle/dsl/mppPresetFunctionsCodegen.kt | 2 +- .../kotlin/generators/gradle/dsl/presetEntries.kt | 13 +++---------- .../KotlinTargetContainerWithPresetFunctions.kt | 15 --------------- 3 files changed, 4 insertions(+), 26 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin-dsl-codegen/src/main/kotlin/org/jetbrains/kotlin/generators/gradle/dsl/mppPresetFunctionsCodegen.kt b/libraries/tools/kotlin-gradle-plugin-dsl-codegen/src/main/kotlin/org/jetbrains/kotlin/generators/gradle/dsl/mppPresetFunctionsCodegen.kt index 0a702ed55b7..4175f17b3ba 100644 --- a/libraries/tools/kotlin-gradle-plugin-dsl-codegen/src/main/kotlin/org/jetbrains/kotlin/generators/gradle/dsl/mppPresetFunctionsCodegen.kt +++ b/libraries/tools/kotlin-gradle-plugin-dsl-codegen/src/main/kotlin/org/jetbrains/kotlin/generators/gradle/dsl/mppPresetFunctionsCodegen.kt @@ -69,7 +69,7 @@ private fun generatePresetFunctions( ): ${presetEntry.targetType.renderShort()} = $configureOrCreateFunctionName( name, - $getPresetsExpression.getByName("$presetName") as ${presetEntry.presetType.renderErased()}, + $getPresetsExpression.getByName("$presetName") as ${presetEntry.presetType.renderShort()}, configure ) diff --git a/libraries/tools/kotlin-gradle-plugin-dsl-codegen/src/main/kotlin/org/jetbrains/kotlin/generators/gradle/dsl/presetEntries.kt b/libraries/tools/kotlin-gradle-plugin-dsl-codegen/src/main/kotlin/org/jetbrains/kotlin/generators/gradle/dsl/presetEntries.kt index 88d518a1e73..6d0f5555e00 100644 --- a/libraries/tools/kotlin-gradle-plugin-dsl-codegen/src/main/kotlin/org/jetbrains/kotlin/generators/gradle/dsl/presetEntries.kt +++ b/libraries/tools/kotlin-gradle-plugin-dsl-codegen/src/main/kotlin/org/jetbrains/kotlin/generators/gradle/dsl/presetEntries.kt @@ -20,7 +20,6 @@ internal class KotlinPresetEntry( internal fun KotlinPresetEntry.typeNames(): Set = setOf(presetType, targetType) internal const val MPP_PACKAGE = "org.jetbrains.kotlin.gradle.plugin.mpp" -internal const val JS_IR_PACKAGE = "org.jetbrains.kotlin.gradle.targets.js.ir" internal object NativeFQNames { object Targets { @@ -44,14 +43,9 @@ internal val jvmPresetEntry = KotlinPresetEntry( internal val jsPresetEntry = KotlinPresetEntry( "js", - typeName("$MPP_PACKAGE.KotlinJsTargetPreset"), - typeName("org.jetbrains.kotlin.gradle.targets.js.KotlinJsTarget") -) - -internal val jsIrPresetEntry = KotlinPresetEntry( - "jsIr", - typeName("$JS_IR_PACKAGE.KotlinJsIrTargetPreset"), - typeName("$JS_IR_PACKAGE.KotlinJsIrTarget") + // need for commonization KotlinJsTargetPreset and KotlinJsIrTargetPreser + typeName("org.jetbrains.kotlin.gradle.plugin.KotlinTargetPreset", "org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsTargetDsl"), + typeName("org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsTargetDsl") ) internal val androidPresetEntry = KotlinPresetEntry( @@ -84,6 +78,5 @@ internal val nativePresetEntries = HostManager().targets internal val allPresetEntries = listOf( jvmPresetEntry, jsPresetEntry, - jsIrPresetEntry, androidPresetEntry ) + nativePresetEntries \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinTargetContainerWithPresetFunctions.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinTargetContainerWithPresetFunctions.kt index 0b4c5c9e74a..8291b0709b1 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinTargetContainerWithPresetFunctions.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinTargetContainerWithPresetFunctions.kt @@ -42,21 +42,6 @@ interface KotlinTargetContainerWithPresetFunctions : KotlinTargetsContainerWithP fun js(name: String, configure: Closure<*>) = js(name) { ConfigureUtil.configure(configure, this) } fun js(configure: Closure<*>) = js { ConfigureUtil.configure(configure, this) } -// fun jsIr( -// name: String = "jsIr", -// configure: KotlinJsIrTarget.() -> Unit = { } -// ): KotlinJsIrTarget = -// configureOrCreate( -// name, -// presets.getByName("jsIr") as KotlinJsIrTargetPreset, -// configure -// ) -// -// fun jsIr() = jsIr("jsIr") { } -// fun jsIr(name: String) = jsIr(name) { } -// fun jsIr(name: String, configure: Closure<*>) = jsIr(name) { ConfigureUtil.configure(configure, this) } -// fun jsIr(configure: Closure<*>) = jsIr { ConfigureUtil.configure(configure, this) } - fun android( name: String = "android", configure: KotlinAndroidTarget.() -> Unit = { }