From 60b738080185834847ffc934b61b7c0a330a33b2 Mon Sep 17 00:00:00 2001 From: Andy Damevin Date: Mon, 17 Jun 2024 14:18:58 +0200 Subject: [PATCH] Fix index.html for compat before 3.9 and dynamic index (cherry picked from commit 0c265bc31254d9a12e371f607cf289881327eb78) --- .../META-INF/resources/index.tpl.qute.html | 288 ++++++++++++++++++ ...tentMergeCodestartFileStrategyHandler.java | 13 +- 2 files changed, 300 insertions(+), 1 deletion(-) create mode 100644 independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/project/quarkus/base/src/main/resources/META-INF/resources/index.tpl.qute.html diff --git a/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/project/quarkus/base/src/main/resources/META-INF/resources/index.tpl.qute.html b/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/project/quarkus/base/src/main/resources/META-INF/resources/index.tpl.qute.html new file mode 100644 index 0000000000000..4d248f14aaa89 --- /dev/null +++ b/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/project/quarkus/base/src/main/resources/META-INF/resources/index.tpl.qute.html @@ -0,0 +1,288 @@ +{#if quarkus.platform.version.compareVersionTo("3.9") < 0} + + + + + {project.artifact-id} - {project.version} + + + +
+
+
+ + + + + quarkus_logo_horizontal_rgb_1280px_reverse + + + + + + + + + + + + + + + + + + +
+
+
+ +
+
+
+

You just made a Quarkus application.

+

This page is served by Quarkus.

+ Visit the Dev UI +

This page: src/main/resources/META-INF/resources/index.html

+

App configuration: src/main/resources/{config.file-name}

+

Static assets: src/main/resources/META-INF/resources/

+

Code: {language.dir.code}

+

Generated starter code:

+
    + {merged-content} +
+
+
+ {#if input.selected-extensions} +

Selected extensions

+
    + {#for ext in input.selected-extensions} + {#if ext.guide} +
  • {ext.name} (guide)
  • + {#else} +
  • {ext.name}
  • + {/if} + {/for} +
+ {/if} +
Documentation
+

Practical step-by-step guides to help you achieve a specific goal. Use them to help get your work + done.

+
Set up your IDE
+

Everyone has a favorite IDE they like to use to code. Learn how to configure yours to maximize your + Quarkus productivity.

+
+
+
+ + +{/if} diff --git a/independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/core/strategy/ContentMergeCodestartFileStrategyHandler.java b/independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/core/strategy/ContentMergeCodestartFileStrategyHandler.java index ab80c50ededb0..04dc4ce84d6b0 100644 --- a/independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/core/strategy/ContentMergeCodestartFileStrategyHandler.java +++ b/independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/core/strategy/ContentMergeCodestartFileStrategyHandler.java @@ -9,6 +9,13 @@ import io.quarkus.devtools.codestarts.CodestartStructureException; import io.quarkus.devtools.codestarts.core.reader.TargetFile; +/** + * + * @deprecated this was a quick-n-dirty way to allow extensions to provide content to the index.html, + * we don't need it anymore with the dynamic index.html. If we need something similar in the future let's find a + * more elegant way. + */ +@Deprecated final class ContentMergeCodestartFileStrategyHandler implements CodestartFileStrategyHandler { static final String NAME = "content-merge"; @@ -40,6 +47,10 @@ public void process(Path targetDirectory, String relativePath, List return; } createDirectories(targetPath); - writeFile(targetPath, template.get().getContent().replace("{merged-content}", mergedContent.toString())); + final String content = template.get().getContent(); + if (content.isBlank()) { + return; + } + writeFile(targetPath, content.replace("{merged-content}", mergedContent.toString())); } }