From 6aa874564395fb7c2239de4fb1a1a280aba7ac90 Mon Sep 17 00:00:00 2001 From: melloware Date: Tue, 22 Oct 2024 10:08:24 -0400 Subject: [PATCH 1/2] Fix #128 AsciiDoc native support --- .../deployment/QuteWebAsciidocProcessor.java | 25 ++++++++++++++++++- asciidoc/runtime/pom.xml | 7 +++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/asciidoc/deployment/src/main/java/io/quarkiverse/qute/web/asciidoc/deployment/QuteWebAsciidocProcessor.java b/asciidoc/deployment/src/main/java/io/quarkiverse/qute/web/asciidoc/deployment/QuteWebAsciidocProcessor.java index 970f369a..4d511235 100644 --- a/asciidoc/deployment/src/main/java/io/quarkiverse/qute/web/asciidoc/deployment/QuteWebAsciidocProcessor.java +++ b/asciidoc/deployment/src/main/java/io/quarkiverse/qute/web/asciidoc/deployment/QuteWebAsciidocProcessor.java @@ -1,10 +1,16 @@ package io.quarkiverse.qute.web.asciidoc.deployment; +import java.util.ArrayList; +import java.util.List; + import io.quarkiverse.qute.web.asciidoc.runtime.AsciidocSectionHelperFactory; import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; +import io.quarkus.deployment.builditem.CombinedIndexBuildItem; import io.quarkus.deployment.builditem.FeatureBuildItem; +import io.quarkus.deployment.builditem.IndexDependencyBuildItem; +import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; class QuteWebAsciidocProcessor { @@ -15,8 +21,25 @@ FeatureBuildItem feature() { return new FeatureBuildItem(FEATURE); } + @BuildStep + void indexTransitiveDependencies(BuildProducer index) { + index.produce(new IndexDependencyBuildItem("io.yupiik.maven", "asciidoc-java")); + index.produce(new IndexDependencyBuildItem("io.yupiik.maven", "ascii2svg")); + } + @BuildStep void process(BuildProducer additionalBeans) { additionalBeans.produce(new AdditionalBeanBuildItem(AsciidocSectionHelperFactory.class)); } -} + + @BuildStep + void registerOpenPdfForReflection(BuildProducer reflectiveClass, + CombinedIndexBuildItem combinedIndex) { + final List classNames = new ArrayList<>(); + classNames.add(io.yupiik.tools.ascii2svg.Svg.class.getName()); + + reflectiveClass.produce( + ReflectiveClassBuildItem.builder(classNames.toArray(new String[0])).methods().fields().build()); + } + +} \ No newline at end of file diff --git a/asciidoc/runtime/pom.xml b/asciidoc/runtime/pom.xml index 93c04471..39b2f0f2 100644 --- a/asciidoc/runtime/pom.xml +++ b/asciidoc/runtime/pom.xml @@ -20,6 +20,11 @@ asciidoc-java ${asciidoc.java.version} + + io.yupiik.maven + ascii2svg + ${asciidoc.java.version} + @@ -54,4 +59,4 @@ - + \ No newline at end of file From b6dd42e48e6f8434fff2a831ff6e4ce5d9cf6313 Mon Sep 17 00:00:00 2001 From: Andy Damevin Date: Wed, 30 Oct 2024 11:49:54 +0100 Subject: [PATCH 2/2] Remove uncessary indexing --- .../deployment/QuteWebAsciidocProcessor.java | 9 +---- .../main/resources/templates/pub/hello.html | 35 +++++++++++++++++++ .../qute/web/it/QuteWebAsciiDocTest.java | 2 +- 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/asciidoc/deployment/src/main/java/io/quarkiverse/qute/web/asciidoc/deployment/QuteWebAsciidocProcessor.java b/asciidoc/deployment/src/main/java/io/quarkiverse/qute/web/asciidoc/deployment/QuteWebAsciidocProcessor.java index 4d511235..7b84cf17 100644 --- a/asciidoc/deployment/src/main/java/io/quarkiverse/qute/web/asciidoc/deployment/QuteWebAsciidocProcessor.java +++ b/asciidoc/deployment/src/main/java/io/quarkiverse/qute/web/asciidoc/deployment/QuteWebAsciidocProcessor.java @@ -9,7 +9,6 @@ import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.deployment.builditem.CombinedIndexBuildItem; import io.quarkus.deployment.builditem.FeatureBuildItem; -import io.quarkus.deployment.builditem.IndexDependencyBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; class QuteWebAsciidocProcessor { @@ -21,12 +20,6 @@ FeatureBuildItem feature() { return new FeatureBuildItem(FEATURE); } - @BuildStep - void indexTransitiveDependencies(BuildProducer index) { - index.produce(new IndexDependencyBuildItem("io.yupiik.maven", "asciidoc-java")); - index.produce(new IndexDependencyBuildItem("io.yupiik.maven", "ascii2svg")); - } - @BuildStep void process(BuildProducer additionalBeans) { additionalBeans.produce(new AdditionalBeanBuildItem(AsciidocSectionHelperFactory.class)); @@ -42,4 +35,4 @@ void registerOpenPdfForReflection(BuildProducer reflec ReflectiveClassBuildItem.builder(classNames.toArray(new String[0])).methods().fields().build()); } -} \ No newline at end of file +} diff --git a/asciidoc/integration-tests/src/main/resources/templates/pub/hello.html b/asciidoc/integration-tests/src/main/resources/templates/pub/hello.html index 70577e07..654897b3 100644 --- a/asciidoc/integration-tests/src/main/resources/templates/pub/hello.html +++ b/asciidoc/integration-tests/src/main/resources/templates/pub/hello.html @@ -31,6 +31,41 @@ \{project-version} ---- + + [%collapsible] + ==== + You can do that using several ways : + + [qanda] + Manually:: + [source,xml] + .pom.xml + ---- + + io.quarkiverse.roq + quarkus-roq-plugin-asciidoc + $\{quarkus-roq.version\} + + ---- + + Using the Quarkus cli:: + [source,shell] + ---- + quarkus extension add io.quarkiverse.roq:quarkus-roq-plugin-asciidoc + ---- + + Using the Maven:: + [source,shell] + ---- + ./mvnw quarkus:add-extension -Dextensions="io.quarkiverse.roq:quarkus-roq-plugin-asciidoc" + ---- + + Using the Gradle:: + [source,shell] + ---- + ./gradlew addExtension --extensions="io.quarkiverse.roq:quarkus-roq-plugin-asciidoc" + ---- + ==== {/} \ No newline at end of file diff --git a/asciidoc/integration-tests/src/test/java/io/quarkiverse/qute/web/it/QuteWebAsciiDocTest.java b/asciidoc/integration-tests/src/test/java/io/quarkiverse/qute/web/it/QuteWebAsciiDocTest.java index 2ca7538d..6a5fb595 100644 --- a/asciidoc/integration-tests/src/test/java/io/quarkiverse/qute/web/it/QuteWebAsciiDocTest.java +++ b/asciidoc/integration-tests/src/test/java/io/quarkiverse/qute/web/it/QuteWebAsciiDocTest.java @@ -18,7 +18,7 @@ public void testTemplates() { .when().get("/hello") .then() .statusCode(200) - .log().all() + .log().ifValidationFails() .body("html.body.p[0]", equalTo("Hello world!")) .body("html.body.div.div.div.ul.li[0].p", equalToCompressingWhiteSpace("Joe")) .body("html.body.div.h2", equalTo("Installation"))