[Gradle, JS] Make ir binaries as live data
#KT-38058 fixed
This commit is contained in:
+2
-3
@@ -85,12 +85,11 @@ constructor(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
internal fun getIrBinary(
|
internal fun getIrBinaries(
|
||||||
type: KotlinJsBinaryType
|
type: KotlinJsBinaryType
|
||||||
): JsIrBinary =
|
): DomainObjectSet<JsIrBinary> =
|
||||||
matching { it.type == type }
|
matching { it.type == type }
|
||||||
.withType(JsIrBinary::class.java)
|
.withType(JsIrBinary::class.java)
|
||||||
.single()
|
|
||||||
|
|
||||||
private fun <T : JsBinary> createBinaries(
|
private fun <T : JsBinary> createBinaries(
|
||||||
compilation: KotlinJsCompilation,
|
compilation: KotlinJsCompilation,
|
||||||
|
|||||||
+2
-2
@@ -96,9 +96,9 @@ abstract class KotlinJsIrSubTarget(
|
|||||||
testJs.group = LifecycleBasePlugin.VERIFICATION_GROUP
|
testJs.group = LifecycleBasePlugin.VERIFICATION_GROUP
|
||||||
testJs.description = testTaskDescription
|
testJs.description = testTaskDescription
|
||||||
|
|
||||||
val testExecutableTask = compilation.binaries.getIrBinary(
|
val testExecutableTask = compilation.binaries.getIrBinaries(
|
||||||
KotlinJsBinaryType.DEVELOPMENT
|
KotlinJsBinaryType.DEVELOPMENT
|
||||||
).linkTask
|
).single().linkTask
|
||||||
|
|
||||||
testJs.inputFileProperty.set(
|
testJs.inputFileProperty.set(
|
||||||
testExecutableTask.map { it.outputFileProperty.get() }
|
testExecutableTask.map { it.outputFileProperty.get() }
|
||||||
|
|||||||
+13
-10
@@ -31,21 +31,24 @@ open class KotlinNodeJsIr @Inject constructor(target: KotlinJsIrTarget) :
|
|||||||
override fun configureRun(
|
override fun configureRun(
|
||||||
compilation: KotlinJsIrCompilation
|
compilation: KotlinJsIrCompilation
|
||||||
) {
|
) {
|
||||||
val developmentExecutable = compilation.binaries.getIrBinary(KotlinJsBinaryType.DEVELOPMENT)
|
compilation.binaries.getIrBinaries(KotlinJsBinaryType.DEVELOPMENT)
|
||||||
|
.all { developmentExecutable ->
|
||||||
|
val runTaskHolder = NodeJsExec.create(compilation, disambiguateCamelCased(RUN_TASK_NAME)) {
|
||||||
|
group = taskGroupName
|
||||||
|
inputFileProperty.set(developmentExecutable.linkTask.map { it.outputFileProperty.get() })
|
||||||
|
}
|
||||||
|
|
||||||
val runTaskHolder = NodeJsExec.create(compilation, disambiguateCamelCased(RUN_TASK_NAME)) {
|
target.runTask.dependsOn(runTaskHolder)
|
||||||
group = taskGroupName
|
}
|
||||||
inputFileProperty.set(developmentExecutable.linkTask.map { it.outputFileProperty.get() })
|
|
||||||
}
|
|
||||||
target.runTask.dependsOn(runTaskHolder)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun configureBuild(
|
override fun configureBuild(
|
||||||
compilation: KotlinJsIrCompilation
|
compilation: KotlinJsIrCompilation
|
||||||
) {
|
) {
|
||||||
val productionExecutable = compilation.binaries.getIrBinary(KotlinJsBinaryType.PRODUCTION)
|
compilation.binaries.getIrBinaries(KotlinJsBinaryType.PRODUCTION)
|
||||||
|
.all { productionExecutable ->
|
||||||
val assembleTask = project.tasks.getByName(LifecycleBasePlugin.ASSEMBLE_TASK_NAME)
|
val assembleTask = project.tasks.getByName(LifecycleBasePlugin.ASSEMBLE_TASK_NAME)
|
||||||
assembleTask.dependsOn(productionExecutable.linkTask)
|
assembleTask.dependsOn(productionExecutable.linkTask)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user