[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
|
||||
): JsIrBinary =
|
||||
): DomainObjectSet<JsIrBinary> =
|
||||
matching { it.type == type }
|
||||
.withType(JsIrBinary::class.java)
|
||||
.single()
|
||||
|
||||
private fun <T : JsBinary> createBinaries(
|
||||
compilation: KotlinJsCompilation,
|
||||
|
||||
+2
-2
@@ -96,9 +96,9 @@ abstract class KotlinJsIrSubTarget(
|
||||
testJs.group = LifecycleBasePlugin.VERIFICATION_GROUP
|
||||
testJs.description = testTaskDescription
|
||||
|
||||
val testExecutableTask = compilation.binaries.getIrBinary(
|
||||
val testExecutableTask = compilation.binaries.getIrBinaries(
|
||||
KotlinJsBinaryType.DEVELOPMENT
|
||||
).linkTask
|
||||
).single().linkTask
|
||||
|
||||
testJs.inputFileProperty.set(
|
||||
testExecutableTask.map { it.outputFileProperty.get() }
|
||||
|
||||
+13
-10
@@ -31,21 +31,24 @@ open class KotlinNodeJsIr @Inject constructor(target: KotlinJsIrTarget) :
|
||||
override fun configureRun(
|
||||
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)) {
|
||||
group = taskGroupName
|
||||
inputFileProperty.set(developmentExecutable.linkTask.map { it.outputFileProperty.get() })
|
||||
}
|
||||
target.runTask.dependsOn(runTaskHolder)
|
||||
target.runTask.dependsOn(runTaskHolder)
|
||||
}
|
||||
}
|
||||
|
||||
override fun configureBuild(
|
||||
compilation: KotlinJsIrCompilation
|
||||
) {
|
||||
val productionExecutable = compilation.binaries.getIrBinary(KotlinJsBinaryType.PRODUCTION)
|
||||
|
||||
val assembleTask = project.tasks.getByName(LifecycleBasePlugin.ASSEMBLE_TASK_NAME)
|
||||
assembleTask.dependsOn(productionExecutable.linkTask)
|
||||
compilation.binaries.getIrBinaries(KotlinJsBinaryType.PRODUCTION)
|
||||
.all { productionExecutable ->
|
||||
val assembleTask = project.tasks.getByName(LifecycleBasePlugin.ASSEMBLE_TASK_NAME)
|
||||
assembleTask.dependsOn(productionExecutable.linkTask)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user