diff --git a/libraries/tools/kotlin-gradle-plugin/api/all/kotlin-gradle-plugin.api b/libraries/tools/kotlin-gradle-plugin/api/all/kotlin-gradle-plugin.api index 8a680d1d286e4..1ffcf584f306e 100644 --- a/libraries/tools/kotlin-gradle-plugin/api/all/kotlin-gradle-plugin.api +++ b/libraries/tools/kotlin-gradle-plugin/api/all/kotlin-gradle-plugin.api @@ -3732,9 +3732,6 @@ public final class org/jetbrains/kotlin/gradle/targets/js/ir/KotlinBrowserJsIr$C public abstract class org/jetbrains/kotlin/gradle/targets/js/ir/KotlinD8Ir : org/jetbrains/kotlin/gradle/targets/js/ir/KotlinJsIrSubTarget, org/jetbrains/kotlin/gradle/targets/js/dsl/KotlinWasmD8Dsl { public fun (Lorg/jetbrains/kotlin/gradle/targets/js/ir/KotlinJsIrTarget;)V - public fun binaryInputFile (Lorg/jetbrains/kotlin/gradle/targets/js/ir/JsIrBinary;)Lorg/gradle/api/provider/Provider; - public fun binarySyncOutput (Lorg/jetbrains/kotlin/gradle/targets/js/ir/JsIrBinary;)Lorg/gradle/api/provider/Provider; - public fun binarySyncTaskName (Lorg/jetbrains/kotlin/gradle/targets/js/ir/JsIrBinary;)Ljava/lang/String; public fun configureDefaultTestFramework (Lorg/jetbrains/kotlin/gradle/targets/js/testing/KotlinJsTest;)V public fun configureTestDependencies (Lorg/jetbrains/kotlin/gradle/targets/js/testing/KotlinJsTest;Lorg/jetbrains/kotlin/gradle/targets/js/ir/JsIrBinary;)V public fun getTestTaskDescription ()Ljava/lang/String; @@ -3847,9 +3844,6 @@ public abstract class org/jetbrains/kotlin/gradle/targets/js/ir/KotlinJsIrLink : public abstract class org/jetbrains/kotlin/gradle/targets/js/ir/KotlinJsIrNpmBasedSubTarget : org/jetbrains/kotlin/gradle/targets/js/ir/KotlinJsIrSubTarget { public fun (Lorg/jetbrains/kotlin/gradle/targets/js/ir/KotlinJsIrTarget;Ljava/lang/String;)V - public fun binaryInputFile (Lorg/jetbrains/kotlin/gradle/targets/js/ir/JsIrBinary;)Lorg/gradle/api/provider/Provider; - public fun binarySyncOutput (Lorg/jetbrains/kotlin/gradle/targets/js/ir/JsIrBinary;)Lorg/gradle/api/provider/Provider; - public fun binarySyncTaskName (Lorg/jetbrains/kotlin/gradle/targets/js/ir/JsIrBinary;)Ljava/lang/String; } public final class org/jetbrains/kotlin/gradle/targets/js/ir/KotlinJsIrOutputGranularity : java/lang/Enum { @@ -3876,9 +3870,6 @@ public abstract class org/jetbrains/kotlin/gradle/targets/js/ir/KotlinJsIrSubTar public static final field DISTRIBUTION_TASK_NAME Ljava/lang/String; public static final field RUN_TASK_NAME Ljava/lang/String; public fun (Lorg/jetbrains/kotlin/gradle/targets/js/ir/KotlinJsIrTarget;Ljava/lang/String;)V - public abstract fun binaryInputFile (Lorg/jetbrains/kotlin/gradle/targets/js/ir/JsIrBinary;)Lorg/gradle/api/provider/Provider; - public abstract fun binarySyncOutput (Lorg/jetbrains/kotlin/gradle/targets/js/ir/JsIrBinary;)Lorg/gradle/api/provider/Provider; - public abstract fun binarySyncTaskName (Lorg/jetbrains/kotlin/gradle/targets/js/ir/JsIrBinary;)Ljava/lang/String; public abstract fun configureDefaultTestFramework (Lorg/jetbrains/kotlin/gradle/targets/js/testing/KotlinJsTest;)V public abstract fun configureTestDependencies (Lorg/jetbrains/kotlin/gradle/targets/js/testing/KotlinJsTest;Lorg/jetbrains/kotlin/gradle/targets/js/ir/JsIrBinary;)V public fun distribution (Lorg/gradle/api/Action;)V @@ -3972,9 +3963,6 @@ public final class org/jetbrains/kotlin/gradle/targets/js/ir/KotlinJsIrTargetPre public abstract class org/jetbrains/kotlin/gradle/targets/js/ir/KotlinNodeJsIr : org/jetbrains/kotlin/gradle/targets/js/ir/KotlinJsIrNpmBasedSubTarget, org/jetbrains/kotlin/gradle/targets/js/dsl/KotlinJsNodeDsl { public fun (Lorg/jetbrains/kotlin/gradle/targets/js/ir/KotlinJsIrTarget;)V - public fun binaryInputFile (Lorg/jetbrains/kotlin/gradle/targets/js/ir/JsIrBinary;)Lorg/gradle/api/provider/Provider; - public fun binarySyncOutput (Lorg/jetbrains/kotlin/gradle/targets/js/ir/JsIrBinary;)Lorg/gradle/api/provider/Provider; - public fun binarySyncTaskName (Lorg/jetbrains/kotlin/gradle/targets/js/ir/JsIrBinary;)Ljava/lang/String; public fun configureDefaultTestFramework (Lorg/jetbrains/kotlin/gradle/targets/js/testing/KotlinJsTest;)V public fun configureTestDependencies (Lorg/jetbrains/kotlin/gradle/targets/js/testing/KotlinJsTest;Lorg/jetbrains/kotlin/gradle/targets/js/ir/JsIrBinary;)V public fun getTestTaskDescription ()Ljava/lang/String; diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/D8EnvironmentConfigurator.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/D8EnvironmentConfigurator.kt index 723e2f6e18b59..e7f99c429a432 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/D8EnvironmentConfigurator.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/D8EnvironmentConfigurator.kt @@ -26,7 +26,7 @@ class D8EnvironmentConfigurator(subTarget: KotlinJsIrSubTarget) : return D8Exec.register(binary.compilation, binaryRunName) { group = subTarget.taskGroupName - dependsOn(project.tasks.named(subTarget.binarySyncTaskName(binary))) + dependsOn(binary.linkSyncTask) val inputFile = project.objects.fileProperty().value( binary.mainFileSyncPath ) diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/JsEnvironmentConfigurator.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/JsEnvironmentConfigurator.kt index a5bb7832d912c..acc0f5b6027b8 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/JsEnvironmentConfigurator.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/JsEnvironmentConfigurator.kt @@ -34,7 +34,7 @@ abstract class JsEnvironmentConfigurator(protected val subTarget val assembleTask = if (subTarget.target.wasmTargetType == KotlinWasmTargetType.WASI) { (productionExecutable as WasmBinary).optimizeTask } else { - project.tasks.named(subTarget.binarySyncTaskName(productionExecutable)) + productionExecutable.linkSyncTask } if (compilation.isMain()) { diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/KotlinD8Ir.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/KotlinD8Ir.kt index ab4654d8bf352..612c54ad83e20 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/KotlinD8Ir.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/KotlinD8Ir.kt @@ -6,16 +6,12 @@ package org.jetbrains.kotlin.gradle.targets.js.ir import org.gradle.api.Action -import org.gradle.api.file.Directory -import org.gradle.api.file.RegularFile -import org.gradle.api.provider.Provider import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl import org.jetbrains.kotlin.gradle.targets.js.d8.D8Exec import org.jetbrains.kotlin.gradle.targets.js.d8.D8Plugin import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinWasmD8Dsl import org.jetbrains.kotlin.gradle.targets.js.testing.KotlinJsTest import org.jetbrains.kotlin.gradle.targets.js.testing.KotlinWasmD8 -import org.jetbrains.kotlin.gradle.utils.getFile import org.jetbrains.kotlin.gradle.utils.withType import javax.inject.Inject @@ -47,17 +43,4 @@ abstract class KotlinD8Ir @Inject constructor(target: KotlinJsIrTarget) : } } - override fun binaryInputFile(binary: JsIrBinary): Provider { - return binary.mainFileSyncPath - } - - override fun binarySyncTaskName(binary: JsIrBinary): String { - return binary.linkSyncTaskName - } - - override fun binarySyncOutput(binary: JsIrBinary): Provider { - return project.objects.directoryProperty().fileProvider( - binary.linkTask.map { it.destinationDirectory.getFile().parentFile.resolve(disambiguationClassifier) } - ) - } } \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/KotlinJsIrNpmBasedSubTarget.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/KotlinJsIrNpmBasedSubTarget.kt index 63c194b999806..1b8d4e7c9f4f2 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/KotlinJsIrNpmBasedSubTarget.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/KotlinJsIrNpmBasedSubTarget.kt @@ -5,25 +5,7 @@ package org.jetbrains.kotlin.gradle.targets.js.ir -import org.gradle.api.file.Directory -import org.gradle.api.file.RegularFile -import org.gradle.api.provider.Provider -import org.jetbrains.kotlin.gradle.targets.js.npm.npmProject - abstract class KotlinJsIrNpmBasedSubTarget( target: KotlinJsIrTarget, disambiguationClassifier: String, -) : KotlinJsIrSubTarget(target, disambiguationClassifier) { - - override fun binaryInputFile(binary: JsIrBinary): Provider { - return binary.mainFileSyncPath - } - - override fun binarySyncTaskName(binary: JsIrBinary): String { - return binary.linkSyncTaskName - } - - override fun binarySyncOutput(binary: JsIrBinary): Provider { - return binary.compilation.npmProject.dist - } -} +) : KotlinJsIrSubTarget(target, disambiguationClassifier) diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/KotlinJsIrSubTarget.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/KotlinJsIrSubTarget.kt index 987bc2a0da038..1f97b8777fee2 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/KotlinJsIrSubTarget.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/KotlinJsIrSubTarget.kt @@ -6,10 +6,7 @@ package org.jetbrains.kotlin.gradle.targets.js.ir import org.gradle.api.* -import org.gradle.api.file.Directory -import org.gradle.api.file.RegularFile import org.gradle.api.plugins.ExtensionAware -import org.gradle.api.provider.Provider import org.gradle.api.tasks.TaskProvider import org.gradle.language.base.plugins.LifecycleBasePlugin import org.jetbrains.kotlin.gradle.plugin.AbstractKotlinTargetConfigurator @@ -167,9 +164,6 @@ abstract class KotlinJsIrSubTarget( abstract fun configureDefaultTestFramework(test: KotlinJsTest) abstract fun configureTestDependencies(test: KotlinJsTest, binary: JsIrBinary) - abstract fun binaryInputFile(binary: JsIrBinary): Provider - abstract fun binarySyncTaskName(binary: JsIrBinary): String - abstract fun binarySyncOutput(binary: JsIrBinary): Provider private fun configureMainCompilation() { target.compilations.all { compilation -> diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/KotlinNodeJsIr.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/KotlinNodeJsIr.kt index c5fbde0273a81..a7cc27752da2f 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/KotlinNodeJsIr.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/KotlinNodeJsIr.kt @@ -6,10 +6,6 @@ package org.jetbrains.kotlin.gradle.targets.js.ir import org.gradle.api.Action -import org.gradle.api.file.Directory -import org.gradle.api.file.RegularFile -import org.gradle.api.provider.Provider -import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType import org.jetbrains.kotlin.gradle.targets.js.KotlinWasmTargetType import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalMainFunctionArgumentsDsl @@ -19,9 +15,6 @@ import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsPlugin.Companion.kotl import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin.Companion.kotlinNodeJsRootExtension import org.jetbrains.kotlin.gradle.targets.js.testing.KotlinJsTest import org.jetbrains.kotlin.gradle.targets.js.testing.KotlinWasmNode -import org.jetbrains.kotlin.gradle.tasks.IncrementalSyncTask -import org.jetbrains.kotlin.gradle.utils.getFile -import org.jetbrains.kotlin.gradle.utils.named import org.jetbrains.kotlin.gradle.utils.withType import javax.inject.Inject @@ -62,40 +55,6 @@ abstract class KotlinNodeJsIr @Inject constructor(target: KotlinJsIrTarget) : test.dependsOn(binary.linkTask) } - override fun binaryInputFile(binary: JsIrBinary): Provider { - return if (target.wasmTargetType != KotlinWasmTargetType.WASI) { - super.binaryInputFile(binary) - } else { - project.objects.fileProperty().fileProvider( - project.tasks.named(binarySyncTaskName(binary)).map { - it.destinationDirectory.get().resolve(binary.mainFileName.get()) - } - ) - } - } - - override fun binarySyncTaskName(binary: JsIrBinary): String { - return if (target.wasmTargetType != KotlinWasmTargetType.WASI) { - super.binarySyncTaskName(binary) - } else { - disambiguateCamelCased( - binary.compilation.name.takeIf { it != KotlinCompilation.MAIN_COMPILATION_NAME }, - binary.name, - COMPILE_SYNC - ) - } - } - - override fun binarySyncOutput(binary: JsIrBinary): Provider { - return if (target.wasmTargetType != KotlinWasmTargetType.WASI) { - super.binarySyncOutput(binary) - } else { - project.objects.directoryProperty().fileProvider( - binary.linkTask.map { it.destinationDirectory.getFile().parentFile.resolve(disambiguationClassifier) } - ) - } - } - override fun configureDefaultTestFramework(test: KotlinJsTest) { if (target.platformType != KotlinPlatformType.wasm) { val nodeJsRoot = project.rootProject.kotlinNodeJsRootExtension diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/WebpackConfigurator.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/WebpackConfigurator.kt index eef8c26160565..f4ce09cab5aca 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/WebpackConfigurator.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/ir/WebpackConfigurator.kt @@ -57,7 +57,7 @@ class WebpackConfigurator(private val subTarget: KotlinJsIrSubTarget) : SubTarge val mode = binary.mode val archivesName = project.archivesName - val linkSyncTask = compilation.target.project.tasks.named(subTarget.binarySyncTaskName(binary)) + val linkSyncTask = binary.linkSyncTask val webpackTask = subTarget.registerSubTargetTask( subTarget.disambiguateCamelCased( @@ -127,7 +127,7 @@ class WebpackConfigurator(private val subTarget: KotlinJsIrSubTarget) : SubTarge val mode = binary.mode val archivesName = project.archivesName - val linkSyncTask = compilation.target.project.tasks.named(subTarget.binarySyncTaskName(binary)) + val linkSyncTask = binary.linkSyncTask subTarget.registerSubTargetTask( subTarget.disambiguateCamelCased(