-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
130 lines (114 loc) · 3.33 KB
/
build.gradle.kts
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
import com.huanshankeji.cpnProject
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
plugins {
`common-conventions`
id("com.android.application")
}
kotlin {
androidTarget()
listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "ComposeApp"
isStatic = true
}
}
val outputFileName = "app.js"
@OptIn(ExperimentalWasmDsl::class)
wasmJs {
browser {
commonWebpackConfig {
this.outputFileName = outputFileName
}
}
binaries.executable()
}
js {
browser {
commonWebpackConfig {
cssSupport { enabled.set(true) }
scssSupport { enabled.set(true) }
this.outputFileName = outputFileName
}
}
binaries.executable()
}
sourceSets {
commonMain {
dependencies {
implementation(compose.runtime)
implementation(cpnProject(project, ":material2"))
implementation(cpnProject(project, ":material3"))
implementation(cpnProject(project, ":navigation"))
/*
see https://github.com/JetBrains/compose-multiplatform-core/blob/476d43b99a27696d12ef087e8028d90789645ba7/compose/ui/ui/build.gradle#L54
and https://github.com/JetBrains/compose-multiplatform-core/blob/381796b5e682653aa1fa53e6bcf0441d06b873f8/compose/runtime/runtime/build.gradle#L124
*/
implementation(commonDependencies.kotlinx.coroutines.core())
}
}
composeUiMain {
dependencies {
implementation(compose.ui)
}
}
jvmMain {
dependencies {
implementation(compose.desktop.currentOs)
}
}
androidMain {
dependencies {
implementation(commonDependencies.androidx.activity.compose())
implementation(commonDependencies.androidx.compose.ui.module("tooling-preview"))
}
}
jsMain {
dependencies {
implementation(compose.html.core)
implementation(npm("material-symbols", DependencyVersions.materialSymbols))
}
}
}
}
val `package` = "$group.compose.material.demo"
compose {
desktop {
application {
mainClass = "$`package`.MainKt"
}
}
}
android {
namespace = `package`
val sdk = androidSdkVersion
compileSdk = sdk
defaultConfig {
applicationId = `package`
minSdk = 24
targetSdk = sdk
versionName = version as String
}
buildFeatures {
compose = true
}
dependencies {
debugImplementation(compose.uiTooling)
}
}
val jsBrowserDistribution by tasks.getting(Copy::class)
val wasmJsBrowserDistribution by tasks.getting(Copy::class)
tasks.register<Sync>("sideBySideBrowserDistribution") {
group = "kotlin browser"
into(layout.buildDirectory.dir("dist/sideBySide/productionExecutable"))
from(jsBrowserDistribution) {
into("js-dom")
}
from(wasmJsBrowserDistribution) {
into("wasm-js-canvas")
}
from(projectDir.resolve("side-by-side-site"))
}