From 2bebd8eb426d054f54ae027d76b3516b84d7085b Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Wed, 26 Jun 2024 12:20:04 +0300 Subject: [PATCH] Provide a configuration option for disabling live-reload The interesting thing is that we essentially already had the core functionality - it was just accessible only by pressing 'l' on the Quarkus command line. This change introduces quarkus.live-reload.enabled which by default is true Closes: #32813 --- .../io/quarkus/deployment/dev/IsolatedDevModeMain.java | 7 +++++-- .../io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java | 5 +++++ .../src/main/java/io/quarkus/runtime/LiveReloadConfig.java | 6 ++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java index 0fbd24bd9f3b7..5096086bac47e 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java @@ -113,8 +113,11 @@ public void accept(Integer integer) { StartupAction start = augmentAction.createInitialRuntimeApplication(); runner = start.runMainClass(context.getArgs()); - RuntimeUpdatesProcessor.INSTANCE.setConfiguredInstrumentationEnabled( - runner.getConfigValue("quarkus.live-reload.instrumentation", Boolean.class).orElse(false)); + RuntimeUpdatesProcessor.INSTANCE + .setConfiguredInstrumentationEnabled( + runner.getConfigValue("quarkus.live-reload.instrumentation", Boolean.class).orElse(false)) + .setLiveReloadEnabled( + runner.getConfigValue("quarkus.live-reload.enabled", Boolean.class).orElse(false)); firstStartCompleted = true; notifyListenersAfterStart(); diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java index 3fc9ece918749..f32d052a25aec 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java @@ -619,6 +619,11 @@ public boolean instrumentationEnabled() { return configuredInstrumentationEnabled; } + public RuntimeUpdatesProcessor setLiveReloadEnabled(boolean liveReloadEnabled) { + this.liveReloadEnabled = liveReloadEnabled; + return this; + } + public RuntimeUpdatesProcessor setConfiguredInstrumentationEnabled(boolean configuredInstrumentationEnabled) { this.configuredInstrumentationEnabled = configuredInstrumentationEnabled; return this; diff --git a/core/runtime/src/main/java/io/quarkus/runtime/LiveReloadConfig.java b/core/runtime/src/main/java/io/quarkus/runtime/LiveReloadConfig.java index 28c18e42a972e..4e3d7cc6ed71f 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/LiveReloadConfig.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/LiveReloadConfig.java @@ -11,6 +11,12 @@ @ConfigRoot(phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED) public class LiveReloadConfig { + /** + * Whether the live-reload feature should be enabled. + */ + @ConfigItem(defaultValue = "true") + boolean enabled; + /** * Whether Quarkus should enable its ability to not do a full restart * when changes to classes are compatible with JVM instrumentation.