Skip to content

Commit

Permalink
In AWT processor, set up build runner before using it
Browse files Browse the repository at this point in the history
  • Loading branch information
turing85 authored and gsmet committed Sep 22, 2023
1 parent 778ffaf commit d7eda21
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -95,7 +98,11 @@ ReflectiveClassBuildItem setupReflectionClassesWithMethods() {
void setupAWTInit(BuildProducer<JniRuntimeAccessBuildItem> jc,
BuildProducer<JniRuntimeAccessMethodBuildItem> jm,
BuildProducer<JniRuntimeAccessFieldBuildItem> jf,
NativeImageRunnerBuildItem nativeImageRunnerBuildItem) {
NativeImageRunnerBuildItem nativeImageRunnerBuildItem,
Optional<ProcessInheritIODisabled> processInheritIODisabled,
Optional<ProcessInheritIODisabledBuildItem> 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
Expand All @@ -118,7 +125,11 @@ void setupAWTInit(BuildProducer<JniRuntimeAccessBuildItem> jc,
}

@BuildStep(onlyIf = NativeOrNativeSourcesBuild.class)
JniRuntimeAccessBuildItem setupJava2DClasses(NativeImageRunnerBuildItem nativeImageRunnerBuildItem) {
JniRuntimeAccessBuildItem setupJava2DClasses(NativeImageRunnerBuildItem nativeImageRunnerBuildItem,
Optional<ProcessInheritIODisabled> processInheritIODisabled,
Optional<ProcessInheritIODisabledBuildItem> processInheritIODisabledBuildItem) {
nativeImageRunnerBuildItem.getBuildRunner()
.setup(processInheritIODisabled.isPresent() || processInheritIODisabledBuildItem.isPresent());
final GraalVM.Version v = nativeImageRunnerBuildItem.getBuildRunner().getGraalVMVersion();
final List<String> classes = new ArrayList<>();
classes.add("com.sun.imageio.plugins.jpeg.JPEGImageReader");
Expand Down

0 comments on commit d7eda21

Please sign in to comment.