-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle.kts
115 lines (103 loc) · 2.81 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
/*
* Copyright (c) 2023. Christian Grach <[email protected]>
*
* SPDX-License-Identifier: Apache-2.0
*/
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
import java.time.LocalDate
import java.util.Properties
plugins {
kotlin("multiplatform")
id("org.jetbrains.compose") version libs.versions.composeMultiplatformWasm
id("ktlint")
// TODO remove once common can be shared
alias(libs.plugins.buildConfig)
}
kotlin {
js(IR) {
moduleName = "web-canvas"
browser()
binaries.executable()
}
@OptIn(ExperimentalWasmDsl::class)
wasm {
moduleName = "web-canvas"
browser()
binaries.executable()
}
sourceSets {
val jsWasmMain by creating {
this.kotlin.srcDir(tasks.generateBuildConfig)
dependencies {
implementation(compose.runtime)
implementation(compose.ui)
implementation(compose.foundation)
implementation(compose.material)
@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
implementation(compose.components.resources)
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4-wasm3")
}
}
getByName("wasmMain") {
dependsOn(jsWasmMain)
}
getByName("jsMain") {
dependsOn(jsWasmMain)
dependencies {
// TODO get `:common` working with at least javascript
// implementation(projects.common)
implementation(projects.commonCompose)
}
}
}
targets.all {
compilations.all {
compileTaskProvider {
dependsOn(tasks.generateBuildConfig)
}
}
}
}
// TODO remove once common can be shared
buildConfig {
packageName("com.cmgapps.common.curriculumvitae")
useKotlinOutput { topLevelConstants = true }
val configProperties by lazy {
Properties().apply {
rootDir.resolve("config.properties").inputStream().use {
load(it)
}
}
}
buildConfigField(
"String",
"BaseUrl",
provider {
""""${configProperties.getProperty("baseUrl")}""""
},
)
buildConfigField(
"String",
"DebugBaseUrls",
provider {
""""${configProperties.getProperty("debugBaseUrls")}""""
},
)
buildConfigField(
"String",
"BuildYear",
provider {
""""${LocalDate.now().year}""""
},
)
buildConfigField(
"String",
"GithubReposUrl",
provider {
""""${configProperties.getProperty("githubReposUrl")}""""
},
)
}
compose.experimental {
web.application {}
}