-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Ability to configure extension Dev mode JVM options #44305
Conversation
This is awesome! I assume that to test it, I should update one of the extensions I have in mind with the |
looks good but can you clarify whats the options/semantics if/when user want to configure these? do they override them all or can they append/prepend? (order matters for some of these afaik and also behavior of runtime will differ greatly between dev and prod - not saying thats bad but should be documented/make users aware) Also, this is purely for devmode so for prod users are on their own figuring out what to add? anything we could do there to help? |
My hope is that once we figure this one out, we can do something similar for prod-mode |
just to give a usecase i'm concerned about - two extensions adding conflicting arguments; how can/will user resolve that? |
@aloubyansky how would the
JVM flag be enabled? |
For now everything is merged. It's pretty basic at this point. A user can disable arguments from all or specific extensions and configure their own on top of those.
Could you give an example where order matters? For now I actually order everything alphabetically, which may be a bad idea but it results in a stable command line.
This is still being explored even for dev mode. |
I think the validation and conflict resolution will have to be implemented per argument type, they are quite different. We can point out which arguments from which extensions conflict and let the user resolve it. We can't guarantee a conflict free solution, it may happen as well as with dependencies, capabilities, etc. |
Here is my playground project with a couple of extensions and an app https://github.com/aloubyansky/playground/tree/ext-dev-jvm-args Here is how one configures its arguments https://github.com/aloubyansky/playground/blob/ext-dev-jvm-args/quarkus-red/runtime/pom.xml#L34-L42 And here is the app depending on both of them https://github.com/aloubyansky/playground/blob/ext-dev-jvm-args/app/pom.xml#L59-L66 also adding an extra module https://github.com/aloubyansky/playground/blob/ext-dev-jvm-args/app/pom.xml#L57 To test it the project could be launched from the root with |
It should be
|
If I add it that way to
|
I'll check it out, thanks |
how is that done by the user? |
See the description (the last XML snippet) |
example of order matters that I know of top of my head:
add-modules, defines module path order and thus like dependencies have priority/influence on classloading resolution. I'll try find where I read that the javac/java command line tools in general allows duplicates of arguments but last one wins. |
I am not covering In the current impl, values of arguments with the same name are merged, meaning there wouldn't be the same argument name/key appearing more than once on the command line. But again, |
rather than sorting alphabetically why not sort by dependency order? (and if java honors first/last maybe add it in reverse order) |
actually just realizing that if we just expose explict options and from that generates one argument, i.e. ALL-UNNAMED no matter where it comes from results in:
things are less "chaotic" and if put first in command line give user somewhat freedom to at least append. Would it make sense to have these generated into a common location (i.e. |
-D was just example, add-modules is in here. But basically I think it is last one wins, though things like --add-modules are additive. |
Sure, could you point me to a doc or some other impl using this approach? |
We could, although in the new resolver impl the dependencies (including extension metadata) are processed in parallel. |
with the option of disabling and everything gets grouped its probably fine to use alpha ordering of the values. |
will this disable it for everything?
|
I haven't tested that but this (the previous snippet in the description) will
|
@aloubyansky is there a way that the Maven / Gradle option added in #43988 could be "enabled"? |
From an extension? That's a tricky one. Either we create an alias for it or add (more or less) proper support for configuring (some of the) |
That would be very nice, thanks! The idea is that if the extension is present, we need C2 otherwise dev-mode is unusable (as in, execution takes minutes instead of seconds). |
c25f186
to
b21dd25
Compare
Ah, it still adds |
@geoand is adding the instrumentation agent an issue in your case? |
Nope, it doesn't affect execution |
bc3cd1e
to
3d5fda0
Compare
How about the following?
These would be logged only in case an extension's config is effective. Re-running with |
I like the messages, but maybe it should be |
3d5fda0
to
8e2a4a8
Compare
Ok, I don't mind. I'm thinking of changing
to simply
Otherwise, I think it's in a good shape, unless you have further remarks @geoand. I still need to implement extension option filtering in the Gradle plugin and document it though. |
Thanks a lot @aloubyansky! I will try it soon and let you know if all is good on my side. |
Tried it and it works like a charm! So from my pov, this is ready to go functionally. |
8e2a4a8
to
6b9bfa3
Compare
6b9bfa3
to
75ebde9
Compare
Gradle support and the basic docs added. |
🙈 The PR is closed and the preview is expired. |
Status for workflow
|
Status for workflow
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome stuff!
Unless there are objections, I'd prefer merging this one, since I have another PR touching some of the same classes, that will result in conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
each extension can express things they want to set and if something goes against something we traditionally hardwired in devmode a info message is logged and users can alwas expliclity set it in their configuration. If conflicts there is a hard fail and user will need to adjust.
Generally +1
I'm not fully sure we shouldn't print WARN for things that goes counter to devmode defaults - like Debugging not being enabled but lets see; also annoying having warnings for something that is expected result from something like jlama needs...
I changed those to |
I added the |
I really hope it won't get popular though :D |
😆 |
This change allows extension authors to configure JVM options in extension metadata that would be added to the command line launching an application in dev mode.
At this point, this is targeting JVM options that start with
--
, such as--enable-preview
,--add-opens
,--add-modules
and boolean or single valued-XX:
options.Dev mode JVM options can be configured when building extensions in the following way
When an
ApplicationModel
is resolved, Dev mode JVM options from all the extensions are merged and when the application is launched in Dev mode, these options are added to the command line.A user can disable JVM options coming extensions by adding the following
quarkus-maven-plugin
configurationor disable JVM arguments from extensions matching an artifact pattern
Here is a playground repository I use to test this https://github.com/aloubyansky/playground/tree/ext-dev-jvm-args
https://github.com/aloubyansky/playground/blob/ext-dev-jvm-args/quarkus-blue/runtime/pom.xml and
https://github.com/aloubyansky/playground/blob/ext-dev-jvm-args/quarkus-red/runtime/pom.xml
configure dev mode JVM options.
Application https://github.com/aloubyansky/playground/blob/ext-dev-jvm-args/app/pom.xml depends on both of the extensions and can filter out some or all the options from the extensions it depends on.
The project can be launched with
mvn clean compile quarkus:dev -X
from the root directory to see the final command line launching the application logged.It looks like