From 2dd118d2b1ec98886fb2c4e86fca1f0f0e93e9b0 Mon Sep 17 00:00:00 2001 From: Stuart Douglas Date: Tue, 9 Mar 2021 13:07:58 +1100 Subject: [PATCH] Disable DevUI for remote dev mode --- .../runner/bootstrap/AugmentActionImpl.java | 1 + .../devmode/console/DevConsoleProcessor.java | 14 ++++++++++++-- .../java/io/quarkus/maven/it/RemoteDevMojoIT.java | 3 +++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java b/core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java index d67f254a8d1a7..5b41d3c89cf6c 100644 --- a/core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java +++ b/core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java @@ -365,6 +365,7 @@ private BuildResult runAugment(boolean firstRun, Set changedResources, } builder.setLaunchMode(launchMode); + builder.setDevModeType(devModeType); builder.setRebuild(quarkusBootstrap.isRebuild()); if (firstRun) { builder.setLiveReloadState( diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/DevConsoleProcessor.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/DevConsoleProcessor.java index 5b4ef0870ea40..37e506ab8cc93 100644 --- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/DevConsoleProcessor.java +++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/DevConsoleProcessor.java @@ -56,6 +56,7 @@ import io.quarkus.deployment.util.ArtifactInfoUtil; import io.quarkus.deployment.util.WebJarUtil; import io.quarkus.dev.console.DevConsoleManager; +import io.quarkus.dev.spi.DevModeType; import io.quarkus.devconsole.spi.DevConsoleRouteBuildItem; import io.quarkus.devconsole.spi.DevConsoleRuntimeTemplateInfoBuildItem; import io.quarkus.devconsole.spi.DevConsoleTemplateInfoBuildItem; @@ -280,7 +281,11 @@ public void setupActions(List routes, LogStreamRecorder recorder, CurateOutcomeBuildItem curateOutcomeBuildItem, HistoryHandlerBuildItem historyHandlerBuildItem, - NonApplicationRootPathBuildItem nonApplicationRootPathBuildItem) { + NonApplicationRootPathBuildItem nonApplicationRootPathBuildItem, + LaunchModeBuildItem launchModeBuildItem) { + if (launchModeBuildItem.getDevModeType().orElse(null) != DevModeType.LOCAL) { + return; + } initializeVirtual(); newRouter(buildEngine(devTemplatePaths), nonApplicationRootPathBuildItem); @@ -326,7 +331,12 @@ public void setupActions(List routes, public void deployStaticResources(DevConsoleRecorder recorder, CurateOutcomeBuildItem curateOutcomeBuildItem, LaunchModeBuildItem launchMode, ShutdownContextBuildItem shutdownContext, BuildProducer routeBuildItemBuildProducer, - NonApplicationRootPathBuildItem nonApplicationRootPathBuildItem) throws IOException { + NonApplicationRootPathBuildItem nonApplicationRootPathBuildItem, + LaunchModeBuildItem launchModeBuildItem) throws IOException { + + if (launchModeBuildItem.getDevModeType().orElse(DevModeType.LOCAL) != DevModeType.LOCAL) { + return; + } AppArtifact devConsoleResourcesArtifact = WebJarUtil.getAppArtifact(curateOutcomeBuildItem, "io.quarkus", "quarkus-vertx-http-deployment"); diff --git a/integration-tests/maven/src/test/java/io/quarkus/maven/it/RemoteDevMojoIT.java b/integration-tests/maven/src/test/java/io/quarkus/maven/it/RemoteDevMojoIT.java index b6849b389d12e..429aa61401664 100644 --- a/integration-tests/maven/src/test/java/io/quarkus/maven/it/RemoteDevMojoIT.java +++ b/integration-tests/maven/src/test/java/io/quarkus/maven/it/RemoteDevMojoIT.java @@ -54,6 +54,9 @@ public void testThatTheApplicationIsReloadedOnJavaChange() await() .pollDelay(1, TimeUnit.SECONDS) .atMost(1, TimeUnit.MINUTES).until(() -> DevModeTestUtils.getHttpResponse("/app/hello").contains("carambar")); + + //also verify that the dev ui console is disabled + DevModeTestUtils.getHttpResponse("/q/dev", 404, 10, TimeUnit.SECONDS); } @Test