-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
210 lines (180 loc) · 6.67 KB
/
build.gradle.kts
File metadata and controls
210 lines (180 loc) · 6.67 KB
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
import groovy.lang.Closure
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import com.palantir.gradle.gitversion.VersionDetails
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.language.jvm.tasks.ProcessResources
import xyz.jpenilla.runpaper.task.RunServer
import xyz.jpenilla.runwaterfall.task.RunWaterfall
import xyz.jpenilla.runvelocity.task.RunVelocity
val PLUGIN_NAME = "OriginBlacklist"
val PLUGIN_IDEN = "originblacklist"
val PLUGIN_DOMN = "xyz.webmc.$PLUGIN_IDEN"
val PLUGIN_DESC = "An eaglercraft client blacklist plugin."
val PLUGIN_VERS = "2.0.9"
val PLUGIN_SITE = "https://github.com/WebMCDevelopment/$PLUGIN_IDEN"
val PLUGIN_DEPA = listOf("EaglercraftXServer")
val PLUGIN_DEPB = listOf("EaglercraftXServer")
val PLUGIN_DEPC = listOf("eaglerxserver")
val PLUGIN_SDPA = listOf("PlaceholderAPI")
val PLUGIN_SDPB = listOf("PAPIProxyBridge")
val PLUGIN_SDPC = listOf("papiproxybridge")
val PLUGIN_PROV = emptyList<String>()
val PLUGIN_ATHR = listOf("Colbster937")
val PLUGIN_CTBR = emptyList<String>()
val PLUGIN_DEPA_J = getBukkitBungeeDeps(PLUGIN_DEPA)
val PLUGIN_DEPB_J = getBukkitBungeeDeps(PLUGIN_DEPB)
val PLUGIN_DEPC_J = getVelocityDeps(PLUGIN_DEPC, PLUGIN_SDPC)
val PLUGIN_SDPA_J = getBukkitBungeeDeps(PLUGIN_SDPA)
val PLUGIN_SDPB_J = getBukkitBungeeDeps(PLUGIN_SDPB)
val PLUGIN_PROV_J = getBukkitBungeeDeps(PLUGIN_PROV)
val PLUGIN_ATHR_J = getBukkitBungeeDeps(PLUGIN_ATHR)
val PLUGIN_CTBR_J = getBukkitBungeeDeps(PLUGIN_CTBR)
val EAGXS_VER = "1.0.8"
plugins {
id("java")
id("com.gradleup.shadow") version "9.4.1"
id("com.palantir.git-version") version "4.2.0"
id("xyz.jpenilla.run-paper") version "3.0.2"
id("xyz.jpenilla.run-waterfall") version "3.0.2"
id("xyz.jpenilla.run-velocity") version "3.0.2"
}
@Suppress("UNCHECKED_CAST")
val GIT_INFO = (extra["versionDetails"] as Closure<VersionDetails>)()
repositories {
mavenCentral()
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://oss.sonatype.org/content/groups/public/")
maven("https://hub.spigotmc.org/nexus/content/repositories/public/")
maven("https://repo.md-5.net/content/repositories/releases/")
maven("https://repo.aikar.co/nexus/content/groups/aikar/")
maven("https://repo.lax1dude.net/repository/releases/")
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
maven("https://repo.william278.net/releases/")
}
dependencies {
compileOnly("com.velocitypowered:velocity-api:3.5.0-SNAPSHOT")
compileOnly("org.bukkit:bukkit:1.8-R0.1-SNAPSHOT")
compileOnly("net.md-5:bungeecord-api:1.21-R0.5-SNAPSHOT")
compileOnly("net.lax1dude.eaglercraft.backend:api-velocity:1.0.0")
compileOnly("net.lax1dude.eaglercraft.backend:api-bungee:1.0.0")
compileOnly("net.lax1dude.eaglercraft.backend:api-bukkit:1.0.0")
compileOnly("me.clip:placeholderapi:2.12.2")
compileOnly("net.william278:papiproxybridge:1.8.4")
implementation("org.semver4j:semver4j:6.0.0")
implementation("de.marhali:json5-java:3.0.0")
implementation("net.kyori:adventure-text-minimessage:4.26.1")
implementation("net.kyori:adventure-text-serializer-legacy:4.26.1")
implementation("com.github.seancfoley:ipaddress:5.6.2")
implementation("org.bstats:bstats-bukkit:3.2.1")
implementation("org.bstats:bstats-bungeecord:3.2.1")
implementation("org.bstats:bstats-velocity:3.2.1")
}
sourceSets {
named("main") {
java.srcDir("./src/main/java")
resources.srcDir("./src/main/resources")
}
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
}
val BUILD_PROPS = mapOf(
"plugin_name" to PLUGIN_NAME,
"plugin_iden" to PLUGIN_IDEN,
"plugin_desc" to PLUGIN_DESC,
"plugin_vers" to PLUGIN_VERS,
"plugin_site" to PLUGIN_SITE,
"plugin_depa" to PLUGIN_DEPA_J,
"plugin_depb" to PLUGIN_DEPB_J,
"plugin_depc" to PLUGIN_DEPC_J,
"plugin_sdpa" to PLUGIN_SDPA_J,
"plugin_sdpb" to PLUGIN_SDPB_J,
"plugin_prov" to PLUGIN_PROV_J,
"plugin_athr" to PLUGIN_ATHR_J,
"plugin_ctbr" to PLUGIN_CTBR_J,
"git_cm_hash" to GIT_INFO.gitHashFull,
)
tasks.named<JavaCompile>("compileJava") {
options.encoding = "UTF-8"
options.release.set(21)
}
tasks.named<ProcessResources>("processResources") {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
outputs.upToDateWhen { false }
doFirst {
filesMatching(listOf("plugin.yml", "bungee.yml", "velocity-plugin.json")) {
expand(BUILD_PROPS)
}
}
doLast {
val file = destinationDir.resolve("build.properties")
file.parentFile.mkdirs()
file.writeText(
BUILD_PROPS.entries.joinToString("\n") { (k, v) ->
"$k = $v"
}
)
}
inputs.files(tasks.named<JavaCompile>("compileJava").map { it.outputs.files })
}
tasks.named<Jar>("jar") {
enabled = false
}
tasks.named<ShadowJar>("shadowJar") {
enabled = true
doFirst {
delete(layout.buildDirectory.dir("libs"))
mkdir(layout.buildDirectory.dir("libs"))
}
relocate("inet.ipaddr", "$PLUGIN_DOMN.shaded.ipaddress")
relocate("de.marhali.json5", "$PLUGIN_DOMN.shaded.json5")
relocate("org.bstats", "$PLUGIN_DOMN.shaded.bstats")
relocate("org.semver4j.semver4j", "$PLUGIN_DOMN.shaded.semver4j")
// relocate("net.kyori.adventure", "$PLUGIN_DOMN.shaded.adventure")
archiveFileName.set("$PLUGIN_NAME-$PLUGIN_VERS.jar")
}
tasks.named("build") {
dependsOn(tasks.named("shadowJar"))
}
tasks.register("printVars") {
group = "help"
doLast {
println("VERS = " + PLUGIN_VERS)
println("AFCT = " + tasks.named("shadowJar").get().outputs.files.singleFile.name.removeSuffix(".jar"))
}
}
tasks.named<RunServer>("runServer") {
minecraftVersion("1.12.2")
runDirectory.set(layout.projectDirectory.dir("run/paper"))
jvmArgs("-Dcom.mojang.eula.agree=true")
downloadPlugins {
github("lax1dude", "eaglerxserver", "v" + EAGXS_VER, "EaglerXServer.jar")
modrinth("placeholderapi", "2.12.2")
}
}
tasks.named<RunWaterfall>("runWaterfall") {
waterfallVersion("1.21")
runDirectory.set(layout.projectDirectory.dir("run/waterfall"))
downloadPlugins {
github("lax1dude", "eaglerxserver", "v" + EAGXS_VER, "EaglerXServer.jar")
}
}
tasks.named<RunVelocity>("runVelocity") {
velocityVersion("3.5.0-SNAPSHOT")
runDirectory.set(layout.projectDirectory.dir("run/velocity"))
downloadPlugins {
github("lax1dude", "eaglerxserver", "v" + EAGXS_VER, "EaglerXServer.jar")
modrinth("miniplaceholders", "3.1.0")
}
}
fun getBukkitBungeeDeps(list: List<String>): String {
return list.joinToString(
prefix = "[",
postfix = "]"
) { "\"$it\"" }
}
fun getVelocityDeps(a: List<String>, b: List<String>): String {
val c = a.joinToString(", ") { "{\"id\":\"$it\",\"optional\":false}" }
val d = b.joinToString(", ") { "{\"id\":\"$it\",\"optional\":true}" }
return "[" + listOf(c, d).filter { it.isNotEmpty() }.joinToString(",") + "]"
}