-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
112 lines (92 loc) · 3.11 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
101
102
103
104
105
106
107
108
109
110
111
112
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
val baseVersion = fetchProperty("version.base", "invalid")
val betaString = fetchProperty("version.beta", "false")
val jenkinsBuildNumber = fetchEnv("BUILD_NUMBER", null, "Unofficial")
val betaBoolean = betaString.toBoolean()
val betaVersion = if (betaBoolean) "Beta-" else ""
version = "$baseVersion.$betaVersion$jenkinsBuildNumber"
fun fetchProperty(propertyName: String, defaultValue: String): String {
val found = findProperty(propertyName)
if (found != null) {
return found.toString()
}
return defaultValue
}
fun fetchEnv(envName: String, propertyName: String?, defaultValue: String): String {
val found = System.getenv(envName)
if (found != null) {
return found
}
if (propertyName != null) {
return fetchProperty(propertyName, defaultValue)
}
return defaultValue
}
plugins {
id("java")
id("com.gradleup.shadow") version "8.3.5"
}
repositories {
mavenCentral()
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
maven("https://oss.sonatype.org/content/repositories/snapshots")
maven("https://nexus.sirblobman.xyz/public/")
}
dependencies {
// Java Dependencies
compileOnly("org.jetbrains:annotations:26.0.1") // JetBrains Annotations
compileOnly("org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT") // Spigot API
// Plugin Dependencies
compileOnly("com.github.sirblobman.api:core:2.9-SNAPSHOT") // BlueSlimeCore
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}
tasks {
named<Jar>("jar") {
enabled = false
}
named<ShadowJar>("shadowJar") {
archiveBaseName.set("RespawnX")
archiveClassifier.set(null as String?)
}
withType<JavaCompile> {
options.encoding = "UTF-8"
options.compilerArgs.add("-Xlint:deprecation")
options.compilerArgs.add("-Xlint:unchecked")
}
withType<Javadoc> {
options.encoding = "UTF-8"
}
processResources {
val pluginName = fetchProperty("bukkit.plugin.name", "")
val pluginPrefix = fetchProperty("bukkit.plugin.prefix", "")
val pluginDescription = fetchProperty("bukkit.plugin.description", "")
val pluginWebsite = fetchProperty("bukkit.plugin.website", "")
val pluginMainClass = fetchProperty("bukkit.plugin.main", "")
filesMatching("plugin.yml") {
expand(
mapOf(
"pluginName" to pluginName,
"pluginPrefix" to pluginPrefix,
"pluginDescription" to pluginDescription,
"pluginWebsite" to pluginWebsite,
"pluginMainClass" to pluginMainClass,
"pluginVersion" to version
)
)
}
filesMatching("config.yml") {
expand(
mapOf(
"pluginVersion" to version
)
)
}
}
named("build") {
dependsOn("shadowJar")
}
}