-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for client endpoints live reload
Adds the possibility to watch for changes in Hilla Java endpoints and trigger Quarkus live reload without the need to refresh the brower page. Quarkus will recompile the changed class and restart the server if needed. If 'quarkus.live-reload.instrumentation' is enabled, Quarkus may redefine the class without a server restart. In this case, the extension directly triggers Hilla hotswapper to regenerate client side code. Fixes #261 Fixes #489
- Loading branch information
1 parent
58f20d0
commit 16ac8b4
Showing
11 changed files
with
752 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
runtime-commons/src/main/java/com/github/mcollovati/quarkus/hilla/HillaConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright 2024 Marco Collovati, Dario Götze | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.github.mcollovati.quarkus.hilla; | ||
|
||
import java.nio.file.Path; | ||
import java.util.Optional; | ||
import java.util.Set; | ||
|
||
import io.quarkus.runtime.annotations.ConfigPhase; | ||
import io.quarkus.runtime.annotations.ConfigRoot; | ||
import io.smallrye.config.ConfigMapping; | ||
import io.smallrye.config.WithDefault; | ||
|
||
/** | ||
* Hilla configuration. | ||
*/ | ||
@ConfigMapping(prefix = "vaadin.hilla") | ||
@ConfigRoot(phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED) | ||
public interface HillaConfiguration { | ||
|
||
/** | ||
* Configuration properties for endpoints live reload. | ||
* | ||
* @return configuration properties for endpoints live reload. | ||
*/ | ||
LiveReloadConfig liveReload(); | ||
|
||
/** | ||
* Configuration properties for endpoints hot reload. | ||
* <p></p> | ||
* The extension watches source folders for changes in Java files and triggers a live reload if affected classes are Hilla endpoints or used in endpoints. | ||
*/ | ||
interface LiveReloadConfig { | ||
|
||
/** | ||
* Enabled endpoints live reload. | ||
* @return {@literal true} if live reload is enabled, otherwise {@literal false} | ||
*/ | ||
@WithDefault("true") | ||
boolean enable(); | ||
|
||
/** | ||
* The list of paths to watch for changes relative to a source folder. | ||
* <p></p> | ||
* For example, given a Maven project with source code in the default {@literal src/main/java} folder and | ||
* endpoints related classes in {@literal src/main/java/com/example/service} and {@literal src/main/java/com/example/model}, | ||
* the configuration should be {@literal vaadin.hilla.live-reload.watchedSourcePaths=com/example/service,com/example/model}. | ||
* <p></p> | ||
* By default, all source folders are watched. | ||
* | ||
* @return the list of source paths to watch for changes. | ||
*/ | ||
Optional<Set<Path>> watchedSourcePaths(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.