From 3c65a50c9f819c6a8c07f4f23353904c722e192c Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Sat, 20 Apr 2024 10:54:48 -0700 Subject: [PATCH] synchronize decompiler args with paperweight --- .../papermc/sculptor/shared/MacheExtension.kt | 54 +++++++++++-------- .../sculptor/version/tasks/DecompileJar.kt | 2 +- 2 files changed, 33 insertions(+), 23 deletions(-) diff --git a/sculptor-shared/src/main/kotlin/io/papermc/sculptor/shared/MacheExtension.kt b/sculptor-shared/src/main/kotlin/io/papermc/sculptor/shared/MacheExtension.kt index eb5c9f5..7643a85 100644 --- a/sculptor-shared/src/main/kotlin/io/papermc/sculptor/shared/MacheExtension.kt +++ b/sculptor-shared/src/main/kotlin/io/papermc/sculptor/shared/MacheExtension.kt @@ -37,33 +37,43 @@ open class MacheExtension(objects: ObjectFactory) { init { decompilerArgs.convention( listOf( - // Synthetic Not Set: Treat some known structures as synthetic even when not explicitly set - "-nns=true", - // Ternary Constant Simplification: + // Treat some known structures as synthetic even when not explicitly set + "--synthetic-not-set=true", // Fold branches of ternary expressions that have boolean true and false constants - "-tcs=true", - // Override Annotation: Display override annotations for methods known to the decompiler - "-ovr=false", - // [Experimental] Verify Variable Merges: - // Double checks to make sure the validity of variable merges - "-vvm=true", - // Include Entire Classpath: Give the decompiler information about every jar on the classpath - "-iec=true", - // Include Java Runtime: Give the decompiler information about the Java runtime - "-jrt=current", - // Indent String - "-ind= ", - // JAD-Style Variable Naming: Use JAD-style variable naming for local variables - "-jvn=false", + "--ternary-constant-simplification=true", + // Give the decompiler information about the Java runtime + "--include-runtime=current", // Decompile complex constant-dynamic expressions: // Some constant-dynamic expressions can't be converted to a single Java expression with // identical run-time behaviour. This decompiles them to a similar non-lazy expression, // marked with a comment - "-dcc=true", - // Skip Extra Files: Skip copying non-class files from the input folder or file to the output - "-sef=true", - // New Line Seperator: Character that seperates lines in the decompiled output. - "-nls=1", + "--decompile-complex-constant-dynamic=true", + // Indent String + "--indent-string= ", + // Process inner classes and add them to the decompiled output. + "--decompile-inner=true", // default + // Removes any methods that are marked as bridge from the decompiled output. + "--remove-bridge=true", // default + // Decompile generics in classes, methods, fields, and variables. + "--decompile-generics=true", // default + // Encode non-ASCII characters in string and character literals as Unicode escapes. + "--ascii-strings=false", // default + // Removes any methods and fields that are marked as synthetic from the decompiled output. + "--remove-synthetic=true", // default + // Give the decompiler information about every jar on the classpath. + "--include-classpath=true", + // Remove braces on simple, one line, lambda expressions. + "--inline-simple-lambdas=true", // default + // Ignore bytecode that is malformed. + "--ignore-invalid-bytecode=false", // default + // Map Bytecode to source lines. + "--bytecode-source-mapping=true", + // Dump line mappings to output archive zip entry extra data. + "--dump-code-lines=true", + // Display override annotations for methods known to the decompiler + "--override-annotation=false", + // Skip copying non-class files from the input folder or file to the output + "--skip-extra-files=true", ), ) diff --git a/sculptor-version/src/main/kotlin/io/papermc/sculptor/version/tasks/DecompileJar.kt b/sculptor-version/src/main/kotlin/io/papermc/sculptor/version/tasks/DecompileJar.kt index eecaf01..4265f83 100644 --- a/sculptor-version/src/main/kotlin/io/papermc/sculptor/version/tasks/DecompileJar.kt +++ b/sculptor-version/src/main/kotlin/io/papermc/sculptor/version/tasks/DecompileJar.kt @@ -58,7 +58,7 @@ abstract class DecompileJar : DefaultTask() { val cfgFile = layout.buildDirectory.file(DECOMP_CFG).convertToPath().ensureClean() val cfgText = buildString { for (file in minecraftClasspath.files) { - append("-e=") + append("--add-external=") append(file.toPath().absolutePathString()) append(System.lineSeparator()) }