diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/PackageConfig.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/PackageConfig.java index 95063f55a16b7..4e616696cbedb 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/PackageConfig.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/PackageConfig.java @@ -4,6 +4,7 @@ import java.util.Optional; import java.util.Set; +import io.quarkus.runtime.annotations.ConfigDocDefault; import io.quarkus.runtime.annotations.ConfigGroup; import io.quarkus.runtime.annotations.ConfigItem; import io.quarkus.runtime.annotations.ConfigRoot; @@ -249,9 +250,18 @@ public static BuiltInType fromString(String value) { /** * Vineflower Decompiler configuration + * + * @Deprecated use {@code quarkus.package.decompiler} instead + */ + @ConfigItem + @Deprecated(forRemoval = true) + public DecompilerConfig vineflower; + + /** + * Decompiler configuration */ @ConfigItem - public VineFlowerConfig vineflower; + public DecompilerConfig decompiler; /** * If set to {@code true}, it will result in the Quarkus writing the transformed application bytecode @@ -302,24 +312,20 @@ public String getRunnerSuffix() { } @ConfigGroup - public static class VineFlowerConfig { + public static class DecompilerConfig { /** * An advanced option that will decompile generated and transformed bytecode into the 'decompiled' directory. * This is only taken into account when fast-jar is used. */ - @ConfigItem(defaultValue = "false") - public boolean enabled; - - /** - * The version of Vineflower to use - */ - @ConfigItem(defaultValue = "1.9.3") - public String version; + @ConfigItem + @ConfigDocDefault("false") + public Optional enabled; /** * The directory into which to save the Vineflower tool if it doesn't exist */ - @ConfigItem(defaultValue = "${user.home}/.quarkus") - public String jarDirectory; + @ConfigItem + @ConfigDocDefault("${user.home}/.quarkus") + public Optional jarDirectory; } } diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java index 8f18b874d6f2e..166562b4c1d2d 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java @@ -154,6 +154,7 @@ public boolean test(String path) { public static final String DEFAULT_FAST_JAR_DIRECTORY_NAME = "quarkus-app"; public static final String MP_CONFIG_FILE = "META-INF/microprofile-config.properties"; + private static final String VINEFLOWER_VERSION = "1.9.3"; @BuildStep OutputTargetBuildItem outputTarget(BuildSystemTargetBuildItem bst, PackageConfig packageConfig) { @@ -603,19 +604,22 @@ private JarBuildItem buildThinJar(CurateOutcomeBuildItem curateOutcomeBuildItem, Path decompiledOutputDir = null; boolean wasDecompiledSuccessfully = true; Decompiler decompiler = null; - if (packageConfig.vineflower.enabled) { + if (packageConfig.vineflower.enabled.orElse(false) || packageConfig.decompiler.enabled.orElse(false)) { + Optional jarDirectoryStrOpt = packageConfig.vineflower.enabled.orElse(false) + ? packageConfig.vineflower.jarDirectory + : packageConfig.decompiler.jarDirectory; + String jarDirectoryStr = jarDirectoryStrOpt.orElse(System.getProperty("user.home") + "/.quarkus"); + decompiledOutputDir = buildDir.getParent().resolve("decompiled"); FileUtil.deleteDirectory(decompiledOutputDir); Files.createDirectory(decompiledOutputDir); - if (packageConfig.vineflower.enabled) { - decompiler = new Decompiler.VineflowerDecompiler(); - Path jarDirectory = Paths.get(packageConfig.vineflower.jarDirectory); - if (!Files.exists(jarDirectory)) { - Files.createDirectory(jarDirectory); - } - decompiler.init(new Decompiler.Context(packageConfig.vineflower.version, jarDirectory, decompiledOutputDir)); - decompiler.downloadIfNecessary(); + decompiler = new Decompiler.VineflowerDecompiler(); + Path jarDirectory = Paths.get(jarDirectoryStr); + if (!Files.exists(jarDirectory)) { + Files.createDirectory(jarDirectory); } + decompiler.init(new Decompiler.Context(VINEFLOWER_VERSION, jarDirectory, decompiledOutputDir)); + decompiler.downloadIfNecessary(); } FastJarJars.FastJarJarsBuilder fastJarJarsBuilder = new FastJarJars.FastJarJarsBuilder(); diff --git a/docs/src/main/asciidoc/writing-extensions.adoc b/docs/src/main/asciidoc/writing-extensions.adoc index 861bfa9fb9578..85465b26cd04d 100644 --- a/docs/src/main/asciidoc/writing-extensions.adoc +++ b/docs/src/main/asciidoc/writing-extensions.adoc @@ -2252,7 +2252,7 @@ The only particular aspect of writing Quarkus extensions in Eclipse is that APT Quarkus generates a lot of classes during the build phase and in many cases also transforms existing classes. 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.vineflower.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). +If you set the `quarkus.package.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). 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). diff --git a/integration-tests/hibernate-orm-panache/src/main/resources/application.properties b/integration-tests/hibernate-orm-panache/src/main/resources/application.properties index 901ea6ee95a0b..d75946174ae16 100644 --- a/integration-tests/hibernate-orm-panache/src/main/resources/application.properties +++ b/integration-tests/hibernate-orm-panache/src/main/resources/application.properties @@ -7,4 +7,4 @@ quarkus.hibernate-orm.database.generation=drop-and-create quarkus.hibernate-orm.statistics=true quarkus.hibernate-orm.metrics.enabled=true -quarkus.package.vineflower.enabled=true +quarkus.package.decompiler.enabled=true diff --git a/integration-tests/resteasy-reactive-kotlin/standard/src/main/resources/application.properties b/integration-tests/resteasy-reactive-kotlin/standard/src/main/resources/application.properties index 860b381c1fbf5..300ec0057dfe4 100644 --- a/integration-tests/resteasy-reactive-kotlin/standard/src/main/resources/application.properties +++ b/integration-tests/resteasy-reactive-kotlin/standard/src/main/resources/application.properties @@ -21,6 +21,6 @@ mp.messaging.incoming.countries-t2-in.connector=smallrye-kafka mp.messaging.incoming.countries-t2-in.topic=countries-t2 mp.messaging.incoming.countries-t2-in.auto.offset.reset=earliest -quarkus.package.vineflower.enabled=true +quarkus.package.decompiler.enabled=true test.prop=test