-
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
Devmode: introduce quarkus.live-reload.watched-resources #10328
Conversation
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.
Thanks for that! I added one comment.
Also, I think it would be better to have a separate test using the QuarkusDevModeTest
facility. You have an example in DevModeConstraintValidationTest
for instance.
core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeConfig.java
Outdated
Show resolved
Hide resolved
I think I'm done. I removed the following entirely: /**
* This is used currently only to suppress warnings about unknown properties
* when the user supplies something like: -Dquarkus.live-reload.password=secret
*
* TODO refactor code to actually use these values
*/ because the two properties are actually used. Seemed like a leftover. |
Btw, it would be great to see this in 1.6.0. I know it's late, but IMO this has a very low risk of breaking anything. |
* The names of additional resources to watch for changes, triggering a reload on change. | ||
*/ | ||
@ConfigItem | ||
public Optional<List<String>> additionalWatchedResources; |
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.
More of a curiosity than a review comment - For types like List
does it add value to wrap it add around a Optional
? If no config values are provided for the property, then the config management framework can perhaps just create an empty list?
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.
Ah ah, you want to talk to @dmlloyd about that :).
If you want to allow the empty list, you need an Optional
.
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.
I don't remember the exact reason (although David certainly does and perhaps @ia3andy to whom David had explained it recently), but what Guillaume says is spot on.
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.
@dmlloyd will confirm but from what I remember, it was to be consistant for all different types, it's not Optional
if not specified as an Optional
whatever the type. and you can always decide to convert the empty optional to an empty list when consuming it.
I have a task in my todos to document that a bit better, but it's always sliding, I need to get to it 😅, aw and I created an issue:
#8306
Hello @famod, does this enhancement allow adding a directory as an additional watched resource? If yes, then looking at the hot deployment infrastructure I'm not 100% sure if this works in the current form i.e. if I change some file within the directory/sub-directory will it trigger the live reload? |
Hi @jaikiran. Right now you would be able to set a name that matches a directory and the directory is added to As for logging or throwing an exception, this is a bit complicated as a "name" could theoretically be a directory in one I'll push a second commit with what I think is sensible and you guys can decide if you want to keep it or not... |
I decided against touching So I only updated the JavaDoc of the new config item. |
@gsmet checks are green. Ready for (final?) review. :-) |
cc @geoand since you had this idea originally. |
I'll try and review tomorrow but I can't guarantee it |
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.
LGTM, thanks!
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.
LGTM.
I'd vote for a shorter name though. quarkus.live-reload.watched-resources
seems good enough to me. As a reference - in ArC we have quarkus.arc.selected-alternatives
which is used to "select" alternatives but these can be selected by @Priority
as well...
This is done quickly but let's see what @gsmet says. PS: Still hoping this is small enough for 1.6.1. 😉 |
@gsmet WDYT? |
Yeah, we can go with Martin's proposal. Just make sure to also update the commit message. |
Done. I left "additional" for the Javadoc and the test class names because it kind of made sense to me. |
Just rebased. Would be nice if someone could merge this... |
Merged, thanks! |
Resolves #10234
This is WIP because there are some things left to clarify and to implement:
DevMojoIT
. Is this ok?devmode
ConfigRoot
as there is alsoLiveReloadConfig
(which seems like a workaround judging from its JavaDoc)additional-watched-resources
could be shortened toextra-watched-resources
or ...? In case more "watched" aspects should be configurable in the future (e.g. Enable quarkus:dev to hot-reload resources from non-standard paths #10298?) then maybewatched.additional-resources
or similar would be better.ConfigPhase
.PS: I remove the duplicate
toAbsolutePath()
fromPaths.get(".env").toAbsolutePath().toAbsolutePath().toString()
.