From d7eda21c04c0a496835cc94d8a498ba99d324720 Mon Sep 17 00:00:00 2001 From: Marco Bungart Date: Mon, 26 Jun 2023 02:18:34 +0200 Subject: [PATCH] In AWT processor, set up build runner before using it --- .../io/quarkus/awt/deployment/AwtProcessor.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/extensions/awt/deployment/src/main/java/io/quarkus/awt/deployment/AwtProcessor.java b/extensions/awt/deployment/src/main/java/io/quarkus/awt/deployment/AwtProcessor.java index 46f4b9b7807f5..3a796840a990c 100644 --- a/extensions/awt/deployment/src/main/java/io/quarkus/awt/deployment/AwtProcessor.java +++ b/extensions/awt/deployment/src/main/java/io/quarkus/awt/deployment/AwtProcessor.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Optional; import java.util.stream.Stream; import io.quarkus.awt.runtime.graal.DarwinAwtFeature; @@ -21,6 +22,8 @@ import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedPackageBuildItem; import io.quarkus.deployment.builditem.nativeimage.UnsupportedOSBuildItem; import io.quarkus.deployment.pkg.builditem.NativeImageRunnerBuildItem; +import io.quarkus.deployment.pkg.builditem.ProcessInheritIODisabled; +import io.quarkus.deployment.pkg.builditem.ProcessInheritIODisabledBuildItem; import io.quarkus.deployment.pkg.steps.GraalVM; import io.quarkus.deployment.pkg.steps.NativeOrNativeSourcesBuild; @@ -95,7 +98,11 @@ ReflectiveClassBuildItem setupReflectionClassesWithMethods() { void setupAWTInit(BuildProducer jc, BuildProducer jm, BuildProducer jf, - NativeImageRunnerBuildItem nativeImageRunnerBuildItem) { + NativeImageRunnerBuildItem nativeImageRunnerBuildItem, + Optional processInheritIODisabled, + Optional processInheritIODisabledBuildItem) { + nativeImageRunnerBuildItem.getBuildRunner() + .setup(processInheritIODisabled.isPresent() || processInheritIODisabledBuildItem.isPresent()); final GraalVM.Version v = nativeImageRunnerBuildItem.getBuildRunner().getGraalVMVersion(); // Dynamically loading shared objects instead // of baking in static libs: https://github.com/oracle/graal/issues/4921 @@ -118,7 +125,11 @@ void setupAWTInit(BuildProducer jc, } @BuildStep(onlyIf = NativeOrNativeSourcesBuild.class) - JniRuntimeAccessBuildItem setupJava2DClasses(NativeImageRunnerBuildItem nativeImageRunnerBuildItem) { + JniRuntimeAccessBuildItem setupJava2DClasses(NativeImageRunnerBuildItem nativeImageRunnerBuildItem, + Optional processInheritIODisabled, + Optional processInheritIODisabledBuildItem) { + nativeImageRunnerBuildItem.getBuildRunner() + .setup(processInheritIODisabled.isPresent() || processInheritIODisabledBuildItem.isPresent()); final GraalVM.Version v = nativeImageRunnerBuildItem.getBuildRunner().getGraalVMVersion(); final List classes = new ArrayList<>(); classes.add("com.sun.imageio.plugins.jpeg.JPEGImageReader");