From 607e6f6a47d57ac13e2a41b34c456ff0fa7d7c7f Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Mon, 28 Oct 2024 18:44:48 +0100 Subject: [PATCH] Codestarts - Do not reference ITs module if extension without ITs When creating a project without ITs, we don't generate the ITs module so we shouldn't reference it in the parent POM. Fixes #37216 (cherry picked from commit a09e7159d7ad91716ccaacf7fe1d27df8967bd00) --- .../quarkus-extension/code/quarkiverse/java/pom.tpl.qute.xml | 2 ++ .../extension/QuarkusExtensionCodestartCatalog.java | 3 ++- .../java/io/quarkus/devtools/commands/CreateExtension.java | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus-extension/code/quarkiverse/java/pom.tpl.qute.xml b/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus-extension/code/quarkiverse/java/pom.tpl.qute.xml index 7c22949f418c1..8a49be5802fcd 100644 --- a/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus-extension/code/quarkiverse/java/pom.tpl.qute.xml +++ b/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus-extension/code/quarkiverse/java/pom.tpl.qute.xml @@ -21,6 +21,7 @@ {/if} + {#if has-integration-tests-module} it @@ -35,4 +36,5 @@ + {/if} diff --git a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/codestarts/extension/QuarkusExtensionCodestartCatalog.java b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/codestarts/extension/QuarkusExtensionCodestartCatalog.java index c3cedb8417823..3ff7119e2ce10 100644 --- a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/codestarts/extension/QuarkusExtensionCodestartCatalog.java +++ b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/codestarts/extension/QuarkusExtensionCodestartCatalog.java @@ -50,7 +50,8 @@ public enum QuarkusExtensionData implements DataKey { IT_PARENT_RELATIVE_PATH("it-parent.relative-path"), MAVEN_QUARKUS_EXTENSION_PLUGIN("maven.quarkus-extension-plugin"), MAVEN_COMPILER_PLUGIN_VERSION("maven.compiler-plugin-version"), - HAS_DOCS_MODULE("has-docs-module"); + HAS_DOCS_MODULE("has-docs-module"), + HAS_INTEGRATION_TESTS_MODULE("has-integration-tests-module"); private final String key; diff --git a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/commands/CreateExtension.java b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/commands/CreateExtension.java index 0b423e0a9ec6c..41437b50048d2 100644 --- a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/commands/CreateExtension.java +++ b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/commands/CreateExtension.java @@ -8,6 +8,7 @@ import static io.quarkus.devtools.codestarts.extension.QuarkusExtensionCodestartCatalog.QuarkusExtensionData.EXTENSION_NAME; import static io.quarkus.devtools.codestarts.extension.QuarkusExtensionCodestartCatalog.QuarkusExtensionData.GROUP_ID; import static io.quarkus.devtools.codestarts.extension.QuarkusExtensionCodestartCatalog.QuarkusExtensionData.HAS_DOCS_MODULE; +import static io.quarkus.devtools.codestarts.extension.QuarkusExtensionCodestartCatalog.QuarkusExtensionData.HAS_INTEGRATION_TESTS_MODULE; import static io.quarkus.devtools.codestarts.extension.QuarkusExtensionCodestartCatalog.QuarkusExtensionData.IT_PARENT_ARTIFACT_ID; import static io.quarkus.devtools.codestarts.extension.QuarkusExtensionCodestartCatalog.QuarkusExtensionData.IT_PARENT_GROUP_ID; import static io.quarkus.devtools.codestarts.extension.QuarkusExtensionCodestartCatalog.QuarkusExtensionData.IT_PARENT_RELATIVE_PATH; @@ -105,6 +106,7 @@ public enum LayoutType { private String extensionsRelativeDir = "extensions"; private boolean withCodestart; private String javaVersion; + private boolean hasIntegrationTestsModule; public CreateExtension(final Path baseDir) { this.baseDir = requireNonNull(baseDir, "extensionDirPath is required"); @@ -218,6 +220,7 @@ public CreateExtension withoutDevModeTest(boolean withoutDevModeTest) { } public CreateExtension withoutIntegrationTests(boolean withoutIntegrationTest) { + hasIntegrationTestsModule = !withoutIntegrationTest; this.builder.withoutIntegrationTests(withoutIntegrationTest); return this; } @@ -263,6 +266,7 @@ public CreateExtensionCommandHandler prepare() throws QuarkusCommandException { data.putIfAbsent(CLASS_NAME_BASE, toCapCamelCase(extensionId)); data.put(EXTENSION_FULL_NAME, data.getRequiredStringValue(NAMESPACE_NAME) + data.getRequiredStringValue(EXTENSION_NAME)); + data.put(HAS_INTEGRATION_TESTS_MODULE, hasIntegrationTestsModule); // for now, we only support Java extensions data.put(JAVA_VERSION, javaVersion == null ? JavaVersion.DEFAULT_JAVA_VERSION_FOR_EXTENSION