From 92291c03e84be324359a536a56d05aa7c9dcc449 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Wed, 19 Feb 2020 16:31:14 +0300 Subject: [PATCH] [Gradle, JS] Add methods with string definition of compiler --- ...linTargetContainerWithJsPresetFunctions.kt | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinTargetContainerWithJsPresetFunctions.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinTargetContainerWithJsPresetFunctions.kt index cace52fa097..0fcf25d94a7 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinTargetContainerWithJsPresetFunctions.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/dsl/KotlinTargetContainerWithJsPresetFunctions.kt @@ -27,6 +27,19 @@ interface KotlinTargetContainerWithJsPresetFunctions : configure ) + fun js( + name: String, + compiler: String, + configure: KotlinJsTargetDsl.() -> Unit = { } + ) = js( + name = name, + compiler = KotlinJsCompilerType.byArgument(compiler) + ?: throw IllegalArgumentException( + "Unable to find $compiler setting. Use [${KotlinJsCompilerType.values().toList().joinToString()}]" + ), + configure = configure + ) + fun js( name: String = "js", configure: KotlinJsTargetDsl.() -> Unit = { } @@ -42,4 +55,26 @@ interface KotlinTargetContainerWithJsPresetFunctions : fun js(name: String, configure: Closure<*>) = js(name = name) { ConfigureUtil.configure(configure, this) } fun js(compiler: KotlinJsCompilerType, configure: Closure<*>) = js(compiler = compiler) { ConfigureUtil.configure(configure, this) } fun js(configure: Closure<*>) = js { ConfigureUtil.configure(configure, this) } + + fun js( + name: String, + compiler: KotlinJsCompilerType, + configure: Closure<*> + ) = js( + name = name, + compiler = compiler + ) { + ConfigureUtil.configure(configure, this) + } + + fun js( + name: String, + compiler: String, + configure: Closure<*> + ) = js( + name = name, + compiler = compiler + ) { + ConfigureUtil.configure(configure, this) + } } \ No newline at end of file