Skip to content

Commit

Permalink
Fix CI issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ia3andy committed Aug 28, 2024
1 parent cacd915 commit 8dccb4e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import io.quarkus.deployment.annotations.ExecutionTime;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;

Expand All @@ -34,8 +35,10 @@ FeatureBuildItem feature() {
@Record(ExecutionTime.STATIC_INIT)
void generateSyntheticBeans(BuildProducer<SyntheticBeanBuildItem> beansProducer,
List<RoqDataJsonBuildItem> roqDataJsonBuildItems,
BuildProducer<ReflectiveClassBuildItem> reflectiveClassProducer,
RoqDataRecorder recorder) {

reflectiveClassProducer.produce(
ReflectiveClassBuildItem.builder(JsonObject.class).serialization().constructors().fields().methods().build());
for (RoqDataJsonBuildItem roqData : roqDataJsonBuildItems) {
if (roqData.getData() instanceof JsonObject) {
beansProducer.produce(SyntheticBeanBuildItem.configure(JsonObject.class)
Expand All @@ -58,8 +61,11 @@ void generateSyntheticBeans(BuildProducer<SyntheticBeanBuildItem> beansProducer,
@BuildStep
@Record(ExecutionTime.STATIC_INIT)
void generateDataMappings(RoqDataRecorder roqDataRecorder, List<RoqDataBeanBuildItem> dataBeanBuildItems,
BuildProducer<ReflectiveClassBuildItem> reflectiveClassProducer,
BuildProducer<SyntheticBeanBuildItem> syntheticBeansProducer) {
for (RoqDataBeanBuildItem beanBuildItem : dataBeanBuildItems) {
reflectiveClassProducer.produce(ReflectiveClassBuildItem.builder(beanBuildItem.getBeanClass()).serialization()
.constructors().fields().methods().build());
syntheticBeansProducer.produce(SyntheticBeanBuildItem.configure(beanBuildItem.getBeanClass())
.scope(beanBuildItem.isRecord() ? Singleton.class : ApplicationScoped.class)
.named(beanBuildItem.getName())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ void generateTemplate(
}
validationParserHookProducer.produce(new ValidationParserHookBuildItem(c -> {
if (templates.contains(c.getTemplateId())) {
//c.addParameter("page", Page.class.getName());
//c.addParameter("site", Site.class.getName());
//c.addParameter("collections", RoqCollections.class.getName());
c.addParameter("page", Page.class.getName());
c.addParameter("site", Site.class.getName());
c.addParameter("collections", RoqCollections.class.getName());
}
}));

Expand All @@ -83,7 +83,7 @@ AdditionalIndexedClassesBuildItem addSite() {
}

@BuildStep
@Record(ExecutionTime.RUNTIME_INIT)
@Record(ExecutionTime.STATIC_INIT)
RoqFrontMatterOutputBuildItem bindFrontMatterData(BuildProducer<SyntheticBeanBuildItem> beansProducer,
List<RoqFrontMatterBuildItem> roqFrontMatterBuildItems,
RoqFrontMatterRecorder recorder) {
Expand All @@ -108,7 +108,6 @@ RoqFrontMatterOutputBuildItem bindFrontMatterData(BuildProducer<SyntheticBeanBui

beansProducer.produce(SyntheticBeanBuildItem.configure(Page.class)
.scope(Singleton.class)
.setRuntimeInit()
.unremovable()
.addQualifier().annotation(Named.class).addValue("value", name).done()
.runtimeValue(recordedPage)
Expand All @@ -117,7 +116,6 @@ RoqFrontMatterOutputBuildItem bindFrontMatterData(BuildProducer<SyntheticBeanBui
}
beansProducer.produce(SyntheticBeanBuildItem.configure(RoqCollections.class)
.scope(Singleton.class)
.setRuntimeInit()
.unremovable()
.supplier(recorder.createRoqCollections(collections))
.done());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ private static Consumer<Path> addBuildItem(Path root, HashSet<RoqFrontMatterBuil
boolean isLayout) {
return file -> {
watch.produce(HotDeploymentWatchedFileBuildItem.builder().setLocation(file.toAbsolutePath().toString()).build());
var relative = collection != null ? collection + "/" + root.relativize(file) : root.relativize(file).toString();
var relative = toUnixPath(
collection != null ? collection + "/" + root.relativize(file) : root.relativize(file).toString());
String sourcePath = relative;
String templatePath = removeExtension(relative) + ".html";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
package io.quarkiverse.roq.frontmatter.runtime;

import java.util.HashMap;
import java.util.Map;

public class RoqCollections extends HashMap<String, RoqCollection> {

public RoqCollections(Map<String, RoqCollection> map) {
super(map);
}
public record RoqCollections(Map<String, RoqCollection> collections) {

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ public static Object data(Page page, String key) {
return page.data(key);
}

@TemplateExtension(matchName = "*")
public static RoqCollection data(RoqCollections collections, String key) {
return collections.collections().get(key);
}

@TemplateExtension
public static Object readTime(Page page) {
final long count = numberOfWords(page.rawContent());
Expand Down

0 comments on commit 8dccb4e

Please sign in to comment.