Skip to content

Commit

Permalink
Fix #128 AsciiDoc native support
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Oct 24, 2024
1 parent b23d627 commit 0c1e37f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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 {

Expand All @@ -15,8 +21,25 @@ FeatureBuildItem feature() {
return new FeatureBuildItem(FEATURE);
}

@BuildStep
void indexTransitiveDependencies(BuildProducer<IndexDependencyBuildItem> index) {
index.produce(new IndexDependencyBuildItem("io.yupiik.maven", "asciidoc-java"));
index.produce(new IndexDependencyBuildItem("io.yupiik.maven", "ascii2svg"));
}

@BuildStep
void process(BuildProducer<AdditionalBeanBuildItem> additionalBeans) {
additionalBeans.produce(new AdditionalBeanBuildItem(AsciidocSectionHelperFactory.class));
}
}

@BuildStep
void registerOpenPdfForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
CombinedIndexBuildItem combinedIndex) {
final List<String> classNames = new ArrayList<>();
classNames.add(io.yupiik.tools.ascii2svg.Svg.class.getName());

reflectiveClass.produce(
ReflectiveClassBuildItem.builder(classNames.toArray(new String[0])).methods().fields().build());
}

}
7 changes: 6 additions & 1 deletion asciidoc/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
<artifactId>asciidoc-java</artifactId>
<version>${asciidoc.java.version}</version>
</dependency>
<dependency>
<groupId>io.yupiik.maven</groupId>
<artifactId>ascii2svg</artifactId>
<version>${asciidoc.java.version}</version>
</dependency>
</dependencies>

<build>
Expand Down Expand Up @@ -54,4 +59,4 @@
</plugin>
</plugins>
</build>
</project>
</project>

0 comments on commit 0c1e37f

Please sign in to comment.