Skip to content

Commit 8a2b056

Browse files
authored
Coremod improvements, debugging, obf task fixes (#49)
1 parent a9059a8 commit 8a2b056

File tree

2 files changed

+47
-17
lines changed

2 files changed

+47
-17
lines changed

build.gradle

Lines changed: 42 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ import static org.gradle.internal.logging.text.StyledTextOutput.Style
2020
plugins {
2121
id 'java'
2222
id 'java-library'
23+
id 'base'
2324
id 'eclipse'
2425
id 'maven-publish'
2526
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.7'
26-
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.21'
27+
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.23'
2728
id 'net.darkhax.curseforgegradle' version '1.0.14' apply false
2829
id 'com.modrinth.minotaur' version '2.8.0' apply false
2930
id 'com.diffplug.spotless' version '6.13.0' apply false
@@ -66,6 +67,7 @@ propertyDefaultIfUnset("includeWellKnownRepositories", true)
6667
propertyDefaultIfUnset("includeCommonDevEnvMods", true)
6768
propertyDefaultIfUnset("noPublishedSources", false)
6869
propertyDefaultIfUnset("forceEnableMixins", false)
70+
propertyDefaultIfUnsetWithEnvVar("enableCoreModDebug", false, "CORE_MOD_DEBUG")
6971
propertyDefaultIfUnset("generateMixinConfig", true)
7072
propertyDefaultIfUnset("usesShadowedDependencies", false)
7173
propertyDefaultIfUnset("minimizeShadowedDependencies", true)
@@ -277,7 +279,10 @@ else {
277279
}
278280

279281
group = modGroup
280-
archivesBaseName = modArchivesBaseName
282+
283+
base {
284+
archivesName = modArchivesBaseName
285+
}
281286

282287
minecraft {
283288
mcVersion = minecraftVersion
@@ -304,8 +309,21 @@ minecraft {
304309
'-Dmixin.debug.export=true'
305310
])
306311
}
307-
if (coreModClass) {
308-
extraRunJvmArguments.add("-Dfml.coreMods.load=${modGroup}.${coreModClass}")
312+
313+
if (enableCoreModDebug.toBoolean()) {
314+
extraRunJvmArguments.addAll([
315+
'-Dlegacy.debugClassLoading=true',
316+
'-Dlegacy.debugClassLoadingFiner=true',
317+
'-Dlegacy.debugClassLoadingSave=true'
318+
])
319+
}
320+
}
321+
322+
if (coreModClass) {
323+
for (runTask in ['runClient', 'runServer']) {
324+
tasks.named(runTask).configure {
325+
extraJvmArgs.add("-Dfml.coreMods.load=${modGroup}.${coreModClass}")
326+
}
309327
}
310328
}
311329

@@ -372,6 +390,11 @@ repositories {
372390
name 'BlameJared Maven'
373391
url 'https://maven.blamejared.com'
374392
}
393+
maven {
394+
name 'GTNH Maven'
395+
url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public'
396+
allowInsecureProtocol = true
397+
}
375398
}
376399
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
377400
// need to add this here even if we did not above
@@ -402,31 +425,30 @@ configurations {
402425
}
403426

404427
dependencies {
405-
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
406-
implementation 'zone.rong:mixinbooter:8.3'
407-
String mixin = 'zone.rong:mixinbooter:8.3'
408-
if (usesMixins.toBoolean()) {
409-
mixin = modUtils.enableMixins(mixin, "mixins.${modId}.refmap.json")
410-
}
428+
String mixin = 'zone.rong:mixinbooter:8.3'
429+
if (usesMixins.toBoolean()) {
430+
annotationProcessor 'org.ow2.asm:asm-debug-all:5.2'
431+
// should use 24.1.1 but 30.0+ has a vulnerability fix
432+
annotationProcessor 'com.google.guava:guava:30.0-jre'
433+
// should use 2.8.6 but 2.8.9+ has a vulnerability fix
434+
annotationProcessor 'com.google.code.gson:gson:2.8.9'
411435

436+
mixin = modUtils.enableMixins(mixin, "mixins.${modId}.refmap.json")
412437
api (mixin) {
413438
transitive = false
414439
}
415440

416441
annotationProcessor(mixin) {
417442
transitive = false
418443
}
419-
420-
annotationProcessor 'org.ow2.asm:asm-debug-all:5.2'
421-
// should use 24.1.1 but 30.0+ has a vulnerability fix
422-
annotationProcessor 'com.google.guava:guava:30.0-jre'
423-
// should use 2.8.6 but 2.8.9+ has a vulnerability fix
424-
annotationProcessor 'com.google.code.gson:gson:2.8.9'
444+
} else if (forceEnableMixins.toBoolean()) {
445+
runtimeOnly(mixin)
425446
}
426447

427448
if (enableJUnit.toBoolean()) {
428-
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.1'
429449
testImplementation 'org.hamcrest:hamcrest:2.2'
450+
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
451+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
430452
}
431453

432454
if (enableModernJavaSyntax.toBoolean()) {
@@ -449,6 +471,9 @@ dependencies {
449471

450472
compileOnlyApi 'org.jetbrains:annotations:23.0.0'
451473
annotationProcessor 'org.jetbrains:annotations:23.0.0'
474+
patchedMinecraft('net.minecraft:launchwrapper:1.15') {
475+
transitive = false
476+
}
452477

453478
if (includeCommonDevEnvMods.toBoolean()) {
454479
implementation 'mezz.jei:jei_1.12.2:4.16.1.302'

gradle.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ containsMixinsAndOrCoreModOnly = false
6464
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
6565
forceEnableMixins = false
6666

67+
# Outputs pre-transformed and post-transformed loaded classes to run/CLASSLOADER_TEMP. Can be used in combination with
68+
# diff to see exactly what your ASM or Mixins are changing in the target file.
69+
# Optionally can be specified with the 'CORE_MOD_DEBUG' env var. Will output a lot of files!
70+
enableCoreModDebug = false
71+
6772
# Adds CurseMaven, Modrinth Maven, BlameJared maven, and some more well-known 1.12.2 repositories
6873
includeWellKnownRepositories = true
6974

0 commit comments

Comments
 (0)