-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
145 lines (126 loc) · 3.75 KB
/
build.gradle.kts
File metadata and controls
145 lines (126 loc) · 3.75 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
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
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 deployEnabled = (findProperty("deploy.enabled") as String?)?.toBoolean() ?: false
dependencies {
implementation(libs.compose.desktop.common)
implementation(libs.compose.material3)
implementation(libs.compose.material.icons.extended)
implementation(libs.androidx.annotation)
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
implementation(project(":natives"))
implementation(kotlin("reflect"))
testImplementation(compose.desktop.currentOs)
testImplementation(libs.compose.material.icons.extended)
testImplementation(libs.bundles.kotest)
testImplementation(libs.mockk)
testImplementation(libs.logback.classic)
}
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 {
jvmTarget = JvmTarget.JVM_17
}
}
sourceSets.main {
kotlin {
srcDir(templateDst)
}
}
java {
sourceCompatibility = kotlin.compilerOptions.jvmTarget.map { JavaVersion.toVersion(it.target) }.get()
targetCompatibility = sourceCompatibility
withSourcesJar()
withJavadocJar()
}
allprojects {
apply<MavenPublishPlugin>()
apply<BasePlugin>()
group = "dev.silenium.compose.av"
val gitVersionProvider = providers.gradleProperty("ci").flatMap {
if (it.toBoolean()) {
providers.exec {
commandLine("git", "describe", "--tags")
workingDir = layout.projectDirectory.asFile
}.standardOutput.asText.map(String::trim)
} else null
}
version = providers
.gradleProperty("deploy.version")
.orElse(gitVersionProvider)
.orElse("0.0.0-SNAPSHOT")
.get()
repositories {
maven("https://nexus.silenium.dev/repository/maven-releases") {
name = "nexus"
}
mavenCentral()
google()
}
publishing {
repositories {
if (deployEnabled) {
val url = findProperty("deploy.repo-url") as? String ?: error("No deploy.repo-url specified")
maven(url) {
name = "nexus"
credentials {
username = findProperty("deploy.username") as? String ?: ""
password = findProperty("deploy.password") as? String ?: ""
}
}
}
}
}
}
publishing {
publications {
create<MavenPublication>("main") {
from(components["java"])
}
}
}
rootProject.idea.project {
this as ExtensionAware
configure<ProjectSettings> {
this as ExtensionAware
configure<TaskTriggersConfig> {
afterSync("generateTemplates")
}
}
}