[Gradle, JS] Configure build for nodejs in ir
This commit is contained in:
+2
-7
@@ -60,12 +60,7 @@ open class KotlinBrowserJsIr @Inject constructor(target: KotlinJsIrTarget) :
|
|||||||
project.logger.warn("dceTask configuration is useless with IR compiler. Use @JsExport on declarations instead.")
|
project.logger.warn("dceTask configuration is useless with IR compiler. Use @JsExport on declarations instead.")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun configureMain(compilation: KotlinJsIrCompilation) {
|
override fun configureRun(
|
||||||
configureRun(compilation)
|
|
||||||
configureBuild(compilation)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun configureRun(
|
|
||||||
compilation: KotlinJsIrCompilation
|
compilation: KotlinJsIrCompilation
|
||||||
) {
|
) {
|
||||||
|
|
||||||
@@ -122,7 +117,7 @@ open class KotlinBrowserJsIr @Inject constructor(target: KotlinJsIrTarget) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun configureBuild(
|
override fun configureBuild(
|
||||||
compilation: KotlinJsIrCompilation
|
compilation: KotlinJsIrCompilation
|
||||||
) {
|
) {
|
||||||
val project = compilation.target.project
|
val project = compilation.target.project
|
||||||
|
|||||||
+8
-1
@@ -141,7 +141,14 @@ abstract class KotlinJsIrSubTarget(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract fun configureMain(compilation: KotlinJsIrCompilation)
|
private fun configureMain(compilation: KotlinJsIrCompilation) {
|
||||||
|
configureRun(compilation)
|
||||||
|
configureBuild(compilation)
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract fun configureRun(compilation: KotlinJsIrCompilation)
|
||||||
|
|
||||||
|
protected abstract fun configureBuild(compilation: KotlinJsIrCompilation)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val RUN_TASK_NAME = "run"
|
const val RUN_TASK_NAME = "run"
|
||||||
|
|||||||
+9
-5
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.gradle.targets.js.ir
|
package org.jetbrains.kotlin.gradle.targets.js.ir
|
||||||
|
|
||||||
|
import org.gradle.language.base.plugins.LifecycleBasePlugin
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsNodeDsl
|
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsNodeDsl
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsExec
|
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsExec
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.testing.KotlinJsTest
|
import org.jetbrains.kotlin.gradle.targets.js.testing.KotlinJsTest
|
||||||
@@ -26,11 +27,7 @@ open class KotlinNodeJsIr @Inject constructor(target: KotlinJsIrTarget) :
|
|||||||
it.useMocha { }
|
it.useMocha { }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun configureMain(compilation: KotlinJsIrCompilation) {
|
override fun configureRun(
|
||||||
configureRun(compilation)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun configureRun(
|
|
||||||
compilation: KotlinJsIrCompilation
|
compilation: KotlinJsIrCompilation
|
||||||
) {
|
) {
|
||||||
val runTaskHolder = NodeJsExec.create(compilation, disambiguateCamelCased(RUN_TASK_NAME)) {
|
val runTaskHolder = NodeJsExec.create(compilation, disambiguateCamelCased(RUN_TASK_NAME)) {
|
||||||
@@ -39,6 +36,13 @@ open class KotlinNodeJsIr @Inject constructor(target: KotlinJsIrTarget) :
|
|||||||
target.runTask.dependsOn(runTaskHolder)
|
target.runTask.dependsOn(runTaskHolder)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun configureBuild(
|
||||||
|
compilation: KotlinJsIrCompilation
|
||||||
|
) {
|
||||||
|
val assembleTask = project.tasks.getByName(LifecycleBasePlugin.ASSEMBLE_TASK_NAME)
|
||||||
|
assembleTask.dependsOn(compilation.productionLinkTask)
|
||||||
|
}
|
||||||
|
|
||||||
override fun configureBuildVariants() {
|
override fun configureBuildVariants() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user