This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/main by this push:
new 1bdbbb8c81 Restore FOP native mode support
1bdbbb8c81 is described below
commit 1bdbbb8c8101d9c736da50f60095dc766fdd321b
Author: James Netherton <[email protected]>
AuthorDate: Thu Aug 7 13:17:05 2025 +0100
Restore FOP native mode support
Fixes #5244
---
.../ROOT/pages/reference/extensions/fop.adoc | 2 -
extensions/fop/deployment/pom.xml | 4 ++
.../component/fop/deployment/FopProcessor.java | 44 ++++++++++++++++------
extensions/fop/runtime/pom.xml | 4 ++
.../fop/runtime/src/main/doc/limitations.adoc | 2 -
.../component/fop/FopRuntimeProxyFeature.java | 28 ++++++++++++++
integration-tests/fop/pom.xml | 2 -
7 files changed, 69 insertions(+), 17 deletions(-)
diff --git a/docs/modules/ROOT/pages/reference/extensions/fop.adoc
b/docs/modules/ROOT/pages/reference/extensions/fop.adoc
index 80a321118c..2e0b655b51 100644
--- a/docs/modules/ROOT/pages/reference/extensions/fop.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/fop.adoc
@@ -57,8 +57,6 @@ ignored.
* If custom fonts are used, font cache has to be disabled because of
https://github.com/oracle/graal/issues/460[Graal VM issue #460].
Please set the https://xmlgraphics.apache.org/fop/2.1/configuration.html[FOP
configuration property] `use-cache` to `false`.
-NOTE: Native build for module *camel-quarkus-fop* is affected by the
link:https://github.com/apache/camel-quarkus/issues/5244[Fop native failures
due to pdfbox 3 upgrade #5244], native profile is not working and disabled
until the issue is fixed.
-
Please file an https://github.com/apache/camel-quarkus/issues/new[issue] if
you are missing some specific output format
in native mode.
diff --git a/extensions/fop/deployment/pom.xml
b/extensions/fop/deployment/pom.xml
index 6d14a1b5d1..70daffda1f 100644
--- a/extensions/fop/deployment/pom.xml
+++ b/extensions/fop/deployment/pom.xml
@@ -38,6 +38,10 @@
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-core-deployment</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+
<artifactId>camel-quarkus-support-bouncycastle-deployment</artifactId>
+ </dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-support-commons-logging-deployment</artifactId>
diff --git
a/extensions/fop/deployment/src/main/java/org/apache/camel/quarkus/component/fop/deployment/FopProcessor.java
b/extensions/fop/deployment/src/main/java/org/apache/camel/quarkus/component/fop/deployment/FopProcessor.java
index 53a6b19063..d128acf742 100644
---
a/extensions/fop/deployment/src/main/java/org/apache/camel/quarkus/component/fop/deployment/FopProcessor.java
+++
b/extensions/fop/deployment/src/main/java/org/apache/camel/quarkus/component/fop/deployment/FopProcessor.java
@@ -20,16 +20,21 @@ import java.io.IOException;
import java.util.List;
import java.util.stream.Collectors;
+import javax.xml.namespace.QName;
+
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.NativeImageProxyDefinitionBuildItem;
+import io.quarkus.deployment.builditem.NativeImageFeatureBuildItem;
import
io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import
io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
+import org.apache.camel.quarkus.component.fop.FopRuntimeProxyFeature;
+import org.apache.fop.fo.expr.PropertyException;
import org.apache.fop.fonts.Base14Font;
+import org.apache.fop.pdf.PDFSignature;
import org.apache.fop.render.RendererEventProducer;
import org.apache.fop.render.pdf.PDFDocumentHandlerMaker;
import org.apache.fop.render.pdf.extensions.PDFExtensionHandlerFactory;
@@ -40,7 +45,6 @@ import org.jboss.jandex.DotName;
import org.jboss.jandex.IndexView;
class FopProcessor {
-
private static final String FEATURE = "camel-fop";
@BuildStep
@@ -48,6 +52,11 @@ class FopProcessor {
return new FeatureBuildItem(FEATURE);
}
+ @BuildStep
+ NativeImageFeatureBuildItem registerRuntimeProxies() {
+ return new NativeImageFeatureBuildItem(FopRuntimeProxyFeature.class);
+ }
+
@BuildStep
ReflectiveClassBuildItem registerForReflection(CombinedIndexBuildItem
combinedIndex) {
IndexView index = combinedIndex.getIndex();
@@ -63,13 +72,15 @@ class FopProcessor {
dtos.add(RendererEventProducer.class.getName());
dtos.add(IOException.class.getName());
dtos.add(Integer.class.getName());
+ dtos.add(QName.class.getName());
+ dtos.add(PropertyException.class.getName());
- return ReflectiveClassBuildItem.builder(dtos.toArray(new
String[dtos.size()])).build();
+ return ReflectiveClassBuildItem.builder(dtos.toArray(new
String[0])).build();
}
@BuildStep
void addDependencies(BuildProducer<IndexDependencyBuildItem>
indexDependency) {
- indexDependency.produce(new
IndexDependencyBuildItem("org.apache.xmlgraphics", "fop"));
+ indexDependency.produce(new
IndexDependencyBuildItem("org.apache.xmlgraphics", "fop-core"));
}
@BuildStep
@@ -77,13 +88,23 @@ class FopProcessor {
return new NativeImageResourceBuildItem(
"META-INF/services/org.apache.fop.fo.ElementMapping",
"META-INF/services/org.apache.fop.render.intermediate.IFDocumentHandler",
- "org/apache/fop/render/event-model.xml");
- }
-
- @BuildStep
- NativeImageProxyDefinitionBuildItem initProxies() {
- return new NativeImageProxyDefinitionBuildItem(
- "org.apache.fop.render.RendererEventProducer");
+ "org/apache/fop/svg/event-model.xml",
+ "org/apache/fop/area/event-model.xml",
+ "org/apache/fop/afp/event-model.xml",
+ "org/apache/fop/render/rtf/event-model.xml",
+ "org/apache/fop/render/bitmap/event-model.xml",
+ "org/apache/fop/render/pdf/extensions/event-model.xml",
+ "org/apache/fop/render/pdf/event-model.xml",
+ "org/apache/fop/render/pcl/event-model.xml",
+ "org/apache/fop/render/ps/event-model.xml",
+ "org/apache/fop/render/event-model.xml",
+ "org/apache/fop/event-model.xml",
+ "org/apache/fop/layoutmgr/inline/event-model.xml",
+ "org/apache/fop/layoutmgr/event-model.xml",
+ "org/apache/fop/fo/event-model.xml",
+ "org/apache/fop/fo/flow/table/event-model.xml",
+ "org/apache/fop/fonts/event-model.xml",
+ "org/apache/fop/accessibility/event-model.xml");
}
@BuildStep
@@ -100,5 +121,6 @@ class FopProcessor {
runtimeInitializedClass.produce(new
RuntimeInitializedClassBuildItem(ImageImplRegistry.class.getName()));
runtimeInitializedClass.produce(new
RuntimeInitializedClassBuildItem(ColorUtil.class.getName()));
runtimeInitializedClass.produce(new
RuntimeInitializedClassBuildItem(ICCColorSpaceWithIntent.class.getName()));
+ runtimeInitializedClass.produce(new
RuntimeInitializedClassBuildItem(PDFSignature.class.getName()));
}
}
diff --git a/extensions/fop/runtime/pom.xml b/extensions/fop/runtime/pom.xml
index 810c295036..8deb1e467b 100644
--- a/extensions/fop/runtime/pom.xml
+++ b/extensions/fop/runtime/pom.xml
@@ -44,6 +44,10 @@
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-core</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-support-bouncycastle</artifactId>
+ </dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-support-commons-logging</artifactId>
diff --git a/extensions/fop/runtime/src/main/doc/limitations.adoc
b/extensions/fop/runtime/src/main/doc/limitations.adoc
index eb165be877..8a2fbf9dff 100644
--- a/extensions/fop/runtime/src/main/doc/limitations.adoc
+++ b/extensions/fop/runtime/src/main/doc/limitations.adoc
@@ -8,7 +8,5 @@ ignored.
* If custom fonts are used, font cache has to be disabled because of
https://github.com/oracle/graal/issues/460[Graal VM issue #460].
Please set the https://xmlgraphics.apache.org/fop/2.1/configuration.html[FOP
configuration property] `use-cache` to `false`.
-NOTE: Native build for module *camel-quarkus-fop* is affected by the
link:https://github.com/apache/camel-quarkus/issues/5244[Fop native failures
due to pdfbox 3 upgrade #5244], native profile is not working and disabled
until the issue is fixed.
-
Please file an https://github.com/apache/camel-quarkus/issues/new[issue] if
you are missing some specific output format
in native mode.
diff --git
a/extensions/fop/runtime/src/main/java/org/apache/camel/quarkus/component/fop/FopRuntimeProxyFeature.java
b/extensions/fop/runtime/src/main/java/org/apache/camel/quarkus/component/fop/FopRuntimeProxyFeature.java
new file mode 100644
index 0000000000..0aa6533768
--- /dev/null
+++
b/extensions/fop/runtime/src/main/java/org/apache/camel/quarkus/component/fop/FopRuntimeProxyFeature.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.fop;
+
+import org.apache.fop.render.RendererEventProducer;
+import org.graalvm.nativeimage.hosted.Feature;
+import org.graalvm.nativeimage.hosted.RuntimeProxyCreation;
+
+public class FopRuntimeProxyFeature implements Feature {
+ @Override
+ public void beforeAnalysis(BeforeAnalysisAccess access) {
+ RuntimeProxyCreation.register(RendererEventProducer.class);
+ }
+}
diff --git a/integration-tests/fop/pom.xml b/integration-tests/fop/pom.xml
index 9310cad482..c53142e524 100644
--- a/integration-tests/fop/pom.xml
+++ b/integration-tests/fop/pom.xml
@@ -70,7 +70,6 @@
<profiles>
- <!-- https://github.com/apache/camel-quarkus/issues/5244
<profile>
<id>native</id>
<activation>
@@ -98,7 +97,6 @@
</plugins>
</build>
</profile>
- -->
<profile>
<id>virtualDependencies</id>
<activation>