-
Notifications
You must be signed in to change notification settings - Fork 170
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
76 lines (62 loc) · 1.97 KB
/
build.gradle.kts
File metadata and controls
76 lines (62 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
plugins {
kotlin("multiplatform")
}
repositories {
mavenCentral()
maven("https://redirector.kotlinlang.org/maven/compose-dev")
mavenLocal()
}
val isCompositeBuild = extra.properties.getOrDefault("skiko.composite.build", "") == "1"
if (project.hasProperty("skiko.version") && isCompositeBuild) {
project.logger.warn("skiko.version property has no effect when skiko.composite.build is set")
}
val skikoWasm by configurations.creating
dependencies {
skikoWasm(if (isCompositeBuild) {
// When we build skiko locally, we have no say in setting skiko.version in the included build.
// That said, it is always built as "0.0.0-SNAPSHOT" and setting any other version is misleading
// and can create conflict due to incompatibility of skiko runtime and skiko libs
files(gradle.includedBuild("skiko").projectDir.resolve("./build/libs/skiko-wasm-0.0.0-SNAPSHOT.jar"))
} else {
libs.skiko.wasm.runtime
})
}
val unpackWasmRuntime = tasks.register("unpackWasmRuntime", Copy::class) {
destinationDir = file("$buildDir/resources/")
from(skikoWasm.map { zipTree(it) })
if (isCompositeBuild) {
dependsOn(gradle.includedBuild("skiko").task(":skikoWasmJar"))
}
}
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile>().configureEach {
dependsOn(unpackWasmRuntime)
}
kotlin {
js(IR) {
browser {
commonWebpackConfig {
outputFileName = "webApp.js"
}
}
binaries.executable()
}
wasmJs {
browser {
commonWebpackConfig {
outputFileName = "webApp.js"
}
}
binaries.executable()
}
sourceSets {
commonMain.dependencies {
implementation(libs.skiko)
}
webMain {
dependencies {
implementation(libs.browser)
}
resources.srcDirs(unpackWasmRuntime.map { it.destinationDir })
}
}
}