Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/reference-manual/native-image/BuildOutput.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ Run `native-image --expert-options-all | grep "BuildOutput"` to see all build ou
-H:±BuildOutputLinks Show links in build output. Default: + (enabled).
-H:±BuildOutputPrefix Prefix build output with '<pid>:<name of binary>'. Default: - (disabled).
-H:±BuildOutputProgress Report progress in build output. Default: + (enabled).
-H:±BuildOutputSilent Silence build output. Default: - (disabled).
```

### Related Documentation
Expand Down
1 change: 1 addition & 0 deletions substratevm/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This changelog summarizes major changes to GraalVM Native Image.
* (GR-35721) Remove old build output style and the `-H:±BuildOutputUseNewStyle` option.
* (GR-39390) (GR-39649) (GR-40033) Red Hat added support for the JFR events `JavaMonitorEnter`, `JavaMonitorWait`, and `ThreadSleep`.
* (GR-39497) Add `-H:BuildOutputJSONFile=<file.json>` option for [JSON build output](https://github.com/oracle/graal/edit/master/docs/reference-manual/native-image/BuildOutput.md#machine-readable-build-output). Please feel free to provide feedback so that we can stabilize the schema/API.
* (GR-40170) Add `--silent` option to silence the build output.

## Version 22.2.0
* (GR-20653) Re-enable the usage of all CPU features for JIT compilation on AMD64.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,10 @@ public Boolean getValue(OptionValues values) {
/*
* Build output options.
*/
@APIOption(name = "silent")//
@Option(help = "Silence build output", type = OptionType.User)//
public static final HostedOptionKey<Boolean> BuildOutputSilent = new HostedOptionKey<>(false);

@Option(help = "Prefix build output with '<pid>:<image name>'", type = OptionType.User)//
public static final HostedOptionKey<Boolean> BuildOutputPrefix = new HostedOptionKey<>(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,7 @@ private ArrayList<String> createFallbackBuildArgs() {
buildArgs.add(fallbackExecutorJavaArg);
}

buildArgs.add(oH + "+" + SubstrateOptions.BuildOutputSilent.getName());
buildArgs.add(oH + "+" + SubstrateOptions.ParseRuntimeOptions.getName());
Path imagePathPath;
try {
Expand Down Expand Up @@ -1407,6 +1408,7 @@ protected static void build(BuildConfiguration config, Function<BuildConfigurati
int buildStatus = nativeImage.completeImageBuild();
if (buildStatus == 2) {
/* Perform fallback build */
nativeImage.showMessage("Generating fallback image...");
build(new FallbackBuildConfiguration(nativeImage), nativeImageProvider);
showWarning("Image '" + nativeImage.imageName +
"' is a fallback image that requires a JDK for execution " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

package com.oracle.svm.hosted;

import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Objects;

Expand Down Expand Up @@ -57,6 +58,10 @@ public static NativeImageSystemIOWrappers singleton() {
return NativeImageSystemClassLoader.singleton().systemIOWrappers;
}

public static NativeImageSystemIOWrappers disabled() {
return new NativeImageSystemIOWrappersDisabled();
}

public PrintStream getOut() {
return outWrapper.delegate;
}
Expand Down Expand Up @@ -103,4 +108,18 @@ private void maybeInformProgressReporterOnce() {
}
}
}

private static class NativeImageSystemIOWrappersDisabled extends NativeImageSystemIOWrappers {
private static final PrintStream NULL_PRINT_STREAM = new PrintStream(OutputStream.nullOutputStream());

@Override
public PrintStream getOut() {
return NULL_PRINT_STREAM;
}

@Override
public PrintStream getErr() {
return NULL_PRINT_STREAM;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,11 @@ public static ProgressReporter singleton() {
}

public ProgressReporter(OptionValues options) {
builderIO = NativeImageSystemIOWrappers.singleton();
if (SubstrateOptions.BuildOutputSilent.getValue(options)) {
builderIO = NativeImageSystemIOWrappers.disabled();
} else {
builderIO = NativeImageSystemIOWrappers.singleton();
}

if (SubstrateOptions.BuildOutputJSONFile.hasBeenSet(options)) {
jsonHelper = new ProgressReporterJsonHelper(SubstrateOptions.BuildOutputJSONFile.getValue(options));
Expand Down