-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
44 lines (35 loc) · 1.38 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
44 lines (35 loc) · 1.38 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
import java.io.ByteArrayOutputStream
defaultTasks("build")
subprojects {
apply(plugin = "java-library")
apply(plugin = "maven-publish")
group = "software.axios"
version = "1.1-SNAPSHOT"
plugins.withType<JavaPlugin> {
configure<JavaPluginExtension> {
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
}
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}
fun determinePatchVersion(): Any {
val process = ProcessBuilder("git", "describe", "--tags")
.redirectErrorStream(true)
.start()
process.waitFor()
val tagInfoString = process.inputReader().readText().trim()
if (!tagInfoString.contains('-')) return 0
return tagInfoString.split('-')[1]
}
rootProject.extra.set("majorVersion", 1)
rootProject.extra.set("minorVersion", 1)
rootProject.extra.set("patchVersion", determinePatchVersion())
rootProject.extra.set("apiVersion", rootProject.extra.get("majorVersion").toString() + "." + rootProject.extra.get("minorVersion"))
rootProject.extra.set("fullVersion", rootProject.extra.get("apiVersion").toString() + "." + rootProject.extra.get("patchVersion"))
repositories {
mavenCentral()
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://repo.codemc.org/repository/maven-public/")
}
}