-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
161 lines (140 loc) · 4.19 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.gradle.ext.ProjectSettings
import org.jetbrains.gradle.ext.TaskTriggersConfig
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
alias(libs.plugins.kotlin)
alias(libs.plugins.kotlin.compose)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.compose)
alias(libs.plugins.idea.ext)
`maven-publish`
}
val deployNative = (findProperty("deploy.native") as String?)?.toBoolean() ?: true
val deployKotlin = (findProperty("deploy.kotlin") as String?)?.toBoolean() ?: true
val skikoEGL = (findProperty("skiko.egl") as String?)?.toBoolean() ?: false
dependencies {
// Note, if you develop a library, you should use compose.desktop.common.
// compose.desktop.currentOs should be used in launcher-sourceSet
// (in a separate module for demo project and in testMain).
// With compose.desktop.common you will also lose @Preview functionality
implementation(compose.desktop.currentOs)
implementation(compose.material3)
implementation(compose.materialIconsExtended)
implementation("androidx.annotation:annotation-jvm:1.9.1")
implementation(libs.compose.gl)
implementation(libs.compose.gl.natives)
implementation(libs.jni.utils)
implementation(libs.jna)
implementation(libs.bundles.kotlinx)
implementation(libs.slf4j.api) // for logging
if (deployNative) {
implementation(project(":native"))
}
implementation(kotlin("reflect"))
if (skikoEGL) {
implementation(libs.bundles.skiko) {
version {
strictly(libs.skiko.awt.runtime.linux.x64.get().version!!)
}
}
}
testImplementation(compose.materialIconsExtended)
testImplementation(libs.bundles.kotest)
testImplementation(libs.mockk)
testImplementation(libs.logback.classic)
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS)
}
compose.desktop {
application {
mainClass = "MainKt"
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "gl-demo"
packageVersion = "1.0.0"
}
}
}
val templateSrc = layout.projectDirectory.dir("src/main/templates")
val templateDst = layout.buildDirectory.dir("generated/templates")
val templateProps = mapOf(
"LIBRARY_NAME" to rootProject.name,
)
tasks {
test {
useJUnitPlatform()
}
val generateTemplates = register<Copy>("generateTemplates") {
from(templateSrc)
into(templateDst)
expand(templateProps)
inputs.dir(templateSrc)
inputs.properties(templateProps)
outputs.dir(templateDst)
}
withType<Jar> {
dependsOn(generateTemplates)
}
compileKotlin {
dependsOn("generateTemplates")
}
}
kotlin {
compilerOptions {
freeCompilerArgs.add("-Xcontext-receivers")
jvmTarget = JvmTarget.JVM_11
}
jvmToolchain(11)
}
sourceSets.main {
kotlin {
srcDir(templateDst)
}
}
java {
withSourcesJar()
withJavadocJar()
}
allprojects {
apply<MavenPublishPlugin>()
apply<BasePlugin>()
group = "dev.silenium.compose.av"
version = findProperty("deploy.version") as String? ?: "0.0.0-SNAPSHOT"
repositories {
maven("https://reposilite.silenium.dev/releases")
mavenCentral()
google()
}
publishing {
repositories {
val url = System.getenv("MAVEN_REPO_URL") ?: return@repositories
maven(url) {
name = "reposilite"
credentials {
username = System.getenv("MAVEN_REPO_USERNAME") ?: ""
password = System.getenv("MAVEN_REPO_PASSWORD") ?: ""
}
}
}
}
}
publishing {
publications {
if (deployKotlin) {
create<MavenPublication>("main") {
from(components["java"])
}
}
}
}
rootProject.idea.project {
this as ExtensionAware
configure<ProjectSettings> {
this as ExtensionAware
configure<TaskTriggersConfig> {
afterSync("generateTemplates")
}
}
}