Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce quarkus.package.decompiler config #37445

Merged
merged 2 commits into from
Dec 20, 2023
Merged

Conversation

geoand
Copy link
Contributor

@geoand geoand commented Dec 1, 2023

@geoand
Copy link
Contributor Author

geoand commented Dec 1, 2023

Seems like anything Gradle related is failing... I have no idea why

@@ -249,9 +250,18 @@ public static BuiltInType fromString(String value) {

/**
* Vineflower Decompiler configuration
*
* @Deprecated use {@code quarkus.package.decompiler} instead
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a note after which version it will be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know when it will be removed :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure, but I usually add a hint like "will be removed at some point after Quarkus 3.10" or something like that. To define the "transition period". So that the next one who reads the javadoc can actually remove it. Because otherwise it may stay there forever...

This comment has been minimized.

* @Deprecated use {@code quarkus.package.decompiler} instead
*/
@ConfigItem
@Deprecated(forRemoval = true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not entirely sure this will work at the group level. We should make it work if it doesn't I suppose.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean in the generated docs or something else?

This comment has been minimized.

@gsmet
Copy link
Member

gsmet commented Dec 18, 2023

The Gradle failures look odd. I haven't seen them anywhere else.

@geoand
Copy link
Contributor Author

geoand commented Dec 18, 2023

Yeah, I really don't know what to make of them...

@gsmet
Copy link
Member

gsmet commented Dec 18, 2023

I'll have a look once we have the new report posted.

@geoand
Copy link
Contributor Author

geoand commented Dec 18, 2023

Thanks for the help!

I'll run them locally tomorrow and let you know if I can't figure it out.

This comment has been minimized.

@gsmet
Copy link
Member

gsmet commented Dec 18, 2023

java.lang.NoSuchMethodException: java.util.Optional.<init>() at io.quarkus.runtime.configuration.ConfigInstantiator.handleObject(ConfigInstantiator.java:139) at io.quarkus.runtime.configuration.ConfigInstantiator.handleObject(ConfigInstantiator.java:110) ... 103 more Caused by: java.lang.NoSuchMethodException: java.util.Optional.<init>() at io.quarkus.runtime.configuration.ConfigInstantiator.handleObject(ConfigInstantiator.java:106) ... 104 more Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0. You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. For more on this, please refer to https://docs.gradle.org/8.5/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation. BUILD FAILED in 5s 7 actionable tasks: 5 executed, 2 up-to-date Configuration cache entry discarded with 3 problems.

My guess is that it's related to something that is not properly handled by our config framework. But I don't see anything odd here.

Maybe @radcortez will have some insights.

@radcortez
Copy link
Member

Probably this is caused by this:

ConfigInstantiator.handleObject(packageConfig, config.config());

This ConfigInstantiator is not fully implemented and was added to manually create config objects. Ideally, we should get rid of this, because we can now create such objects (fully implemented) with SmallRye Config.

To move forward, either we implement the missing features in ConfigInstantiator, or we change the config object to only use the supported contracts.

@geoand
Copy link
Contributor Author

geoand commented Dec 19, 2023

I don't understand however what in this PR triggers the problem

@dmlloyd
Copy link
Member

dmlloyd commented Dec 19, 2023

I'm currently looking at changing this config, possibly to make it independent of packaging altogether, as part of reworking native image. I'm not sure what this would mean for this PR though.

Comment on lines 314 to 329
@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;
@ConfigDocDefault("false")
public Optional<Boolean> 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<String> jarDirectory;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like this whole configuration should be separate from packaging. For example if we produce multiple artifacts with different packaging configurations, we'd still only produce one set of decompiled sources, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm not against that.

@ConfigItem(defaultValue = "1.9.3")
public String version;
@ConfigDocDefault("false")
public Optional<Boolean> enabled;
Copy link
Member

@dmlloyd dmlloyd Dec 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these being made into optionals solely to accommodate the fact that the configuration moved? If so, I think we can/should probably brainstorm a better solution, otherwise these kinds of things are going to accumulate and cause problems.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. I'm definitely open to looking for a better solution

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A possible solution is to use relocate functions: https://smallrye.io/smallrye-config/3.4.4/extensions/relocate/

@radcortez
Copy link
Member

I don't understand however what in this PR triggers the problem

I suspect the new Optional config elements fails here:

if (configItem == null || fieldClass.isAnnotationPresent(ConfigGroup.class)) {
Constructor<?> constructor = fieldClass.getConstructor();
constructor.setAccessible(true);
Object newInstance = constructor.newInstance();
field.set(o, newInstance);
handleObject(prefix + "." + dashify(field.getName()), newInstance, config, quarkusPropertyNames);

*/
@ConfigItem(defaultValue = "1.9.3")
public String version;
@ConfigDocDefault("false")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding @ConfigItem should fix #37445 (comment)

Copy link
Contributor Author

@geoand geoand Dec 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for spotting,what a dumb mistake on my part!

Let me try it out and see how it goes

This is meant to be used instead of
quarkus.package.vineflower.
Furthermore, this removes the configurable
version property which was never being used.

Closes: quarkusio#37332
Copy link

github-actions bot commented Dec 20, 2023

🙈 The PR is closed and the preview is expired.

This comment has been minimized.

Copy link

quarkus-bot bot commented Dec 20, 2023

✔️ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

@geoand geoand merged commit 683b16c into quarkusio:main Dec 20, 2023
54 checks passed
@quarkus-bot quarkus-bot bot added the kind/enhancement New feature or request label Dec 20, 2023
@quarkus-bot quarkus-bot bot added this to the 3.7 - main milestone Dec 20, 2023
@dmlloyd
Copy link
Member

dmlloyd commented Dec 20, 2023

Well... I guess I'll make a note to address the problems later then. I probably should have "requested changes" so it's my fault I think.

@geoand
Copy link
Contributor Author

geoand commented Dec 20, 2023

I think the proposed changes were pretty much orthogonal to this. Furthermore, the two different configurations are only meant to last a couple versions and then the old will go away

@geoand geoand deleted the #37332 branch December 20, 2023 16:51
@geoand
Copy link
Contributor Author

geoand commented Dec 20, 2023

Sorry for misunderstanding how severe you thought the impact was :(

@dmlloyd
Copy link
Member

dmlloyd commented Dec 20, 2023

No worries, it's my fault. I have to get over my aversion to "Request Changes". It just seems so unkind :-)

@geoand
Copy link
Contributor Author

geoand commented Dec 20, 2023

I totally know how you feel, I rarely use it :)

dmlloyd added a commit to dmlloyd/quarkus that referenced this pull request Dec 21, 2023
dmlloyd added a commit to dmlloyd/quarkus that referenced this pull request Dec 21, 2023
dmlloyd added a commit to dmlloyd/quarkus that referenced this pull request Dec 22, 2023
dmlloyd added a commit to dmlloyd/quarkus that referenced this pull request Jan 4, 2024
dmlloyd added a commit to dmlloyd/quarkus that referenced this pull request Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

Rename the Vineflower properties ?
5 participants