Skip to content

Commit

Permalink
- In AWT extension, set up build runner before using it
Browse files Browse the repository at this point in the history
- Make the GraalVM version command quiet.
- Make pull command for image quiet
  • Loading branch information
turing85 committed Jun 26, 2023
1 parent 67a637e commit 3614e84
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,11 @@ public void setup(boolean processInheritIODisabled) {
}
Process pullProcess = null;
try {
List<String> pullCommand = Arrays.asList(containerRuntime.getExecutableName(), "pull", "--quiet",
effectiveBuilderImage);
log.debugf(String.join(" ", pullCommand).replace("$", "\\$"));
final ProcessBuilder pb = new ProcessBuilder(
Arrays.asList(containerRuntime.getExecutableName(), "pull", effectiveBuilderImage));
pullCommand);
pullProcess = ProcessUtil.launchProcess(pb, processInheritIODisabled);
if (pullProcess.waitFor() != 0) {
throw new RuntimeException("Failed to pull builder image '" + effectiveBuilderImage + "'");
Expand All @@ -102,7 +105,7 @@ public void setup(boolean processInheritIODisabled) {

@Override
protected String[] getGraalVMVersionCommand(List<String> args) {
return buildCommand("run", Collections.singletonList("--rm"), args);
return buildCommand("run", List.of("--quiet", "--rm"), args);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@

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

import org.jboss.logging.Logger;

import io.quarkus.awt.runtime.graal.DarwinAwtFeature;
import io.quarkus.deployment.Feature;
import io.quarkus.deployment.annotations.BuildProducer;
Expand All @@ -21,10 +24,13 @@
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;

class AwtProcessor {
private static final Logger log = Logger.getLogger(AwtProcessor.class);

@BuildStep
FeatureBuildItem feature() {
Expand Down Expand Up @@ -95,7 +101,13 @@ ReflectiveClassBuildItem setupReflectionClassesWithMethods() {
void setupAWTInit(BuildProducer<JniRuntimeAccessBuildItem> jc,
BuildProducer<JniRuntimeAccessMethodBuildItem> jm,
BuildProducer<JniRuntimeAccessFieldBuildItem> jf,
NativeImageRunnerBuildItem nativeImageRunnerBuildItem) {
NativeImageRunnerBuildItem nativeImageRunnerBuildItem,
Optional<ProcessInheritIODisabled> processInheritIODisabled,
Optional<ProcessInheritIODisabledBuildItem> processInheritIODisabledBuildItem) {
log.infof("foo1");
nativeImageRunnerBuildItem.getBuildRunner()
.setup(processInheritIODisabled.isPresent() || processInheritIODisabledBuildItem.isPresent());
log.infof("foo2");
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 +130,13 @@ void setupAWTInit(BuildProducer<JniRuntimeAccessBuildItem> jc,
}

@BuildStep(onlyIf = NativeOrNativeSourcesBuild.class)
JniRuntimeAccessBuildItem setupJava2DClasses(NativeImageRunnerBuildItem nativeImageRunnerBuildItem) {
JniRuntimeAccessBuildItem setupJava2DClasses(NativeImageRunnerBuildItem nativeImageRunnerBuildItem,
Optional<ProcessInheritIODisabled> processInheritIODisabled,
Optional<ProcessInheritIODisabledBuildItem> processInheritIODisabledBuildItem) {
log.infof("bar1");
nativeImageRunnerBuildItem.getBuildRunner()
.setup(processInheritIODisabled.isPresent() || processInheritIODisabledBuildItem.isPresent());
log.infof("bar2");
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 3614e84

Please sign in to comment.