You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2023/07/07 13:30:55 UTC

[camel-quarkus] branch main updated: Use NativeImageFeatureBuildItem instead of deprecated AutomaticFeature annotation

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 a57ae34b5a Use NativeImageFeatureBuildItem instead of deprecated AutomaticFeature annotation
a57ae34b5a is described below

commit a57ae34b5a835c47a01a203925c287bc009ef15c
Author: James Netherton <ja...@gmail.com>
AuthorDate: Fri Jul 7 10:33:35 2023 +0100

    Use NativeImageFeatureBuildItem instead of deprecated AutomaticFeature annotation
---
 .../support/xalan/deployment/XalanNativeImageProcessor.java      | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/extensions-support/xalan/deployment/src/main/java/org/apache/camel/quarkus/support/xalan/deployment/XalanNativeImageProcessor.java b/extensions-support/xalan/deployment/src/main/java/org/apache/camel/quarkus/support/xalan/deployment/XalanNativeImageProcessor.java
index 638f15a1d0..cef5d8ca8c 100644
--- a/extensions-support/xalan/deployment/src/main/java/org/apache/camel/quarkus/support/xalan/deployment/XalanNativeImageProcessor.java
+++ b/extensions-support/xalan/deployment/src/main/java/org/apache/camel/quarkus/support/xalan/deployment/XalanNativeImageProcessor.java
@@ -25,6 +25,7 @@ import io.quarkus.deployment.annotations.BuildProducer;
 import io.quarkus.deployment.annotations.BuildStep;
 import io.quarkus.deployment.builditem.GeneratedNativeImageClassBuildItem;
 import io.quarkus.deployment.builditem.GeneratedResourceBuildItem;
+import io.quarkus.deployment.builditem.NativeImageFeatureBuildItem;
 import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
 import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBundleBuildItem;
 import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
@@ -82,7 +83,8 @@ class XalanNativeImageProcessor {
     @BuildStep
     void installTransformerFactory(
             BuildProducer<GeneratedNativeImageClassBuildItem> nativeImageClass,
-            BuildProducer<GeneratedResourceBuildItem> generatedResources) {
+            BuildProducer<GeneratedResourceBuildItem> generatedResources,
+            BuildProducer<NativeImageFeatureBuildItem> nativeImageFeature) {
 
         final String serviceProviderFileContent = XalanTransformerFactory.class.getName() + "\n";
 
@@ -98,14 +100,14 @@ class XalanNativeImageProcessor {
          * or NativeImageResourceBuildItem will pick the service file preferred by us.
          * We are thus forced to use this low level mechanism to ensure that.
          */
+        String xalanAutoFeatureClassName = getClass().getName() + "AutoFeature";
         final ClassCreator file = new ClassCreator(new ClassOutput() {
             @Override
             public void write(String s, byte[] bytes) {
                 nativeImageClass.produce(new GeneratedNativeImageClassBuildItem(s, bytes));
             }
-        }, getClass().getName() + "AutoFeature", null,
+        }, xalanAutoFeatureClassName, null,
                 Object.class.getName(), Feature.class.getName());
-        file.addAnnotation("com.oracle.svm.core.annotate.AutomaticFeature");
         final MethodCreator beforeAn = file.getMethodCreator("beforeAnalysis", "V",
                 Feature.BeforeAnalysisAccess.class.getName());
         final TryBlock overallCatch = beforeAn.tryBlock();
@@ -121,6 +123,7 @@ class XalanNativeImageProcessor {
         beforeAn.returnValue(null);
         file.close();
 
+        nativeImageFeature.produce(new NativeImageFeatureBuildItem(xalanAutoFeatureClassName));
     }
 
 }