diff --git a/.gitignore b/.gitignore index 381c117cb9..bde2ecc7fc 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ build/ out/ mappings_official/ +namedSrc/ # idea .idea/ diff --git a/README.md b/README.md index 27d240ac76..442d72ff50 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,9 @@ Build a GZip'd archive containing a tiny mapping between official (obfuscated), ### `mapNamedJar` Builds a deobfuscated jar with yarn mappings and automapped fields (enums, etc.). Unmapped names will be filled with [intermediary](https://github.com/FabricMC/Intermediary) names. +### `decompileCFR` +Decompile the mapped source code. **Note:** This is not designed to be recompiled. + ### `download` Downloads the client and server Minecraft jars for the current Minecraft version to `.gradle/minecraft` diff --git a/build.gradle b/build.gradle index 98c9b85c0a..93841aad8e 100644 --- a/build.gradle +++ b/build.gradle @@ -37,6 +37,10 @@ repositories { name "Fabric Repository" url 'https://maven.fabricmc.net' } + maven { + name "Mojang" + url 'https://libraries.minecraft.net/' + } } configurations { @@ -47,6 +51,7 @@ configurations { } } javadocClasspath + decompileClasspath } dependencies { @@ -54,6 +59,7 @@ dependencies { enigmaRuntime "net.fabricmc:stitch:${project.stitch_version}" javadocClasspath "net.fabricmc:fabric-loader:0.8.2+build.194" javadocClasspath "com.google.code.findbugs:jsr305:3.0.2" + decompileClasspath "org.benf:cfr:0.150" } def setupGroup = "jar setup" @@ -265,6 +271,8 @@ task downloadMcLibs(dependsOn: downloadWantedVersionManifest) { dest new File(libraries, downloadUrl.substring(downloadUrl.lastIndexOf("/") + 1)) overwrite false } + + project.dependencies.add("decompileClasspath", it.name) } } } @@ -667,6 +675,17 @@ task genFakeSource(dependsOn: ["buildYarnTiny", "mapNamedJar"]) { } } +task decompileCFR(type: JavaExec, dependsOn: "mapNamedJar") { + classpath = configurations.decompileClasspath + main = "org.benf.cfr.reader.Main" + + args namedJar.getAbsolutePath(), "--outputdir", file("namedSrc").absolutePath + + doFirst { + file("namedSrc").deleteDir() + } +} + javadoc { dependsOn genFakeSource dependsOn downloadMcLibs