Add a simple `decompileCFR` task (#1805)

* Add a simple `decompileCFR` task

* namedSrc
This commit is contained in:
modmuss50 2020-10-31 19:02:53 +00:00 committed by GitHub
parent cab3f2c375
commit 58de8437f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 0 deletions

1
.gitignore vendored
View File

@ -6,6 +6,7 @@
build/
out/
mappings_official/
namedSrc/
# idea
.idea/

View File

@ -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`

View File

@ -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