From 7e19d997f4839eeac0ee81ec56af446634ec3166 Mon Sep 17 00:00:00 2001 From: Alexey Loubyansky Date: Mon, 16 Dec 2024 15:46:47 +0100 Subject: [PATCH] Introduce IsLocalDevelopment boolean supplier --- .../deployment/IsLocalDevelopment.java | 27 +++++++++++++++++++ .../devui/AgroalDevUIProcessor.java | 4 +-- 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 core/deployment/src/main/java/io/quarkus/deployment/IsLocalDevelopment.java diff --git a/core/deployment/src/main/java/io/quarkus/deployment/IsLocalDevelopment.java b/core/deployment/src/main/java/io/quarkus/deployment/IsLocalDevelopment.java new file mode 100644 index 0000000000000..626b76a2af00a --- /dev/null +++ b/core/deployment/src/main/java/io/quarkus/deployment/IsLocalDevelopment.java @@ -0,0 +1,27 @@ +package io.quarkus.deployment; + +import java.util.function.BooleanSupplier; + +import io.quarkus.dev.spi.DevModeType; +import io.quarkus.runtime.LaunchMode; + +/** + * Similar to {@link IsDevelopment} except checks whether the application is being launched in dev mode but not from a + * {@code mutable-jar} package, + * in other words, not a remote server in a remote dev session. + */ +public class IsLocalDevelopment implements BooleanSupplier { + + private final LaunchMode launchMode; + private final DevModeType devModeType; + + public IsLocalDevelopment(LaunchMode launchMode, DevModeType devModeType) { + this.launchMode = launchMode; + this.devModeType = devModeType; + } + + @Override + public boolean getAsBoolean() { + return launchMode == LaunchMode.DEVELOPMENT && devModeType != DevModeType.REMOTE_SERVER_SIDE; + } +} diff --git a/extensions/agroal/deployment/src/main/java/io/quarkus/agroal/deployment/devui/AgroalDevUIProcessor.java b/extensions/agroal/deployment/src/main/java/io/quarkus/agroal/deployment/devui/AgroalDevUIProcessor.java index aeb86eca3df92..93cc1da30dcbc 100644 --- a/extensions/agroal/deployment/src/main/java/io/quarkus/agroal/deployment/devui/AgroalDevUIProcessor.java +++ b/extensions/agroal/deployment/src/main/java/io/quarkus/agroal/deployment/devui/AgroalDevUIProcessor.java @@ -2,7 +2,7 @@ import io.quarkus.agroal.runtime.DataSourcesJdbcBuildTimeConfig; import io.quarkus.agroal.runtime.dev.ui.DatabaseInspector; -import io.quarkus.deployment.IsDevelopment; +import io.quarkus.deployment.IsLocalDevelopment; import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.deployment.annotations.BuildSteps; @@ -12,7 +12,7 @@ import io.quarkus.devui.spi.page.CardPageBuildItem; import io.quarkus.devui.spi.page.Page; -@BuildSteps(onlyIf = IsDevelopment.class) +@BuildSteps(onlyIf = IsLocalDevelopment.class) class AgroalDevUIProcessor { @BuildStep