forked from AztechMC/Modern-Industrialization
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
430 lines (379 loc) · 12.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
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
plugins {
id 'fabric-loom' version '0.12-SNAPSHOT'
id 'maven-publish'
id 'com.diffplug.spotless' version '5.14.0'
id 'com.matthewprenger.cursegradle' version '1.4.0'
id "com.modrinth.minotaur" version "1.2.1"
}
apply plugin: 'java-library'
version = System.getenv("MI_VERSION")
? System.getenv("MI_VERSION")
: "local"
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
repositories {
// for KJS
maven {
url "https://www.cursemaven.com"
content {
includeGroup "curse.maven"
}
}
// for Patchouli
maven {
url 'https://maven.blamejared.com'
}
// for WTHIT
maven {
url 'https://maven.bai.lol'
}
// for AE2
maven {
name "Modmaven"
url "https://modmaven.dev"
content {
includeGroup "appeng"
}
}
maven {
url "https://maven.shedaniel.me"
content {
includeGroup "me.sargunvohra.mcmods"
includeGroup "me.shedaniel.cloth"
includeGroup "me.shedaniel"
includeGroup "dev.architectury"
}
}
maven {
url "https://maven.terraformersmc.com"
content {
includeGroup "com.terraformersmc"
}
}
// for DashLoader
maven {
name "DashLoader"
url 'https://maven.oskarstrom.net'
content {
includeGroup "net.oskarstrom"
}
}
maven {
name 'Jitpack for MI'
url 'https://jitpack.io'
content {
includeGroup "com.github.KubeJS-Mods"
includeGroup "com.github.GabrielOlvH"
/* For Magna */
includeGroup "com.github.Technici4n"
includeGroup "com.github.Draylar.omega-config"
}
}
// to build indrev
maven {
name = "CottonMC"
url = "https://server.bbkr.space/artifactory/libs-release"
content {
includeGroup "io.github.cottonmc"
}
}
maven {
name = "dblsaiko"
url = "https://maven.dblsaiko.net/"
}
maven {
name = "Technici4n"
url = "https://raw.githubusercontent.com/Technici4n/Technici4n-maven/master/"
content {
includeGroup "net.fabricmc.fabric-api"
includeGroup "dev.technici4n"
includeGroup "dev.latvian.mods"
}
}
maven {
url "https://maven.saps.dev/minecraft"
content {
includeGroup "dev.latvian.mods"
includeGroup "dev.ftb.mods"
}
}
// for reach entity attributes, required by Magna
maven {
url = "https://maven.jamieswhiteshirt.com/libs-release/"
content {
includeGroup "com.jamieswhiteshirt"
}
}
// for PlayerAbilityLib
maven {
name = 'Ladysnake Mods'
url = 'https://ladysnake.jfrog.io/artifactory/mods'
content {
includeGroup 'io.github.ladysnake'
includeGroupByRegex 'io\\.github\\.onyxstudios.*'
}
}
maven {
url "https://maven.parchmentmc.net/"
content {
includeGroup "org.parchmentmc.data"
}
}
// for AE2
maven {
name = "Modmaven"
url = uri("https://modmaven.dev/")
content {
includeGroup("appeng")
}
}
// For the "No Indium?" mod
maven {
url = 'https://maven.cafeteria.dev/releases/'
content {
includeGroup "me.luligabi"
}
}
mavenLocal()
}
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings loom.layered() {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-1.18.2:2022.03.13@zip")
}
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
// Dependencies
modImplementation("me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
include modImplementation("vazkii.patchouli:Patchouli:${project.patchouli_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
modImplementation("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
modImplementation("mcp.mobius.waila:wthit:fabric-${project.wthit_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
modImplementation("com.terraformersmc:modmenu:${project.mod_menu_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
modCompileOnly("dev.latvian.mods:kubejs-fabric:1802.5.0-build.312") {
exclude(group: "net.fabricmc.fabric-api")
}
include modImplementation("com.github.Technici4n:magna:${project.magna_version}") {
exclude(group: "io.github.prospector")
exclude(group: "me.shedaniel.cloth")
exclude(group: "net.fabricmc.fabric-api")
}
include modApi("teamreborn:energy:${project.tr_energy_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
include modImplementation("io.github.ladysnake:PlayerAbilityLib:${project.pal_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
// Include No Indium? https://github.com/Luligabi1/NoIndium
include "me.luligabi:NoIndium:${project.no_indium_version}"
modImplementation("lol.bai.megane:megane-api:${project.megane_api_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
modRuntimeOnly("lol.bai.megane:megane-runtime:${project.megane_runtime_version}") {
exclude(group: "net.fabricmc.fabric-api")
exclude(group: "mcp.mobius.waila")
}
modRuntimeOnly("lol.bai.megane:megane-vanilla:${project.megane_vanilla_version}") {
exclude(group: "net.fabricmc.fabric-api")
exclude(group: "mcp.mobius.waila")
}
modCompileOnly('net.oskarstrom:DashLoader:2.1-dev4') {
exclude(group: "net.fabricmc.fabric-api")
}
modImplementation("appeng:appliedenergistics2-fabric:${project.ae2_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
sourceSets {
main {
java {
srcDir "src/main"
exclude "**/compat/dashloader/**"
}
resources {
srcDir "src/generated/resources"
}
}
datagen {
compileClasspath += main.compileClasspath
runtimeClasspath += main.runtimeClasspath
compileClasspath += main.output
runtimeClasspath += main.output
}
}
loom {
accessWidenerPath = file("src/main/resources/modern_industrialization.accesswidener")
runs {
autoTestServer {
server()
name = "Autotest Server"
vmArg "-Dmodern_industrialization.autoTest"
ideConfigGenerated = true
source sourceSets.main
}
datagenClient {
client()
name "Data Generation"
vmArg "-Dfabric-api.datagen"
vmArg "-Dfabric-api.datagen.output-dir=${file("src/generated/resources")}"
vmArg "-Dfabric-api.datagen.strict-validation=true"
ideConfigGenerated = true
runDir "build/datagen"
source sourceSets.datagen
}
}
}
tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"
// Minecraft 1.17 (21w19a) upwards uses Java 16.
it.options.release = 17
}
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this task, sources will not be generated.
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.allSource
}
jar {
from "LICENSE"
}
// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
// select the repositories you want to publish to
repositories {
// uncomment to publish to the local maven
// mavenLocal()
}
}
spotless {
format 'misc', {
target '*.gradle', '*.md', '.gitignore'
trimTrailingWhitespace()
indentWithSpaces()
endWithNewline()
}
java {
importOrder()
removeUnusedImports()
eclipse().configFile('eclipse-format.xml')
indentWithSpaces()
endWithNewline()
licenseHeaderFile 'LICENSE.java'
}
format 'json', {
target 'src/main/**/lang/*.json'
addStep(JsonOrderStep.create())
}
}
import com.diffplug.spotless.FormatterFunc
import com.diffplug.spotless.FormatterStep
import com.google.gson.Gson
import com.google.gson.GsonBuilder
final class JsonOrderStep {
private JsonOrderStep() {}
private static final Gson GSON = new GsonBuilder().disableHtmlEscaping().setLenient().setPrettyPrinting().create();
static FormatterStep create() {
return FormatterStep.create(
'jsonOrderStep',
new State(),
{
new FormatterFunc() {
String apply(String input) {
TreeMap<String, Object> jsonMap = GSON.fromJson(input, TreeMap.class);
String sortedJson = GSON.toJson(jsonMap);
String prettyPrinted = sortedJson.replace(' "', ' "').replace('\\u0027', '\'');
return prettyPrinted + "\n";
}
}
},
);
}
private static final class State implements Serializable {
private static final long serialVersionUID = 1L;
private final int formatVersion = 1;
}
}
def releaseChannel = "release"
def changelog = "Please visit our github repository for a changelog: https://github.com/AztechMC/Modern-Industrialization/releases."
if (version.toLowerCase().contains("alpha")) {
releaseChannel = "alpha"
changelog = "THIS IS AN ALPHA RELEASE, MAKE A BACKUP BEFORE INSTALLING AND FREQUENTLY WHILE PLAYING, AND PLEASE REPORT ANY ISSUE YOU MAY FIND ON OUR ISSUE TRACKER.\n\n" + changelog
} else if (version.toLowerCase().contains("beta")) {
releaseChannel = "beta"
changelog = "This is a beta release. It is expected to be mostly stable, but in any case please report any issue you may find.\n\n" + changelog
}
// Publishing
if (System.getenv("CURSEFORGE_API_KEY") && !version.endsWith("-SNAPSHOT")) {
curseforge {
apiKey = System.getenv().get("CURSEFORGE_API_KEY")
project {
id = project.curseforge_project
releaseType = releaseChannel
changelogType = "markdown"
delegate.changelog = changelog
addGameVersion "1.19"
addGameVersion "Fabric"
addGameVersion "Java 17"
relations {
requiredDependency "fabric-api"
requiredDependency "roughly-enough-items"
requiredDependency "cloth-config"
optionalDependency "wthit"
optionalDependency "megane"
embeddedLibrary "no-indium"
embeddedLibrary "patchouli-fabric"
embeddedLibrary "pal"
}
mainArtifact(remapJar.archiveFile) {
displayName = "Modern Industrialization v${version}"
}
}
options {
forgeGradleIntegration = false
}
afterEvaluate {
tasks.getByName("curseforge${project.curseforge_project}").dependsOn remapJar
}
}
}
import com.modrinth.minotaur.TaskModrinthUpload
task publishModrinth (type: TaskModrinthUpload){
onlyIf {
System.getenv("MODRINTH_API_KEY") && !version.endsWith("-SNAPSHOT")
}
token = System.getenv("MODRINTH_API_KEY")
projectId = project.modrinth_project
versionNumber = version
versionName = "Modern Industrialization v${version}"
delegate.changelog = changelog
versionType = releaseChannel.toUpperCase()
uploadFile = remapJar.archiveFile
addGameVersion "1.19"
addLoader "fabric"
}