[Gradle, JS] Fix mpp generator

This commit is contained in:
Ilya Goncharov
2020-01-27 19:28:25 +03:00
parent 0b06f0a05b
commit 406c249d99
3 changed files with 4 additions and 26 deletions
@@ -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
)
@@ -20,7 +20,6 @@ internal class KotlinPresetEntry(
internal fun KotlinPresetEntry.typeNames(): Set<TypeName> = 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
@@ -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 = { }