diff --git a/deployment/src/main/java/io/quarkiverse/jasperreports/deployment/JasperReportsProcessor.java b/deployment/src/main/java/io/quarkiverse/jasperreports/deployment/JasperReportsProcessor.java index c0674c1..13b4077 100644 --- a/deployment/src/main/java/io/quarkiverse/jasperreports/deployment/JasperReportsProcessor.java +++ b/deployment/src/main/java/io/quarkiverse/jasperreports/deployment/JasperReportsProcessor.java @@ -1,11 +1,13 @@ package io.quarkiverse.jasperreports.deployment; +import static io.quarkus.deployment.pkg.PackageConfig.JarConfig.JarType.UBER_JAR; import static org.jboss.jandex.AnnotationTarget.Kind.CLASS; import java.io.ByteArrayOutputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.net.URL; import java.nio.file.FileVisitResult; import java.nio.file.Files; import java.nio.file.Path; @@ -14,11 +16,20 @@ import java.nio.file.attribute.BasicFileAttributes; import java.nio.file.attribute.FileTime; import java.util.ArrayList; +import java.util.Collections; import java.util.List; +import java.util.Map; import java.util.TreeSet; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Stream; +import jakarta.json.Json; +import jakarta.json.JsonArrayBuilder; +import jakarta.json.JsonObject; +import jakarta.json.JsonReader; +import jakarta.json.JsonWriter; +import jakarta.json.JsonWriterFactory; + import org.apache.commons.lang3.StringUtils; import org.jboss.jandex.AnnotationInstance; import org.jboss.jandex.AnnotationTarget; @@ -37,6 +48,7 @@ import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.arc.deployment.BeanContainerBuildItem; import io.quarkus.deployment.IsDevelopment; +import io.quarkus.deployment.IsNormal; import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.deployment.annotations.ExecutionTime; @@ -44,14 +56,18 @@ import io.quarkus.deployment.builditem.CombinedIndexBuildItem; import io.quarkus.deployment.builditem.FeatureBuildItem; import io.quarkus.deployment.builditem.GeneratedClassBuildItem; +import io.quarkus.deployment.builditem.GeneratedResourceBuildItem; import io.quarkus.deployment.builditem.HotDeploymentWatchedFileBuildItem; import io.quarkus.deployment.builditem.IndexDependencyBuildItem; +import io.quarkus.deployment.builditem.SystemPropertyBuildItem; import io.quarkus.deployment.builditem.nativeimage.NativeImageProxyDefinitionBuildItem; import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem; import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBundleBuildItem; import io.quarkus.deployment.builditem.nativeimage.NativeImageResourcePatternsBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedPackageBuildItem; +import io.quarkus.deployment.pkg.NativeConfig; +import io.quarkus.deployment.pkg.PackageConfig; import io.quarkus.deployment.pkg.builditem.OutputTargetBuildItem; import io.quarkus.deployment.pkg.builditem.UberJarMergedResourceBuildItem; import io.quarkus.jackson.deployment.IgnoreJsonDeserializeClassBuildItem; @@ -81,17 +97,23 @@ FeatureBuildItem feature() { } /** - * Merges the JasperReports extension properties file into the Uber JAR. - *
- * This build step ensures that the JasperReports extension properties file
- * is included in the final Uber JAR, allowing JasperReports to properly
- * load its extensions at runtime.
+ * Merges specified JSON/Properties files if the package type is UBER_JAR and generates them
+ * as resources in the Uber JAR.
*
- * @return A {@link UberJarMergedResourceBuildItem} representing the merged resource
+ * @param generatedResourcesProducer the producer to add generated resources
+ * @param packageConfig the package configuration to check for UBER_JAR type
*/
- @BuildStep
- UberJarMergedResourceBuildItem mergeResource() {
- return new UberJarMergedResourceBuildItem(EXTENSIONS_FILE);
+ @BuildStep(onlyIf = IsNormal.class)
+ void uberJarFiles(BuildProducer