Add methods to deobfuscate dependencies (#7)

* Add methods to deobfuscate dependencies

usage:
compile deobf(sourceURL, fileName, notch)

- fileName has to be *without* .jar
- notch can be left out (defaults to false)
- supports SRG and NOTCH mappings. Mods are usually compiled with SRG mappings but some mods (e.g. VoxelMap) are compiled with NOTCH mappings

* Change working directory

* Change to GTNH fork of BON2
This commit is contained in:
glowredman authored and GitHub committed 2022-01-22 09:35:05 -08:00
1 parent ba14c444c3
commit 838e4b658d
2 files changed
+38 -1

No files matched your search

+1
View File
@@ -29,3 +29,4 @@ src/main/resources/mixins.*.json
*.bat
*.DS_Store
!gradlew.bat
/deobf/
+37 -1
View File
@@ -1,4 +1,4 @@
//version: 1642484596
//version: 1642844806
/*
DO NOT CHANGE THIS FILE!
@@ -43,6 +43,7 @@ plugins {
id("org.ajoberstar.grgit") version("3.1.1")
id("com.github.johnrengelman.shadow") version("4.0.4")
id("com.palantir.git-version") version("0.12.3")
id('de.undercouch.download') version('4.1.2')
id("maven-publish")
}
@@ -582,6 +583,41 @@ configure(updateBuildScript) {
description = 'Updates the build script to the latest version'
}
// Deobfuscation
def deobf(String sourceURL, String fileName) {
def bon2File = "$projectDir/deobf/BON2-2.5.0.jar"
def cacheFile = "$projectDir/deobf/out/" + fileName + ".jar"
def deobfFile = "$projectDir/deobf/out/" + fileName + "-deobf.jar"
if(file(deobfFile).exists()) {
return files(deobfFile)
}
download {
src 'https://github.com/GTNewHorizons/BON2/releases/download/2.5.0/BON2-2.5.0.CUSTOM-all.jar'
dest bon2File
quiet true
overwrite false
}
download {
src sourceURL
dest cacheFile
quiet true
overwrite false
}
exec {
commandLine 'java', '-jar', bon2File, '--inputJar', cacheFile, '--outputJar', deobfFile, '--mcVer', '1.7.10', '--mappingsVer', 'stable_12', '--notch'
workingDir "$projectDir/deobf"
standardOutput = new ByteArrayOutputStream()
}
delete(cacheFile)
return files(deobfFile)
}
// Helper methods
def checkPropertyExists(String propertyName) {