-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.gradle.kts
83 lines (73 loc) · 2.47 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
plugins {
id("java")
id("com.gradleup.shadow") version "9.0.0-beta4"
}
group = "com.zulfen.zulfbungee"
version = "0.9.9-pre6"
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}
repositories {
mavenCentral()
maven {
name = "skript"
url = uri("https://repo.skriptlang.org/releases")
}
maven {
name = "papermc"
url = uri("https://repo.papermc.io/repository/maven-public/")
}
maven {
name = "protocollib"
url = uri("https://repo.dmulloy2.net/repository/public/")
}
}
dependencies {
testImplementation(platform("org.junit:junit-bom:5.10.0"))
testImplementation("org.junit.jupiter:junit-jupiter")
implementation("com.zaxxer:HikariCP:6.2.1")
implementation("com.h2database:h2:2.3.232")
implementation("com.github.SkriptLang:Skript:2.9.5")
implementation("com.velocitypowered:velocity-api:3.4.0-SNAPSHOT")
compileOnly("io.github.waterfallmc:waterfall-api:1.21-R0.1-SNAPSHOT")
annotationProcessor("com.velocitypowered:velocity-api:3.4.0-SNAPSHOT")
compileOnly("io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT")
implementation("org.semver4j:semver4j:5.4.1")
compileOnly("com.comphenix.protocol:ProtocolLib:5.1.0")
}
tasks.test {
useJUnitPlatform()
}
tasks {
shadowJar {
// Fetch the short Git commit hash
val gitCommitHash: String = "git rev-parse --short HEAD".runCommand()?.trim() ?: "unknown"
// Relocate dependencies to avoid conflicts
relocate("com.zaxxer", "com.zulfen.zulfbungee.libs.zaxxer")
relocate("org.semver4j", "com.zulfen.zulfbungee.libs.semver4j")
relocate("org.h2", "com.zulfen.zulfbungee.libs.h2")
// Set the archive file name
archiveFileName.set("ZulfBungee-$version-$gitCommitHash.jar")
// Include specific dependencies if needed
dependencies {
include(dependency("com.zaxxer:HikariCP"))
include(dependency("org.semver4j:semver4j"))
include(dependency("com.h2database:h2"))
}
}
}
// Helper function to run shell commands
fun String.runCommand(): String? {
return try {
val process = ProcessBuilder(*split(" ").toTypedArray())
.directory(file("."))
.redirectOutput(ProcessBuilder.Redirect.PIPE)
.redirectError(ProcessBuilder.Redirect.PIPE)
.start()
process.inputStream.bufferedReader().readText()
} catch (e: Exception) {
null
}
}