-
Notifications
You must be signed in to change notification settings - Fork 59
/
build.gradle
281 lines (248 loc) · 10.5 KB
/
build.gradle
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
/*
* Adapt is Copyright (c) 2021 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/>.
*/
plugins {
id 'java'
id 'java-library'
id "io.freefair.lombok" version "6.3.0"
id "com.github.johnrengelman.shadow" version "7.1.2"
}
version '1.16.0-1.19.2-1.21.3'
def apiVersion = '1.19'
def name = getRootProject().getName() // Defined in settings.gradle
def main = 'com.volmit.adapt.Adapt'
def manifoldVersion = '2024.1.37'
// 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/Server/plugins')
registerCustomOutputTaskUnix('the456gamer', '/home/the456gamer/projects/minecraft/adapt-testserver/plugins/update/', false)
// ==============================================================
def VERSIONS = Map.of(
"v1_21_2", "1.21.2-R0.1-SNAPSHOT",
"v1_21", "1.21-R0.1-SNAPSHOT",
"v1_20_5", "1.20.5-R0.1-SNAPSHOT",
"v1_20_4", "1.20.4-R0.1-SNAPSHOT",
"v1_19_2", "1.19.2-R0.1-SNAPSHOT"
)
VERSIONS.each {
def key = it.key
def value = it.value
project(":version:${key}") {
apply plugin: 'java'
apply plugin: 'java-library'
dependencies {
implementation rootProject
compileOnly "org.spigotmc:spigot-api:${value}"
}
}
}
/**
* Gradle is weird sometimes, we need to delete the plugin yml from the build folder to actually filter properly.
*/
file(jar.archiveFile.get().getAsFile().getParentFile().getParentFile().getParentFile().getAbsolutePath() + '/build/resources/main/plugin.yml').delete()
/**
* Expand properties into plugin yml
*/
processResources {
filesMatching('**/plugin.yml') {
expand(
'name': name.toString(),
'version': version.toString(),
'main': main.toString(),
'apiversion': apiVersion.toString()
)
}
}
allprojects {
apply plugin: 'java'
apply plugin: 'java-library'
repositories {
mavenCentral()
maven { url "https://repo.papermc.io/repository/maven-public/"}
maven { url "https://repo.codemc.org/repository/maven-public" }
maven { url "https://mvn.lumine.io/repository/maven-public/" }
maven { url "https://nexus.frengor.com/repository/public/"}
maven { url 'https://repo.extendedclip.com/content/repositories/placeholderapi/' }
maven { url "https://repo.glaremasters.me/repository/bloodshot/" }
maven { url "https://maven.enginehub.org/repo/" }
maven { url "https://repo.oraxen.com/releases" }
maven { url 'https://jitpack.io' }
}
/**
* We need parameter meta for the decree command system
*/
compileJava {
options.compilerArgs << '-parameters'
}
dependencies {
// Provided or Classpath
compileOnly 'org.projectlombok:lombok:1.18.24'
annotationProcessor 'org.projectlombok:lombok:1.18.24'
// Cancer
implementation 'com.github.VolmitDev:Fukkit:23.6.1'
implementation 'com.github.VolmitDev:Amulet:23.5.1'
implementation 'com.github.VolmitDev:Chrono:22.9.10'
implementation 'com.github.VolmitDev:Spatial:22.11.1'
implementation "io.papermc:paperlib:1.0.7"
implementation 'com.github.ben-manes.caffeine:caffeine:3.0.6'
annotationProcessor 'systems.manifold:manifold-ext:' + manifoldVersion
testAnnotationProcessor 'systems.manifold:manifold-ext:' + manifoldVersion
implementation 'systems.manifold:manifold-rt:' + manifoldVersion
//Random Api's
compileOnly 'com.github.DeadSilenceIV:AdvancedChestsAPI:2.9-BETA'
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.8'
compileOnly "com.github.FrancoBM12:API-MagicCosmetics:2.2.8"
compileOnly 'me.clip:placeholderapi:2.11.6'
compileOnly 'com.github.LoneDev6:api-itemsadder:3.2.5'
compileOnly 'io.th0rgal:oraxen:1.182.0'
compileOnly 'com.massivecraft:Factions:1.6.9.5-U0.6.21'
compileOnly "com.github.angeschossen:ChestProtectAPI:3.9.1"
compileOnly "com.github.TechFortress:GriefPrevention:16.18.1"
implementation 'xyz.xenondevs:particle:1.8.1'
implementation "com.frengor:ultimateadvancementapi-shadeable:2.4.2"
compileOnly 'com.griefdefender:api:2.1.0-SNAPSHOT'
compileOnly 'io.netty:netty-all:4.1.68.Final'
// Dynamically Loaded
compileOnly 'com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4.2'
compileOnly 'org.apache.commons:commons-lang3:3.12.0'
compileOnly 'com.google.code.gson:gson:2.10'
compileOnly 'com.elmakers.mine.bukkit:EffectLib:9.4'
compileOnly 'net.kyori:adventure-text-minimessage:4.17.0'
compileOnly 'net.kyori:adventure-platform-bukkit:4.3.4'
compileOnly 'it.unimi.dsi:fastutil:8.5.13'
compileOnly "fr.skytasul:glowingentities:1.4.1"
implementation 'com.google.guava:guava:30.1-jre'
compileOnly fileTree(dir: 'libs', include: ['*.jar'])
}
}
/**
* Configure Adapt for shading
*/
shadowJar {
// minimize()
VERSIONS.each {
dependsOn(":version:${it.key}:build")
from(project(":version:${it.key}").layout.buildDirectory.file("libs/${it.key}.jar").get())
}
append("plugin.yml")
relocate 'manifold', 'com.volmit.adapt.util.manifold'
relocate 'art.arcane', 'com.volmit.adapt.util.arcane'
relocate 'Fukkit.extensions', 'com.volmit.adapt.util.extensions'
relocate 'Amulet.extensions', 'com.volmit.adapt.util.extensions'
relocate 'com.fren_gor.ultimateAdvancementAPI', 'com.volmit.adapt.util.advancements'
dependencies {
include(dependency('systems.manifold:'))
include(dependency('xyz.xenondevs:'))
include(dependency('com.github.VolmitDev:'))
include(dependency('com.frengor:ultimateadvancementapi-shadeable:'))
}
}
configurations.configureEach {
resolutionStrategy.cacheChangingModulesFor 60, 'minutes'
resolutionStrategy.cacheDynamicVersionsFor 60, 'minutes'
}
dependencies {
implementation 'org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT'
}
if (JavaVersion.current().toString() != "17") {
System.err.println()
System.err.println("=========================================================================================================")
System.err.println("You must run gradle on Java 17. You are using " + JavaVersion.current())
System.err.println()
System.err.println("=== For IDEs ===")
System.err.println("1. Configure the project for Java 17")
System.err.println("2. Configure the bundled gradle to use Java 17 in settings")
System.err.println()
System.err.println("=== For Command Line (gradlew) ===")
System.err.println("1. Install JDK 17 from https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html")
System.err.println("2. Set JAVA_HOME environment variable to the new jdk installation folder such as C:/Program Files/Java/jdk-17.0.1")
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)
}
def buildDir = layout.buildDirectory.asFile.get()
def outputJar = new File(buildDir, "libs/Adapt-" + version + "-all.jar")
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
compileJava {
options.encoding = "UTF-8"
}
tasks.build.dependsOn(shadowJar)
task adapt(type: Copy)
{
group "adapt"
from outputJar
into buildDir
rename { String fileName ->
fileName.replace(outputJar.getName(), "Adapt-" + version + ".jar")
}
dependsOn(build)
}
def registerCustomOutputTask(name, path) {
if (!System.properties['os.name'].toLowerCase().contains('windows')) {
return
}
tasks.register('build' + name, Copy) {
group('development')
outputs.upToDateWhen { false }
dependsOn(adapt)
from(new File(buildDir, "Adapt-" + version + ".jar"))
into(file(path))
rename { String fileName ->
fileName.replace("Adapt-" + version + ".jar", "Adapt.jar")
}
}
}
def registerCustomOutputTaskUnix(name, path, doRename=true) {
if (System.properties['os.name'].toLowerCase().contains('windows')) {
return
}
tasks.register('build' + name, Copy) {
group('development')
outputs.upToDateWhen { false }
dependsOn(adapt)
from(new File(buildDir, "Adapt-" + version + ".jar"))
into(file(path))
if (doRename) {
rename { String fileName ->
fileName.replace("Adapt-" + version + ".jar", "Adapt.jar")
}
}
}
}
if (JavaVersion.current() != JavaVersion.VERSION_1_8 &&
sourceSets.main.allJava.files.any { it.name == "module-info.java" }) {
tasks.withType(JavaCompile) {
options.compilerArgs += ['-Xplugin:Manifold', '--module-path', it.classpath.asPath]
}
} else {
tasks.withType(JavaCompile) {
options.compilerArgs += ['-Xplugin:Manifold']
}
}