From fcc76654028b534120936d78aad0faeee07c6480 Mon Sep 17 00:00:00 2001 From: Clement Escoffier Date: Tue, 17 Jan 2023 08:56:29 +0100 Subject: [PATCH] When using Gradle with extensions generating source code (gRPC, Avro...), the JavaScript identifiers used to build the source map were not valid (because they contained `-`). This commit fixes it by replacing the `-` with `_`. Fix #30288 (cherry picked from commit 5079fd0185739d1f22f411e65a49259096c299a3) --- .../deployment/devmode/console/DevConsoleProcessor.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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 c95b37cbd1302..5afe466d5054a 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 @@ -928,7 +928,7 @@ public Object apply(EvalContext ctx) { String ctxName = ctx.getName(); List sourcesDir = DevConsoleManager.getHotReplacementContext().getSourcesDir(); - if (ctxName.equals("sourcePackages")) { + if (ctxName.endsWith("sourcePackages")) { if (disable) { return Collections.emptyList(); // we need this here because the result needs to be iterable } @@ -938,12 +938,15 @@ public Object apply(EvalContext ctx) { String lang = sourcePaths.getFileName().toString(); List packages = sourcePackagesForRoot(sourcePaths); if (!packages.isEmpty()) { - sourcePackagesByLang.put(lang, packages); + // The `replace` is used to avoid invalid JavaScript identifier (using `-`) + // It happens when using Gradle and extensions generating code (Avro, gRPC...) + // See https://github.com/quarkusio/quarkus/issues/30288. + sourcePackagesByLang.put(lang.replace("-", "_"), packages); } } return sourcePackagesByLang; } - if (ctxName.equals("locationPackages")) { + if (ctxName.endsWith("locationPackages")) { if (disable) { return Collections.emptyList(); // we need this here because the result needs to be iterable }