This repository was archived by the owner on Aug 31, 2026. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathbuild.gradle
More file actions
579 lines (521 loc) · 25.2 KB
/
Copy pathbuild.gradle
File metadata and controls
579 lines (521 loc) · 25.2 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
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
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
/**
* It is advised that you do not edit anything in the build.gradle; unless you are sure of what you are doing
*/
import com.gtnewhorizons.retrofuturagradle.mcp.InjectTagsTask
import com.gtnewhorizons.retrofuturagradle.minecraft.RunMinecraftTask
import org.jetbrains.changelog.Changelog
import org.jetbrains.gradle.ext.Gradle
plugins {
id 'java'
id 'java-library'
id 'maven-publish'
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.3'
id 'com.gtnewhorizons.retrofuturagradle' version '2.0.2'
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
id 'com.modrinth.minotaur' version '2.+' apply false
id 'org.jetbrains.changelog' version '2.5.0'
}
apply from: 'gradle/scripts/helpers.gradle'
// Early Assertions
assertProperty 'mod_version'
assertProperty 'root_package'
assertProperty 'mod_id'
assertProperty 'mod_name'
assertSubProperties 'use_tags', 'tag_class_name'
assertSubProperties 'use_access_transformer', 'access_transformer_locations'
assertSubProperties 'use_mixins', 'mixin_booter_version', 'mixin_refmap'
assertSubProperties 'is_coremod', 'coremod_includes_mod', 'coremod_plugin_class_name'
assertSubProperties 'use_asset_mover', 'asset_mover_version'
setDefaultProperty 'use_modern_java_syntax', false, false
setDefaultProperty 'generate_sources_jar', true, false
setDefaultProperty 'generate_javadocs_jar', true, false
setDefaultProperty 'mapping_channel', true, 'stable'
setDefaultProperty 'mapping_version', true, '39'
setDefaultProperty 'use_dependency_at_files', true, true
setDefaultProperty 'minecraft_username', true, 'Developer'
setDefaultProperty 'extra_jvm_args', false, ''
setDefaultProperty 'extra_tweak_classes', false, ''
setDefaultProperty 'change_minecraft_sources', false, false
version = propertyString('mod_version')
group = propertyString('root_package')
base {
archivesName.set(propertyString('mod_id'))
}
tasks.decompressDecompiledSources.enabled !propertyBool('change_minecraft_sources')
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(propertyBool('use_modern_java_syntax') ? 16 : 8))
// Azul covers the most platforms for Java 8 toolchains, crucially including MacOS arm64
vendor.set(JvmVendorSpec.AZUL)
}
if (propertyBool('generate_sources_jar')) {
withSourcesJar()
}
if (propertyBool('generate_javadocs_jar')) {
withJavadocJar()
}
}
configurations {
embed
implementation.extendsFrom(embed)
}
minecraft {
mcVersion.set('1.12.2')
mcpMappingChannel.set(propertyString('mapping_channel'))
mcpMappingVersion.set(propertyString('mapping_version'))
useDependencyAccessTransformers.set(propertyBool('use_dependency_at_files'))
username.set(propertyString('minecraft_username'))
// Add any additional tweaker classes here
extraTweakClasses.addAll(propertyStringList('extra_tweak_classes'))
// Add various JVM arguments here for runtime
def args = ['-ea:' + group]
// Dev convenience: expose the /artest test-only probe command tree in runClient/runServer so the
// maintainer can diagnose a live world without a launch flag. Gated by this system property, which
// shipped jars never pass, so it stays a dev-only tool. Opt out with -Pdev_artest=false.
if ((project.findProperty('dev_artest') ?: 'true').toString().toBoolean()) {
args << '-Dadvancedrocketry.tests=true'
}
if (propertyBool('use_mixins')) {
args << '-Dmixin.hotSwap=true'
args << '-Dmixin.checks.interfaces=true'
args << '-Dmixin.debug.export=true'
}
extraRunJvmArguments.addAll(args)
extraRunJvmArguments.addAll(propertyStringList('extra_jvm_args'))
if (propertyBool('use_tags')) {
if (file('tags.properties').exists()) {
Properties props = new Properties().tap { it.load(file('tags.properties').newInputStream()); it }
if (!props.isEmpty()) {
injectedTags.set(props.collectEntries { k, v -> [(k): interpolate(v)] })
}
}
}
}
repositories {
maven {
name 'CleanroomMC Maven'
url 'https://maven.cleanroommc.com'
}
}
dependencies {
if (propertyBool('use_modern_java_syntax')) {
annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.0'
// Workaround for https://github.com/bsideup/jabel/issues/174
annotationProcessor 'net.java.dev.jna:jna-platform:5.13.0'
compileOnly ('com.github.bsideup.jabel:jabel-javac-plugin:1.0.0') {
transitive = false
}
// Allow jdk.unsupported classes like sun.misc.Unsafe, workaround for JDK-8206937 and fixes crashes in tests
patchedMinecraft 'me.eigenraven.java8unsupported:java-8-unsupported-shim:1.0.0'
// Include for tests
testAnnotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.0'
testCompileOnly('com.github.bsideup.jabel:jabel-javac-plugin:1.0.0') {
transitive = false // We only care about the 1 annotation class
}
}
if (propertyBool('use_asset_mover')) {
implementation "com.cleanroommc:assetmover:${propertyString('asset_mover_version')}"
}
if (propertyBool('use_mixins')) {
String mixin = modUtils.enableMixins("zone.rong:mixinbooter:${propertyString('mixin_booter_version')}", propertyString('mixin_refmap'))
api (mixin) {
transitive = false
}
annotationProcessor 'org.ow2.asm:asm-debug-all:5.2'
annotationProcessor 'com.google.guava:guava:32.1.2-jre'
annotationProcessor 'com.google.code.gson:gson:2.8.9'
annotationProcessor (mixin) {
transitive = false
}
}
if (propertyBool('enable_junit_testing')) {
testImplementation 'junit:junit:4.13.2'
}
}
if (propertyBool('enable_junit_testing')) {
// The Forge 1.12.2 test framework is vendored as a git subtree under
// testframework/ (see testframework/TEST_FRAMEWORK.md) and compiled as
// part of the test source set, against the same RFG-patched MCP-named MC
// classes the tests link against. This replaces the published
// com.github.stannismod.forge:forge-test-framework:<ver>:dev artifact and
// its clone-sibling + publishToMavenLocal setup step. The external repo
// (github.com/StannisMod/ForgeTestFramework) lives on for other consumers.
sourceSets.test.java.srcDir 'testframework/src/main/java'
}
// Valkyrien Skies physics engine — vendored as a git subtree under valkyrienskies/
// and compiled into the main source set. VS is a mandatory part of the mod: its
// classes (org.valkyrienskies.*) ship inside AR. Its mixins/AT are registered
// alongside AR's own; its former shaded libraries are declared as ordinary
// dependencies (see gradle/scripts/dependencies.gradle).
sourceSets.main.java.srcDir 'valkyrienskies/src/main/java'
sourceSets.main.resources.srcDir 'valkyrienskies/src/main/resources'
// Advanced Force Field System — vendored under affs/ and compiled into the main
// source set as AR's shield subsystem. Its classes (com.github.stannismod.affs.*)
// ship inside AR; it is no longer a separate @Mod (folded into AR's mod container),
// its access-transformer entries are merged into advancedrocketry_at.cfg, and it
// keeps its own registry domain (affs:). See affs/LICENSE.
sourceSets.main.java.srcDir 'affs/src/main/java'
sourceSets.main.resources.srcDir 'affs/src/main/resources'
apply from: 'gradle/scripts/dependencies.gradle'
// Adds Access Transformer files to tasks
if (propertyBool('use_access_transformer')) {
for (def location : propertyStringList('access_transformer_locations')) {
def fileLocation = file("${projectDir}/src/main/resources/${location}")
if (fileLocation.exists()) {
tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(fileLocation)
tasks.srgifyBinpatchedJar.accessTransformerFiles.from(fileLocation)
} else {
throw new GradleException("Access Transformer file [$fileLocation] does not exist!")
}
}
}
processResources {
inputs.property 'mod_id', propertyString('mod_id')
inputs.property 'mod_name', propertyString('mod_name')
inputs.property 'mod_version', propertyString('mod_version')
inputs.property 'mod_description', propertyString('mod_description')
inputs.property 'mod_authors', "${propertyStringList('mod_authors', ',').join(', ')}"
inputs.property 'mod_credits', propertyString('mod_credits')
inputs.property 'mod_url', propertyString('mod_url')
inputs.property 'mod_update_json', propertyString('mod_update_json')
inputs.property 'mod_logo_path', propertyString('mod_logo_path')
inputs.property 'mixin_refmap', propertyString('mixin_refmap')
inputs.property 'mixin_package', propertyString('mixin_package')
inputs.property 'mixin_configs', propertyStringList('mixin_configs').join(' ')
def filterList = ['mcmod.info', 'pack.mcmeta']
filterList.addAll(propertyStringList('mixin_configs').collect(config -> "mixins.${config}.json" as String))
filesMatching(filterList) { fcd ->
fcd.expand(
'mod_id': propertyString('mod_id'),
'mod_name': propertyString('mod_name'),
'mod_version': propertyString('mod_version'),
'mod_description': propertyString('mod_description'),
'mod_authors': "${propertyStringList('mod_authors', ',').join(', ')}",
'mod_credits': propertyString('mod_credits'),
'mod_url': propertyString('mod_url'),
'mod_update_json': propertyString('mod_update_json'),
'mod_logo_path': propertyString('mod_logo_path'),
'mixin_refmap': propertyString('mixin_refmap'),
'mixin_package': propertyString('mixin_package')
)
}
if (propertyBool('use_access_transformer')) {
rename '(.+_at.cfg)', 'META-INF/$1'
}
}
jar {
manifest {
def attribute_map = [:]
if (propertyBool('is_coremod')) {
attribute_map['FMLCorePlugin'] = propertyString('coremod_plugin_class_name')
if (propertyBool('coremod_includes_mod')) {
attribute_map['FMLCorePluginContainsFMLMod'] = true
def currentTasks = gradle.startParameter.taskNames
if (currentTasks[0] == 'build' || currentTasks[0] == 'prepareObfModsFolder' || currentTasks[0] == 'runObfClient') {
attribute_map['ForceLoadAsMod'] = true
}
}
}
if (propertyBool('use_access_transformer')) {
attribute_map['FMLAT'] = propertyString('access_transformer_locations')
}
attributes(attribute_map)
}
// Add all embedded dependencies into the jar
from(provider{ configurations.embed.collect {it.isDirectory() ? it : zipTree(it)} })
}
idea {
module {
inheritOutputDirs = true
}
project {
settings {
runConfigurations {
"1. Run Client"(Gradle) {
taskNames = ["runClient"]
}
"2. Run Server"(Gradle) {
taskNames = ["runServer"]
}
"3. Run Obfuscated Client"(Gradle) {
taskNames = ["runObfClient"]
}
"4. Run Obfuscated Server"(Gradle) {
taskNames = ["runObfServer"]
}
}
compiler.javac {
afterEvaluate {
javacAdditionalOptions = "-encoding utf8"
moduleJavacAdditionalOptions = [
(project.name + ".main"): tasks.compileJava.options.compilerArgs.collect { '"' + it + '"' }.join(' ')
]
}
}
}
}
}
compileTestJava {
sourceCompatibility = targetCompatibility = 8
}
// ─── Test task topology (headless layers) ───────────────────────────────────
//
// Test TYPE is selected by DIRECTORY. Two harness-free JUnit 4 layers are wired:
// ./gradlew testUnit → pure unit (fast, no harness)
// ./gradlew testIntegration → MC-bootstrap integ. (fast, no harness)
// ./gradlew test → both of the above (umbrella)
//
// The harness layers are wired further down, off configureHarnessTest:
// ./gradlew testServer → dedicated-server scenario e2e
// ./gradlew testClient → real client + server e2e
// ./gradlew testMilestone → one full playable loop on the real client
// Only the two harness-free layers above run as part of `check` / `build`.
def configureHeadlessTest = { Test t, String packageGlob ->
t.group = 'verification'
t.useJUnit()
t.testClassesDirs = sourceSets.test.output.classesDirs
t.classpath = sourceSets.test.runtimeClasspath
t.include packageGlob
t.javaLauncher.set(javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(8)
})
// Test-only flag gating /artest probe commands and other test-only behaviour.
t.systemProperty 'advancedrocketry.tests', 'true'
// Forward the golden-corpus rewrite flag into the forked test JVM. Regenerating the universe
// fixture is a deliberate act (it means a new schema version is being released), so it is opt-in
// per invocation rather than a property with a default:
// ./gradlew testUnit --rerun -Dadvancedrocketry.universe.corpus.write=true
if (System.getProperty('advancedrocketry.universe.corpus.write') != null) {
t.systemProperty 'advancedrocketry.universe.corpus.write',
System.getProperty('advancedrocketry.universe.corpus.write')
}
t.testLogging {
events 'failed', 'skipped', 'passed'
exceptionFormat = 'full'
showStandardStreams = propertyBool('show_testing_output')
}
}
tasks.register('testUnit', Test) {
configureHeadlessTest(it, 'zmaster587/advancedRocketry/test/unit/**')
}
tasks.register('testIntegration', Test) {
configureHeadlessTest(it, 'zmaster587/advancedRocketry/test/integration/**')
}
test {
configureHeadlessTest(it, 'zmaster587/advancedRocketry/test/unit/**')
include 'zmaster587/advancedRocketry/test/integration/**'
}
// ─── Real-server / real-client harness layers (RFG) ─────────────────────────
//
// ./gradlew testServer → dedicated-server e2e (src/test/.../test/server)
// ./gradlew testClient → real-client e2e (src/test/.../test/client)
//
// forge-test-framework spawns a child JVM running RFG's GradleStartServer /
// GradleStart off java.class.path. RFG bakes the SRG/CSV mapping dirs and the
// FML tweaker into the compiled GradleStart launcher at token-replacement time,
// and GradleForgeHacks auto-discovers our coremod + FMLAT by scanning the
// classpath manifests — so the only thing the consuming build must supply is a
// child classpath identical to runServer's (patched MC + mcLauncher + deps +
// our mod) plus the test/framework classes. No FG6 run-config reflection needed:
// RunMinecraftTask extends JavaExec, so getClasspath()/getAssetsDirectory() are
// public. The framework's defaults (launcher.class.server=GradleStartServer,
// legacyArgs=true) already target RFG.
def configureHarnessTest = { Test t, boolean enableClient ->
t.group = 'verification'
t.useJUnit()
t.testClassesDirs = sourceSets.test.output.classesDirs
// Child server/client JVMs exec GradleStart* off this JVM's java.class.path,
// so it must carry the full RFG run classpath (mcLauncher = GradleStartServer,
// patched MC, deps) in addition to the test set. We take the run task's
// classpath ONLY — we must NOT depend on the run task executing (it launches
// a foreground MC server that never exits and would hang the build). Wrapping
// the run task's classpath provider in files() pulls in the build deps of the
// underlying artifacts (patched-MC / mcLauncher jars) without running it.
// NOTE: take the run task's classpath EAGERLY (.get().classpath). Going through
// a `runTask.map { it.classpath }` provider makes Gradle treat the run task as
// the producer and schedules it to EXECUTE — which launches a foreground MC
// server that never exits and hangs the build. The eager classpath collection's
// build deps are the compile / mcLauncher / jar tasks (the artifact producers),
// not the run task itself.
// Exclude the main source set output (classes + resources) from the test
// portion: the run task's classpath already carries our mod as the built jar,
// and FML throws DuplicateModsFoundException if it finds advancedrocketry both
// as build/classes/java/main AND build/libs/*.jar. The jar form is also the
// one that carries the FMLCorePlugin/FMLAT manifest, so coremod + AT discovery
// (GradleForgeHacks scanning java.class.path) only works from the jar anyway.
def runTask = tasks.named(enableClient ? 'runClient' : 'runServer', RunMinecraftTask).get()
t.classpath = project.files(
sourceSets.test.runtimeClasspath.minus(sourceSets.main.output),
runTask.classpath)
t.dependsOn 'jar'
// The child server must run on the Java 8 toolchain (MC 1.12.2). The harness
// resolves the child's java binary from THIS JVM's java.home, so pin the
// parent test JVM to Java 8 as well.
t.javaLauncher.set(javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(8)
})
t.systemProperty 'advancedrocketry.tests', 'true'
// Gate that flips AbstractHeadlessServerTest / AbstractClientE2ETest from
// Assume-skip to live. Without it the whole layer no-ops.
t.systemProperty 'forge.test.harness.enabled', 'true'
// Pin the assets dir to RFG's resolved location (framework default guesses a
// cache path that can drift between RFG versions).
t.systemProperty 'forge.test.assets.dir',
runTask.assetsDirectory.get().asFile.absolutePath
if (enableClient) {
// Real client needs LWJGL natives + a display. Auto-skips on headless.
// MC 1.12.2 runs on LWJGL 2, whose natives RFG extracts to
// run/natives/lwjgl2 via the extractNatives2 task (there is no plain
// `extractNatives` task under RFG; extractNatives3 is the unused
// LWJGL 3 set).
def nativesTask = tasks.named('extractNatives2').get()
t.dependsOn nativesTask
t.systemProperty 'forge.test.client.enabled', 'true'
t.systemProperty 'forge.test.client.nativesDir',
nativesTask.outputs.files.singleFile.absolutePath
// -PclientFbo=false renders the test client straight to the back buffer, as before screenshots
// needed a readable framebuffer. Kept as an escape hatch for a vendor driver that cannot take
// the FBO path, and as the knob that tells a timing-sensitive failure from an FBO-caused one.
if (project.hasProperty('clientFbo')) {
t.systemProperty 'forge.test.client.fbo', project.property('clientFbo').toString()
}
// -PclientWindowState=normal keeps the client's game window visible (default: the harness
// suppresses it off-screen/minimized for the whole client lifetime). The visible mode is
// both the debugging escape hatch and the control leg that proves the suppressor is the
// variable when a client behaviour differs between visible and suppressed windows.
if (project.hasProperty('clientWindowState')) {
t.systemProperty 'forge.test.client.window.startState',
project.property('clientWindowState').toString()
}
['DISPLAY', 'XAUTHORITY', 'LIBGL_ALWAYS_SOFTWARE'].each { var ->
def v = System.getenv(var)
if (v != null) {
t.systemProperty "forge.test.client.env.${var}", v
}
}
}
// Each child MC JVM is heavyweight; isolate one test class per fork. Effective concurrency is
// min(test_harness_forks, --max-workers) - when forking, do NOT pass --max-workers=1 on the
// CLI. Budget ~4 GB per fork: 512m this worker + 1g server child + 2.5g client child (the
// child caps live in the harness, overridable via forge.test.server.xmx/forge.test.client.xmx).
def harnessForks = (findProperty('test_harness_forks') ?: '1') as int
t.maxParallelForks = harnessForks
t.forkEvery 1L
t.minHeapSize = '256m'
t.maxHeapSize = '512m'
// One wall-clock multiplier for every hard harness ceiling (boot, handshake, waitTicks,
// command round-trips): N concurrent MC pairs stretch the effective tick rate, and fixed
// ceilings would turn that contention into spurious reds. See TestTimeouts.
t.systemProperty 'forge.test.timeout.factor', String.valueOf(1.0d + harnessForks / 4.0d)
// Harness worlds are generated from a FIXED seed so terrain under a fixture's coordinates is
// the same every run (an unpinned seed made every fixed-coordinate fixture a coin flip).
// -PlevelSeed=<value> re-rolls it deliberately; -PlevelSeed=random restores vanilla's
// per-run random landscape, which is how you check a fixture is not seed-dependent.
if (project.hasProperty('levelSeed')) {
t.systemProperty 'forge.test.level.seed', project.property('levelSeed').toString()
}
t.testLogging {
events 'failed', 'skipped', 'passed'
exceptionFormat = 'full'
showStandardStreams = propertyBool('show_testing_output')
}
}
tasks.register('testServer', Test) {
description = 'Dedicated-server scenario e2e (src/test/.../test/server).'
configureHarnessTest(it, false)
include 'zmaster587/advancedRocketry/test/server/**'
mustRunAfter 'testIntegration'
}
tasks.register('testClient', Test) {
description = 'Real-client + server e2e (src/test/.../test/client). Auto-skips headless.'
configureHarnessTest(it, true)
include 'zmaster587/advancedRocketry/test/client/**'
mustRunAfter 'testServer'
}
tasks.register('testMilestone', Test) {
// A milestone test walks ONE playable loop end to end on the real client, driving only the
// inputs a human has (keys, GUI clicks, seat mount) — its own tier because it is long, because
// it fails for reasons no single-mechanic e2e can, and because it is the gate for calling a
// milestone reachable.
description = 'Milestone e2e — one full playable loop on the real client (src/test/.../test/milestone).'
configureHarnessTest(it, true)
include 'zmaster587/advancedRocketry/test/milestone/**'
mustRunAfter 'testClient'
}
String parserChangelog() {
if (!file('CHANGELOG.md').exists()) {
throw new GradleException('publish_with_changelog is true, but CHANGELOG.md does not exist in the workspace!')
}
String parsedChangelog = changelog.renderItem(
changelog.get(propertyString('mod_version')).withHeader(false).withEmptySections(false),
Changelog.OutputType.MARKDOWN)
if (parsedChangelog.isEmpty()) {
throw new GradleException('publish_with_changelog is true, but the changelog for the latest version is empty!')
}
return parsedChangelog
}
tasks.register('generateMixinJson') {
group 'cleanroom helpers'
def missingConfig = propertyStringList('mixin_configs').findAll(config -> !file("src/main/resources/mixins.${config}.json").exists())
onlyIf {
if (propertyBool('use_mixins') && propertyBool('generate_mixins_json')) {
return !missingConfig.empty
}
return false
}
doLast {
for (String mixinConfig : missingConfig) {
def file = file("src/main/resources/mixins.${mixinConfig}.json")
file << """{\n\t"package": "",\n\t"required": true,\n\t"refmap": "${propertyString('mixin_refmap')}",\n\t"target": "@env(DEFAULT)",\n\t"minVersion": "0.8.5",\n\t"compatibilityLevel": "JAVA_8",\n\t"mixins": [],\n\t"server": [],\n\t"client": []\n}"""
}
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
if (propertyBool('use_modern_java_syntax')) {
if (it.name in ['compileMcLauncherJava', 'compilePatchedMcJava']) {
return
}
sourceCompatibility = 17
options.release.set(8)
javaCompiler.set(javaToolchains.compilerFor {
languageVersion.set(JavaLanguageVersion.of(16))
vendor.set(JvmVendorSpec.AZUL)
})
}
}
tasks.register('cleanroomAfterSync') {
group 'cleanroom helpers'
dependsOn 'injectTags', 'generateMixinJson'
}
if (propertyBool('use_modern_java_syntax')) {
tasks.withType(Javadoc).configureEach {
sourceCompatibility = 17
}
}
tasks.named('injectTags', InjectTagsTask).configure {
onlyIf {
return propertyBool('use_tags') && !it.getTags().get().isEmpty()
}
it.outputClassName.set(propertyString('tag_class_name'))
}
tasks.named('prepareObfModsFolder').configure {
finalizedBy 'prioritizeCoremods'
}
tasks.register('prioritizeCoremods') {
dependsOn 'prepareObfModsFolder'
doLast {
fileTree('run/obfuscated').forEach {
if (it.isFile() && it.name =~ '(mixinbooter|configanytime)(-)([0-9])+\\.+([0-9])+(.jar)') {
it.renameTo(new File(it.parentFile, "!${it.name}"))
}
}
}
}
idea.project.settings {
taskTriggers {
afterSync 'cleanroomAfterSync'
}
}
apply from: 'gradle/scripts/publishing.gradle'
apply from: 'gradle/scripts/extra.gradle'