forked from lavalink-devs/Lavalink
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
61 lines (52 loc) · 1.92 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
import org.ajoberstar.grgit.Grgit
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.jetbrains.dokka") version "1.8.20" apply false
id("com.gorylenko.gradle-git-properties") version "2.4.1"
id("org.ajoberstar.grgit") version "5.2.0"
id("org.springframework.boot") version "3.1.0" apply false
id("org.sonarqube") version "4.2.0.3129"
id("com.adarshr.test-logger") version "3.2.0"
id("org.jetbrains.kotlin.jvm") version "1.8.22"
id("org.jetbrains.kotlin.plugin.allopen") version "1.8.22"
id("org.jetbrains.kotlin.plugin.serialization") version "1.8.22" apply false
}
allprojects {
group = "lavalink"
version = versionFromTag()
repositories {
mavenCentral() // main maven repo
mavenLocal() // useful for developing
maven("https://m2.dv8tion.net/releases")
maven("https://maven.arbjerg.dev/releases")
jcenter()
maven("https://jitpack.io") // build projects directly from GitHub
}
}
subprojects {
if (project.hasProperty("includeAnalysis")) {
project.logger.lifecycle("applying analysis plugins")
apply(from = "../analysis.gradle")
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "17"
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.compilerArgs.add("-Xlint:unchecked")
options.compilerArgs.add("-Xlint:deprecation")
}
}
@SuppressWarnings("GrMethodMayBeStatic")
fun versionFromTag(): String {
Grgit.open(mapOf("currentDir" to project.rootDir)).use { git ->
val headTag = git.tag
.list()
.find { it.commit.id == git.head().id }
val clean = git.status().isClean || System.getenv("CI") != null
if (!clean) {
println("Git state is dirty, setting version as snapshot.")
}
return if (headTag != null && clean) headTag.name else "${git.head().id}-SNAPSHOT"
}
}