-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
230 lines (204 loc) · 7.67 KB
/
build.gradle
File metadata and controls
230 lines (204 loc) · 7.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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
/*
* HoloUI is a holographic user interface for Minecraft Bukkit Servers
* Copyright (c) 2025 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import org.gradle.api.tasks.Copy
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.jvm.toolchain.JavaLanguageVersion
plugins {
id 'java-library'
alias(libs.plugins.lombok)
alias(libs.plugins.shadow)
alias(libs.plugins.slimjar)
}
group = 'art.arcane'
version = '1.0.0-1.21.11'
def apiVersion = '1.21'
def main = 'art.arcane.holoui.HoloUI'
def lib = 'art.arcane.holoui.libs'
String volmLibCoordinate = providers.gradleProperty('volmLibCoordinate')
.orElse('com.github.VolmitSoftware:VolmLib:master-SNAPSHOT')
.get()
def shadowJarTask = tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar)
// ADD YOURSELF AS A NEW LINE IF YOU WANT YOUR OWN BUILD TASK GENERATED
// ======================== WINDOWS =============================
registerCustomOutputTask(
'Cyberpwn',
'C://Users/cyberpwn/Documents/development/server/plugins'
)
registerCustomOutputTask(
'Psycho',
'C://Dan/MinecraftDevelopment/Server/plugins'
)
registerCustomOutputTask(
'ArcaneArts',
'C://Users/arcane/Documents/development/server/plugins'
)
registerCustomOutputTask('Vatuu', 'D://Minecraft/Servers/1.20/plugins')
registerCustomOutputTask('Nowhere', 'E://Desktop/server/plugins')
registerCustomOutputTask(
'CrazyDev22',
'C://Users/Julian/Desktop/server/plugins'
)
registerCustomOutputTask(
'Pixel',
'D://Iris Dimension Engine//1.20.4 - Development//plugins'
)
// ========================== UNIX ==============================
registerCustomOutputTaskUnix(
'CyberpwnLT',
'/Users/danielmills/development/server/plugins'
)
registerCustomOutputTaskUnix(
'PsychoLT',
'/Users/brianfopiano/Developer/RemoteGit/[Minecraft Server]/consumers/plugin-consumers/dropins/plugins'
)
registerCustomOutputTaskUnix(
'the456gamer',
'/home/the456gamer/projects/minecraft/adapt-testserver/plugins/update/',
false
)
// ==============================================================
tasks.named('jar').configure {
enabled = false
}
tasks.named('build').configure {
dependsOn(shadowJarTask)
}
tasks.named('compileJava', JavaCompile).configure {
options.compilerArgs.add('-parameters')
options.encoding = 'UTF-8'
options.release.set(21)
}
shadowJarTask.configure {
archiveClassifier.set('')
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
minimize()
relocate('io.github.slimjar', "${lib}.slimjar")
relocate('com.github.retrooper.packetevents', "${lib}.packetevents.api")
relocate('io.github.retrooper.packetevents', "${lib}.packetevents.impl")
relocate('org.bstats', "${lib}.bstats")
}
tasks.named('processResources').configure {
def pluginProperties = [
name : rootProject.name,
version : project.version,
main : main,
apiVersion: apiVersion,
]
inputs.properties(pluginProperties)
filesMatching('**/plugin.yml') {
expand(pluginProperties)
}
}
slimJar {
relocate('com.github.retrooper.packetevents', "${lib}.packetevents.api")
relocate('io.github.retrooper.packetevents', "${lib}.packetevents.impl")
relocate('org.bstats', "${lib}.bstats")
relocate('org.apache.commons', "${lib}.commons")
relocate('com.github.zafarkhaja.semver', "${lib}.semver")
relocate('io.undertow', "${lib}.undertow")
relocate('org.jboss', "${lib}.jboss")
relocate('org.xnio', "${lib}.xnio")
relocate('org.wildfly', "${lib}.wildfly")
relocate('net.kyori', "${lib}.kyori")
}
repositories {
mavenCentral()
maven { url = uri('https://libraries.minecraft.net/') }
maven { url = uri('https://hub.spigotmc.org/nexus/content/repositories/snapshots/') }
maven { url = uri('https://repo.papermc.io/repository/maven-public/') }
maven { url = uri('https://repo.extendedclip.com/releases/') }
maven { url = uri('https://repo.codemc.io/repository/maven-releases/') }
maven { url = uri('https://repo.aikar.co/content/groups/aikar/') }
maven { url = uri('https://jitpack.io') }
}
dependencies {
implementation('de.crazydev22.slimjar.helper:spigot:2.1.8')
implementation(volmLibCoordinate) {
changing = true
transitive = false
}
compileOnly(libs.lombok)
annotationProcessor(libs.lombok)
compileOnly(libs.spigot)
compileOnly(libs.placeholderApi)
// Shaded
slim(libs.packetevents) {
exclude(group: 'net.kyori')
}
slim('org.bstats:bstats-bukkit:3.1.0')
// Dynamically loaded
slim(libs.adventure.minimessage)
slim(libs.adventure.nbt)
slim(libs.undertow)
slim(libs.semver)
slim(libs.commons.io)
slim(libs.commons.imaging)
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
configurations.configureEach {
resolutionStrategy.cacheChangingModulesFor(0, 'seconds')
resolutionStrategy.cacheDynamicVersionsFor(0, 'seconds')
}
if (!JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_21)) {
System.err.println()
System.err.println('=========================================================================================================')
System.err.println('You must run gradle on Java 21 or newer. You are using ' + JavaVersion.current())
System.err.println()
System.err.println('=== For IDEs ===')
System.err.println('1. Configure the project for Java 21')
System.err.println('2. Configure the bundled gradle to use Java 21 in settings')
System.err.println()
System.err.println('=== For Command Line (gradlew) ===')
System.err.println('1. Install JDK 21 from https://www.oracle.com/java/technologies/downloads/#java21')
System.err.println('2. Set JAVA_HOME environment variable to the new jdk installation folder')
System.err.println('3. Open a new command prompt window to get the new environment variables if need be.')
System.err.println('=========================================================================================================')
System.err.println()
System.exit(69)
}
// IDE Server stuff
void registerCustomOutputTask(String name, String path, boolean doRename = true) {
if (!System.getProperty('os.name').toLowerCase().contains('windows')) {
return
}
createOutputTask(name, path, doRename)
}
void registerCustomOutputTaskUnix(String name, String path, boolean doRename = true) {
if (System.getProperty('os.name').toLowerCase().contains('windows')) {
return
}
createOutputTask(name, path, doRename)
}
void createOutputTask(String name, String path, boolean doRename = true) {
def shadowJarTask = tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar)
tasks.register("build${name}", Copy) {
group = 'development'
outputs.upToDateWhen { false }
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
dependsOn(shadowJarTask)
from(shadowJarTask.flatMap { it.archiveFile })
into(file(path))
if (doRename) {
rename { String ignored -> 'HoloUi.jar' }
}
}
}