diff --git a/deployment/pom.xml b/deployment/pom.xml index e36333c..1895c92 100644 --- a/deployment/pom.xml +++ b/deployment/pom.xml @@ -20,6 +20,14 @@ io.quarkus quarkus-agroal-deployment + + io.quarkus + quarkus-arc-deployment + + + io.quarkus + quarkus-narayana-jta-deployment + io.quarkiverse.jooq diff --git a/deployment/src/main/java/io/quarkiverse/jooq/deployment/JooqProcessor.java b/deployment/src/main/java/io/quarkiverse/jooq/deployment/JooqProcessor.java index 49cd8b3..d29a5fe 100644 --- a/deployment/src/main/java/io/quarkiverse/jooq/deployment/JooqProcessor.java +++ b/deployment/src/main/java/io/quarkiverse/jooq/deployment/JooqProcessor.java @@ -3,6 +3,8 @@ import java.util.List; import java.util.Map.Entry; import java.util.Optional; +import java.util.function.BooleanSupplier; +import java.util.regex.Pattern; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.inject.Default; @@ -31,8 +33,10 @@ import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.deployment.annotations.ExecutionTime; import io.quarkus.deployment.annotations.Record; +import io.quarkus.deployment.builditem.CombinedIndexBuildItem; import io.quarkus.deployment.builditem.FeatureBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; +import io.quarkus.deployment.pkg.steps.NativeBuild; import io.quarkus.deployment.recording.RecorderContext; import io.quarkus.gizmo.*; import io.quarkus.runtime.util.HashUtil; @@ -59,6 +63,18 @@ FeatureBuildItem featureBuildItem() { return new FeatureBuildItem(FEATURE); } + @BuildStep(onlyIf = { NativeBuild.class, RegisterClassesForReflectionEnabled.class }) + public void registerReflections(CombinedIndexBuildItem indexBuildItem, + BuildProducer reflectiveClass, + JooqConfig jooqConfig) { + Pattern jooqDBReflectClasses = Pattern.compile(jooqConfig.generatedClassesRegex); + indexBuildItem.getIndex() + .getKnownClasses() + .stream() + .filter(o -> jooqDBReflectClasses.matcher(o.name().toString()).matches()) + .forEach(clazz -> reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, clazz.name().toString()))); + } + @SuppressWarnings("unchecked") @Record(ExecutionTime.STATIC_INIT) @BuildStep @@ -276,4 +292,12 @@ protected void createDslContextProducerBean(BuildProducer