-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle.kts
87 lines (73 loc) · 3.03 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
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import java.io.ByteArrayOutputStream
plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.ktlint)
alias(libs.plugins.shadow)
alias(libs.plugins.kotlin.serialization)
}
val projectVersion: String = run {
val rawVersion = file("version").readLines().first()
if (project.hasProperty("rawVersion")) {
rawVersion
} else {
val branch = System.getenv("VCS_BRANCH")?.replace('/', '-') ?: "unknown-branch"
System.getenv("BUILD_NUMBER")?.let { buildNumber ->
val gitRev = ByteArrayOutputStream()
exec {
commandLine("git", "rev-parse", "--short", "HEAD")
standardOutput = gitRev
}.assertNormalExitValue()
rawVersion.replace("SNAPSHOT", "BETA$buildNumber-$branch-${gitRev.toString().trim()}")
} ?: rawVersion
}
}
logger.warn("Resolved project version $projectVersion")
allprojects {
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "org.jlleitschuh.gradle.ktlint")
apply(plugin = "java-library")
group = "org.anvilpowered"
version = projectVersion
kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_21
freeCompilerArgs = listOf(
"-opt-in=kotlin.RequiresOptIn",
"-Xcontext-receivers",
)
}
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
}
}
// for uber jar
dependencies {
runtimeOnly(project(":ontime-paper"))
runtimeOnly(project(":ontime-velocity"))
}
tasks {
shadowJar {
archiveFileName = "ontime-${project.version}.jar"
mergeServiceFiles()
exclude("org/intellij/**")
exclude("org/slf4j/**")
exclude("kotlin/**") // external kotlin dependency
relocate("org.anvilpowered.anvil", "org.anvilpowered.ontime.relocated.anvil")
relocate("org.anvilpowered.kbrig", "org.anvilpowered.ontime.relocated.kbrig")
relocate("org.jetbrains", "org.anvilpowered.ontime.relocated.jetbrains")
relocate("kotlinx", "org.anvilpowered.ontime.relocated.kotlinx")
relocate("org.koin", "org.anvilpowered.ontime.relocated.koin")
relocate("co.touchlab.stately", "org.anvilpowered.ontime.relocated.stately")
relocate("org.mariadb", "org.anvilpowered.ontime.relocated.mariadb")
relocate("org.checkerframework", "org.anvilpowered.ontime.relocated.checkerframework")
relocate("waffle", "org.anvilpowered.ontime.relocated.waffle")
relocate("com.github.benmanes.caffeine", "org.anvilpowered.ontime.relocated.caffeine")
relocate("com.google.errorprone", "org.anvilpowered.ontime.relocated.errorprone")
relocate("com.sun.jna", "org.anvilpowered.ontime.relocated.jna")
relocate("org.postgresql", "org.anvilpowered.ontime.relocated.postgresql")
relocate("org.spongepowered", "org.anvilpowered.ontime.relocated.spongepowered")
relocate("io.leangen.geantyref", "org.anvilpowered.ontime.relocated.geantyref")
}
}