Skip to content

Commit

Permalink
Merge pull request #43076 from yrodiere/custom-decompiler-dir
Browse files Browse the repository at this point in the history
Configuration property to customize the directory where decompilation output gets stored
  • Loading branch information
gsmet authored Sep 7, 2024
2 parents 07b451f + fd58e50 commit 613cdf3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,19 @@ public static JarType fromString(String value) {
@ConfigGroup
interface DecompilerConfig {
/**
* Enable decompilation of generated and transformed bytecode into the `decompiled` directory.
* Enable decompilation of generated and transformed bytecode into a filesystem.
*/
@WithDefault("false")
boolean enabled();

/**
* The directory into which to save the decompilation output.
* <p>
* A relative path is understood as relative to the build directory.
*/
@WithDefault("decompiler")
String outputDirectory();

/**
* The directory into which to save the decompilation tool if it doesn't exist locally.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ private JarBuildItem buildThinJar(CurateOutcomeBuildItem curateOutcomeBuildItem,
Decompiler decompiler = null;
PackageConfig.DecompilerConfig decompilerConfig = packageConfig.jar().decompiler();
if (decompilerConfig.enabled()) {
decompiledOutputDir = buildDir.getParent().resolve("decompiled");
decompiledOutputDir = buildDir.getParent().resolve(decompilerConfig.outputDirectory());
FileUtil.deleteDirectory(decompiledOutputDir);
Files.createDirectory(decompiledOutputDir);
decompiler = new Decompiler.VineflowerDecompiler();
Expand Down
1 change: 1 addition & 0 deletions docs/src/main/asciidoc/writing-extensions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2259,6 +2259,7 @@ Quarkus generates a lot of classes during the build phase and in many cases also
It is often extremely useful to see the generated bytecode and transformed classes during the development of an extension.

If you set the `quarkus.package.jar.decompiler.enabled` property to `true` then Quarkus will download and invoke the https://github.com/Vineflower/vineflower[Vineflower decompiler] and dump the result in the `decompiled` directory of the build tool output (`target/decompiled` for Maven for example).
The output directory can be changed with `quarkus.package.jar.decompiler.output-dir`.

NOTE: This property only works during a normal production build (i.e. not for dev mode/tests) and when `fast-jar` packaging type is used (the default behavior).

Expand Down

0 comments on commit 613cdf3

Please sign in to comment.