@@ -21,26 +21,41 @@ import net.kautler.util.npm
21
21
import org.gradle.accessors.dm.LibrariesForLibs
22
22
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsExec
23
23
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
24
+ import org.jetbrains.kotlin.gradle.tasks.IncrementalSyncTask
24
25
import org.yaml.snakeyaml.Yaml
25
26
26
27
plugins {
27
- kotlin(" js " )
28
+ kotlin(" multiplatform " )
28
29
}
29
30
31
+ val libs = the<LibrariesForLibs >()
32
+
30
33
kotlin {
31
- js( IR ) {
34
+ js {
32
35
useCommonJs()
33
36
binaries.executable()
34
37
nodejs()
35
38
}
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
+ }
36
53
}
37
54
38
55
// 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() }
44
59
}
45
60
}
46
61
@@ -76,26 +91,10 @@ tasks.withType<NodeJsExec>().configureEach {
76
91
}
77
92
}
78
93
79
- val libs = the<LibrariesForLibs >()
80
-
81
94
configure<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()
93
96
}
94
97
95
98
tasks.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" ))
101
100
}
0 commit comments