-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
build.gradle.kts
100 lines (85 loc) · 4.02 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
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.jetbrains.kotlin.plugin.serialization")
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(":catalyst-proxy"))
}
tasks {
shadowJar {
archiveFileName = "catalyst-${project.version}.jar"
mergeServiceFiles()
exclude("org/intellij/**")
exclude("org/slf4j/**")
exclude("kotlin/**") // external kotlin dependency
relocate("org.anvilpowered.anvil", "org.anvilpowered.catalyst.relocated.anvil")
relocate("org.anvilpowered.kbrig", "org.anvilpowered.catalyst.relocated.kbrig")
relocate("org.jetbrains", "org.anvilpowered.catalyst.relocated.jetbrains")
relocate("kotlinx", "org.anvilpowered.catalyst.relocated.kotlinx")
relocate("org.koin", "org.anvilpowered.catalyst.relocated.koin")
relocate("co.touchlab.stately", "org.anvilpowered.catalyst.relocated.stately")
relocate("org.mariadb", "org.anvilpowered.catalyst.relocated.mariadb")
relocate("org.checkerframework", "org.anvilpowered.catalyst.relocated.checkerframework")
relocate("waffle", "org.anvilpowered.catalyst.relocated.waffle")
relocate("com.github.benmanes.caffeine", "org.anvilpowered.catalyst.relocated.caffeine")
relocate("com.google.errorprone", "org.anvilpowered.catalyst.relocated.errorprone")
relocate("com.sun.jna", "org.anvilpowered.catalyst.relocated.jna")
relocate("net.dv8tion", "org.anvilpowered.catalyst.relocated.dv8tion")
relocate("com.fasterxml.jackson", "org.anvilpowered.catalyst.relocated.jackson")
relocate("org.json", "org.anvilpowered.catalyst.relocated.json")
relocate("net.sf.trove4j", "org.anvilpowered.catalyst.relocated.trove4j")
relocate("com.neovisionaries", "org.anvilpowered.catalyst.relocated.neovisionaries")
relocate("okhttp3", "org.anvilpowered.catalyst.relocated.okhttp3")
relocate("okio", "org.anvilpowered.catalyst.relocated.okio")
relocate("gnu.trove", "org.anvilpowered.catalyst.relocated.trove")
relocate("club.minnced", "org.anvilpowered.catalyst.relocated.minnced")
relocate("tomp2p", "org.anvilpowered.catalyst.relocated.tomp2p")
relocate("com.iwebpp", "org.anvilpowered.catalyst.relocated.iwebpp")
relocate("org.apache.commons", "org.anvilpowered.catalyst.relocated.apache.commons")
relocate("org.postgresql", "org.anvilpowered.catalyst.relocated.postgresql")
relocate("org.spongepowered", "org.anvilpowered.catalyst.relocated.spongepowered")
relocate("io.leangen.geantyref", "org.anvilpowered.catalyst.relocated.geantyref")
}
}