@@ -21,26 +21,41 @@ import net.kautler.util.npm
2121import org.gradle.accessors.dm.LibrariesForLibs
2222import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsExec
2323import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
24+ import org.jetbrains.kotlin.gradle.tasks.IncrementalSyncTask
2425import org.yaml.snakeyaml.Yaml
2526
2627plugins {
27- kotlin(" js " )
28+ kotlin(" multiplatform " )
2829}
2930
31+ val libs = the<LibrariesForLibs >()
32+
3033kotlin {
31- js( IR ) {
34+ js {
3235 useCommonJs()
3336 binaries.executable()
3437 nodejs()
3538 }
39+
40+ sourceSets {
41+ jsMain {
42+ dependencies {
43+ implementation(libs.kotlinx.coroutines.core)
44+ implementation(dependencies.platform(libs.kotlin.wrappers.bom))
45+ implementation(libs.kotlin.wrapper.actions.toolkit)
46+ implementation(libs.kotlin.wrapper.js)
47+ implementation(libs.kotlin.wrapper.node)
48+ implementation(npm(libs.semver))
49+ implementation(npm(libs.nullWritable))
50+ }
51+ }
52+ }
3653}
3754
3855// work-around for https://youtrack.jetbrains.com/issue/KT-56305
39- tasks.withType<Copy >().configureEach {
40- if (name.endsWith(" ExecutableCompileSync" )) {
41- doFirst {
42- outputs.files.forEach { it.deleteRecursively() }
43- }
56+ tasks.withType<IncrementalSyncTask >().configureEach {
57+ doFirst {
58+ outputs.files.forEach { it.deleteRecursively() }
4459 }
4560}
4661
@@ -76,26 +91,10 @@ tasks.withType<NodeJsExec>().configureEach {
7691 }
7792}
7893
79- val libs = the<LibrariesForLibs >()
80-
8194configure<NodeJsRootExtension > {
82- nodeVersion = libs.versions.build.node.get()
83- }
84-
85- dependencies {
86- implementation(libs.kotlinx.coroutines.core)
87- implementation(platform(libs.kotlin.wrappers.bom))
88- implementation(libs.kotlin.wrapper.actions.toolkit)
89- implementation(libs.kotlin.wrapper.js)
90- implementation(libs.kotlin.wrapper.node)
91- implementation(npm(libs.semver))
92- implementation(npm(libs.nullWritable))
95+ version = libs.versions.build.node.get()
9396}
9497
9598tasks.assemble {
96- dependsOn(project(" :ncc-packer" ).tasks.named(" nodeProductionRun" ))
97- }
98-
99- fun plugin (plugin : Provider <PluginDependency >) = plugin.map {
100- " ${it.pluginId} :${it.pluginId} .gradle.plugin:${it.version.requiredVersion} "
99+ dependsOn(project(" :ncc-packer" ).tasks.named(" jsNodeProductionRun" ))
101100}
0 commit comments