diff --git a/build.gradle b/build.gradle index fd858165..40017ce9 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1642833682 +//version: 1642872913 /* 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") } @@ -495,6 +496,13 @@ artifacts { } } +// The gradle metadata includes all of the additional deps that we disabled from POM generation (including forgeBin with no groupID), +// and isn't strictly needed with the POM so just disable it. +tasks.withType(GenerateModuleMetadata) { + enabled = false +} + + // publishing publishing { publications { @@ -597,6 +605,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) {