Skip to content

Commit

Permalink
Fix #74: JasperReports 7.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Oct 3, 2024
1 parent 713bf0c commit 3c35c67
Show file tree
Hide file tree
Showing 9 changed files with 14,097 additions and 14,045 deletions.
20 changes: 1 addition & 19 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,7 @@ updates:
- dependency-name: "io.quarkus:quarkus-maven-plugin"
- dependency-name: "io.quarkus:quarkus-extension-processor"
- dependency-name: "io.quarkus:quarkus-extension-maven-plugin"
- dependency-name: "net.sf.jasperreports:jasperreports"
- dependency-name: "net.sf.jasperreports:jasperreports-fonts"
- dependency-name: "jaxen:jaxen"
groups:
quarkus:
patterns:
- "io.quarkus*"
- "quarkus*"
quarkiverse:
patterns:
- "io.quarkiverse*"
dependencies:
patterns:
- "*"
exclude-patterns:
- "io.quarkus*"
- "quarkus*"
- "io.quarkiverse*"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
interval: "daily"
9 changes: 9 additions & 0 deletions deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-awt-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jaxb-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.poi</groupId>
<artifactId>quarkus-poi-deployment</artifactId>
<version>${version.quarkus-poi}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-vertx-http-dev-ui-spi</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
package io.quarkiverse.jasperreports.deployment;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;

import org.jboss.jandex.ClassInfo;
import org.jboss.jandex.DotName;

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.NativeImageResourceBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBundleBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedPackageBuildItem;
import io.quarkus.deployment.pkg.builditem.UberJarMergedResourceBuildItem;

Expand All @@ -25,24 +33,62 @@ UberJarMergedResourceBuildItem mergeResource() {
return new UberJarMergedResourceBuildItem(EXTENSIONS_FILE);
}

@BuildStep
void indexTransitiveDependencies(BuildProducer<IndexDependencyBuildItem> index) {
index.produce(new IndexDependencyBuildItem("net.sf.jasperreports", "jasperreports"));
index.produce(new IndexDependencyBuildItem("net.sf.jasperreports", "jasperreports-jaxen"));
index.produce(new IndexDependencyBuildItem("org.apache.xmlgraphics", "batik-bridge"));
index.produce(new IndexDependencyBuildItem("org.apache.xmlgraphics", "batik-gvt"));
}

@BuildStep
void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
CombinedIndexBuildItem combinedIndex) {

final List<String> classNames = new ArrayList<>();
classNames.addAll(collectClassesInPackage(combinedIndex, org.apache.batik.gvt.font.AWTGVTFont.class.getPackageName()));
classNames.addAll(collectClassesInPackage(combinedIndex,
net.sf.jasperreports.engine.fonts.FontExtensionsRegistry.class.getPackageName()));
classNames.addAll(collectClassesInPackage(combinedIndex,
net.sf.jasperreports.engine.util.ImageUtil.class.getPackageName()));

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

@BuildStep
void runtimeInitializedClasses(BuildProducer<RuntimeInitializedPackageBuildItem> runtimeInitializedPackages) {
//@formatter:off
Stream.of(
javax.swing.plaf.metal.MetalIconFactory.class.getPackageName(),
net.sf.jasperreports.data.http.HttpDataService.class.getPackageName(),
net.sf.jasperreports.engine.SimpleReportContext.class.getPackageName(),
net.sf.jasperreports.engine.design.JRAbstractCompiler.class.getPackageName(),
net.sf.jasperreports.engine.export.JRXlsExporter.class.getPackageName(),
net.sf.jasperreports.engine.export.oasis.JROdtExporter.class.getPackageName(),
net.sf.jasperreports.engine.export.ooxml.DocxRunHelper.class.getPackageName(),
net.sf.jasperreports.engine.fonts.AwtFontManager.class.getPackageName(),
net.sf.jasperreports.engine.print.JRPrinterAWT.class.getPackageName(),
net.sf.jasperreports.engine.type.ColorEnum.class.getPackageName(),
net.sf.jasperreports.engine.util.ExifUtil.class.getPackageName(),
net.sf.jasperreports.engine.util.json.DefaultJsonQLExecuter.class.getPackageName(),
net.sf.jasperreports.renderers.AbstractSvgDataToGraphics2DRenderer.class.getPackageName(),
net.sf.jasperreports.renderers.util.SvgFontProcessor.class.getPackageName()
"org.apache.xmlbeans.impl.config.Parser",
"javax.swing.plaf.metal",
"javax.swing.text.rtf",
"javax.swing.text.html",
"sun.swing.SwingUtilities2",
org.apache.batik.bridge.CSSUtilities.class.getPackageName(),
org.apache.batik.css.engine.SystemColorSupport.class.getPackageName(),
org.apache.batik.dom.svg.AbstractSVGTransform.class.getPackageName(),
org.apache.batik.anim.values.AnimatableTransformListValue.class.getPackageName(),
org.apache.batik.ext.awt.MultipleGradientPaint.class.getPackageName(),
org.apache.batik.ext.awt.image.GraphicsUtil.class.getPackageName(),
org.apache.batik.ext.awt.image.rendered.TurbulencePatternRed.class.getPackageName(),
org.apache.batik.ext.awt.image.spi.DefaultBrokenLinkProvider.class.getName(),
org.apache.batik.gvt.CompositeGraphicsNode.class.getPackageName(),
org.apache.batik.gvt.renderer.MacRenderer.class.getPackageName(),
org.apache.batik.script.InterpreterPool.class.getName(),
org.apache.xmlbeans.impl.schema.TypeSystemHolder.class.getName(),
org.apache.xmlbeans.impl.xpath.saxon.SaxonXPath.class.getName(),
net.sf.jasperreports.components.list.UnusedSpaceImageRenderer.class.getName(),
net.sf.jasperreports.components.util.AbstractFieldComparator.class.getPackageName(),
net.sf.jasperreports.engine.SimpleReportContext.class.getPackageName(),
net.sf.jasperreports.engine.base.ElementsBlock.class.getPackageName(),
net.sf.jasperreports.engine.convert.ReportConverter.class.getName(),
net.sf.jasperreports.engine.export.AbstractTextRenderer.class.getPackageName(),
net.sf.jasperreports.engine.fill.JRFillSubreport.class.getPackageName(),
net.sf.jasperreports.engine.fonts.AwtFontManager.class.getPackageName(),
net.sf.jasperreports.engine.type.ColorEnum.class.getPackageName(),
net.sf.jasperreports.engine.util.JRQueryExecuterUtils.class.getPackageName()

)
.map(RuntimeInitializedPackageBuildItem::new)
.forEach(runtimeInitializedPackages::produce);
Expand All @@ -58,10 +104,26 @@ void substrateResourceBuildItems(BuildProducer<NativeImageResourceBuildItem> nat
"jasperreports_messages.properties",
"metadata_messages.properties",
"metadata_messages-defaults.properties",
"properties-metadata.json"));
"properties-metadata.json",
"net/sf/jasperreports/fonts/dejavu/jasperreports-fonts.xml"));

resourceBundleBuildItem.produce(new NativeImageResourceBundleBuildItem("jasperreports_messages"));
resourceBundleBuildItem.produce(new NativeImageResourceBundleBuildItem("metadata_messages"));
resourceBundleBuildItem.produce(new NativeImageResourceBundleBuildItem("metadata_messages-defaults"));
}

public List<String> collectClassesInPackage(CombinedIndexBuildItem combinedIndex, String packageName) {
final List<String> classes = new ArrayList<>();
final List<DotName> packages = new ArrayList<>(combinedIndex.getIndex().getSubpackages(packageName));
packages.add(DotName.createSimple(packageName));
for (DotName aPackage : packages) {
final List<String> packageClasses = combinedIndex.getIndex()
.getClassesInPackage(aPackage)
.stream()
.map(ClassInfo::toString)
.toList();
classes.addAll(packageClasses);
}
return classes;
}
}
5 changes: 4 additions & 1 deletion integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive</artifactId>
<artifactId>quarkus-rest</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.jasperreports</groupId>
Expand Down Expand Up @@ -103,6 +103,9 @@
<properties>
<skipITs>false</skipITs>
<quarkus.package.type>native</quarkus.package.type>
<quarkus.native.additional-build-args>
--trace-object-instantiation=org.apache.batik.bridge.RhinoInterpreterFactory
</quarkus.native.additional-build-args>
</properties>
</profile>
</profiles>
Expand Down
Loading

0 comments on commit 3c35c67

Please sign in to comment.