From 0ec76786a66598a82463614cf239394133352710 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Wed, 28 Jun 2023 17:14:52 +0000 Subject: [PATCH] [Gradle, JS] Return back deprecated methods for compatibility ^KT-59604 fixed (cherry picked from commit 0b912b0200717e48c597e9219439a6feb8899fd6) --- .../targets/js/dsl/KotlinJsTargetDsl.kt | 51 +++++++++++++++++++ .../gradle/targets/js/ir/KotlinBrowserJsIr.kt | 4 +- .../targets/js/subtargets/KotlinBrowserJs.kt | 4 +- 3 files changed, 55 insertions(+), 4 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/dsl/KotlinJsTargetDsl.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/dsl/KotlinJsTargetDsl.kt index 16de75ad2c2e0..034892378256f 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/dsl/KotlinJsTargetDsl.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/dsl/KotlinJsTargetDsl.kt @@ -75,25 +75,76 @@ interface KotlinJsTargetDsl : KotlinTarget { } interface KotlinJsSubTargetDsl { + @Deprecated("Please use distribution(Action)") + @ExperimentalDistributionDsl + fun distribution(body: Distribution.() -> Unit) { + distribution(Action { + it.body() + }) + } + @ExperimentalDistributionDsl fun distribution(body: Action) + @Deprecated("Please use testTask(Action)") + fun testTask(body: KotlinJsTest.() -> Unit) { + testTask(Action { + it.body() + }) + } + fun testTask(body: Action) val testRuns: NamedDomainObjectContainer } interface KotlinJsBrowserDsl : KotlinJsSubTargetDsl { + @Deprecated("Please use commonWebpackConfig(Action)") + fun commonWebpackConfig(body: KotlinWebpackConfig.() -> Unit) { + commonWebpackConfig(Action { + it.body() + }) + } + fun commonWebpackConfig(body: Action) + @Deprecated("Please use runTask(Action)") + fun runTask(body: KotlinWebpack.() -> Unit) { + runTask(Action { + it.body() + }) + } + fun runTask(body: Action) + @Deprecated("Please use webpackTask(Action)") + fun webpackTask(body: KotlinWebpack.() -> Unit) { + webpackTask(Action { + it.body() + }) + } + fun webpackTask(body: Action) + @Deprecated("Please use dceTask(Action)") + @ExperimentalDceDsl + fun dceTask(body: KotlinJsDce.() -> Unit) { + dceTask(Action { + it.body() + }) + } + @ExperimentalDceDsl fun dceTask(body: Action) } interface KotlinJsNodeDsl : KotlinJsSubTargetDsl { + @Deprecated("Please use runTask(Action)") + fun runTask(body: NodeJsExec.() -> Unit) { + runTask(Action { + it.body() + }) + } + fun runTask(body: Action) } \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/KotlinBrowserJsIr.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/KotlinBrowserJsIr.kt index a3f61fe0b3ec6..147e8ac3eec3e 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/KotlinBrowserJsIr.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/KotlinBrowserJsIr.kt @@ -84,13 +84,13 @@ abstract class KotlinBrowserJsIr @Inject constructor(target: KotlinJsIrTarget) : runTaskConfigurations.add { it.webpackConfigApplier(body) } - testTask { + testTask(Action { it.onTestFrameworkSet { if (it is KotlinKarma) { body.execute(it.webpackConfig) } } - } + }) } override fun runTask(body: Action) { diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/subtargets/KotlinBrowserJs.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/subtargets/KotlinBrowserJs.kt index 1394d1f10e654..e8042d3e7a8c1 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/subtargets/KotlinBrowserJs.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/subtargets/KotlinBrowserJs.kt @@ -66,13 +66,13 @@ abstract class KotlinBrowserJs @Inject constructor(target: KotlinJsTarget) : runTaskConfigurations.add { it.webpackConfigApplier(body) } - testTask { + testTask(Action { it.onTestFrameworkSet { if (it is KotlinKarma) { body.execute(it.webpackConfig) } } - } + }) } override fun runTask(body: Action) {