From e688d0bac891864cf0d37c629e13c037f817967d Mon Sep 17 00:00:00 2001 From: Stuart Douglas Date: Thu, 30 Sep 2021 11:08:30 +1000 Subject: [PATCH] Remove vertx-http dependency from gRPC fixes #20334 --- extensions/grpc/deployment/pom.xml | 6 +----- .../devmode/GrpcDevConsoleProcessor.java | 14 +++++--------- .../src/main/resources/dev-templates/service.html | 2 +- .../grpc/devconsole/DevConsoleUnaryMethodTest.java | 2 +- extensions/grpc/runtime/pom.xml | 4 ++-- 5 files changed, 10 insertions(+), 18 deletions(-) diff --git a/extensions/grpc/deployment/pom.xml b/extensions/grpc/deployment/pom.xml index c753299475663..13d7a0ca2b066 100644 --- a/extensions/grpc/deployment/pom.xml +++ b/extensions/grpc/deployment/pom.xml @@ -13,10 +13,6 @@ Quarkus - gRPC - Deployment - - io.quarkus - quarkus-core-deployment - io.quarkus quarkus-arc-deployment @@ -56,7 +52,7 @@ io.quarkus - quarkus-vertx-http-deployment + quarkus-vertx-http-dev-console-spi diff --git a/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/devmode/GrpcDevConsoleProcessor.java b/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/devmode/GrpcDevConsoleProcessor.java index 0e22f8efce87c..343f45d0d68ef 100644 --- a/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/devmode/GrpcDevConsoleProcessor.java +++ b/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/devmode/GrpcDevConsoleProcessor.java @@ -31,7 +31,6 @@ import io.quarkus.arc.deployment.GeneratedBeanBuildItem; import io.quarkus.arc.deployment.GeneratedBeanGizmoAdaptor; import io.quarkus.arc.deployment.UnremovableBeanBuildItem; -import io.quarkus.arc.profile.IfBuildProfile; import io.quarkus.arc.runtime.BeanLookupSupplier; import io.quarkus.deployment.IsDevelopment; import io.quarkus.deployment.annotations.BuildProducer; @@ -44,6 +43,7 @@ import io.quarkus.deployment.builditem.ServiceStartBuildItem; import io.quarkus.dev.console.DevConsoleManager; import io.quarkus.dev.testing.GrpcWebSocketProxy; +import io.quarkus.devconsole.spi.DevConsoleRouteBuildItem; import io.quarkus.devconsole.spi.DevConsoleRuntimeTemplateInfoBuildItem; import io.quarkus.gizmo.ClassCreator; import io.quarkus.gizmo.MethodCreator; @@ -53,8 +53,6 @@ import io.quarkus.grpc.runtime.devmode.DelegatingGrpcBeansStorage; import io.quarkus.grpc.runtime.devmode.GrpcDevConsoleRecorder; import io.quarkus.grpc.runtime.devmode.GrpcServices; -import io.quarkus.vertx.http.deployment.NonApplicationRootPathBuildItem; -import io.quarkus.vertx.http.deployment.RouteBuildItem; public class GrpcDevConsoleProcessor { @@ -67,8 +65,7 @@ public void devConsoleInfo(BuildProducer beans, new BeanLookupSupplier(GrpcServices.class))); } - @IfBuildProfile("dev") - @BuildStep + @BuildStep(onlyIf = IsDevelopment.class) void prepareDelegatingBeanStorage( List delegatingBeans, BuildProducer unremovableBeans, @@ -133,11 +130,9 @@ public void collectMessagePrototypes(CombinedIndexBuildItem index, @Consume(RuntimeConfigSetupCompleteBuildItem.class) @Record(ExecutionTime.RUNTIME_INIT) @BuildStep(onlyIf = IsDevelopment.class) - public RouteBuildItem createWebSocketEndpoint(NonApplicationRootPathBuildItem nonApplicationRootPathBuildItem, - GrpcDevConsoleRecorder recorder) { + public DevConsoleRouteBuildItem createWebSocketEndpoint(GrpcDevConsoleRecorder recorder) { recorder.setServerConfiguration(); - return nonApplicationRootPathBuildItem.routeBuilder().route("dev/grpc-test") - .handler(recorder.handler()).build(); + return new DevConsoleRouteBuildItem("grpc-test", "GET", recorder.handler()); } Collection> getGrpcServices(IndexView index) throws ClassNotFoundException { @@ -167,4 +162,5 @@ Collection> getGrpcServices(IndexView index) throws ClassNotFoundExcept serviceClasses.add(HealthGrpc.class); return serviceClasses; } + } diff --git a/extensions/grpc/deployment/src/main/resources/dev-templates/service.html b/extensions/grpc/deployment/src/main/resources/dev-templates/service.html index 3c9d339dbbb97..f339400225c43 100644 --- a/extensions/grpc/deployment/src/main/resources/dev-templates/service.html +++ b/extensions/grpc/deployment/src/main/resources/dev-templates/service.html @@ -68,7 +68,7 @@ wsUri = "ws:"; } - wsUri += "//" + window.location.host + "/q/dev/grpc-test"; + wsUri += "//" + window.location.host + "/q/dev/io.quarkus.quarkus-grpc/grpc-test"; grpcWS = new WebSocket(wsUri); grpcWS.onopen = function (event) { console.log("websocket connected"); diff --git a/extensions/grpc/deployment/src/test/java/io/quarkus/grpc/devconsole/DevConsoleUnaryMethodTest.java b/extensions/grpc/deployment/src/test/java/io/quarkus/grpc/devconsole/DevConsoleUnaryMethodTest.java index 10b37d2d00e68..82d338c92d0e0 100644 --- a/extensions/grpc/deployment/src/test/java/io/quarkus/grpc/devconsole/DevConsoleUnaryMethodTest.java +++ b/extensions/grpc/deployment/src/test/java/io/quarkus/grpc/devconsole/DevConsoleUnaryMethodTest.java @@ -39,7 +39,7 @@ public void websocketTest() throws Exception { List incomingMessages = new CopyOnWriteArrayList<>(); HttpClient client = vertx.createHttpClient(); - client.webSocket(8080, "localhost", "/q/dev/grpc-test", result -> { + client.webSocket(8080, "localhost", "/q/dev/io.quarkus.quarkus-grpc/grpc-test", result -> { if (result.failed()) { log.error("failure making a web socket connection", result.cause()); return; diff --git a/extensions/grpc/runtime/pom.xml b/extensions/grpc/runtime/pom.xml index d903d623e27e6..8814ac15e363d 100644 --- a/extensions/grpc/runtime/pom.xml +++ b/extensions/grpc/runtime/pom.xml @@ -30,10 +30,10 @@ quarkus-arc - io.quarkus - quarkus-vertx-http + quarkus-vertx-http-dev-console-runtime-spi + true io.quarkus