Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port NativeConfig to @ConfigMapping
Browse files Browse the repository at this point in the history
geoand committed Apr 11, 2023
1 parent 647d246 commit 7c58b58
Showing 11 changed files with 368 additions and 177 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ public abstract class NativeImageBuildContainerRunner extends NativeImageBuildRu

protected NativeImageBuildContainerRunner(NativeConfig nativeConfig) {
this.nativeConfig = nativeConfig;
containerRuntime = nativeConfig.containerRuntime.orElseGet(ContainerRuntimeUtil::detectContainerRuntime);
containerRuntime = nativeConfig.containerRuntime().orElseGet(ContainerRuntimeUtil::detectContainerRuntime);

this.baseContainerRuntimeArgs = new String[] { "--env", "LANG=C", "--rm" };

@@ -112,8 +112,8 @@ public void addShutdownHook(Process process) {

protected List<String> getContainerRuntimeBuildArgs(Path outputDir) {
List<String> containerRuntimeArgs = new ArrayList<>();
nativeConfig.containerRuntimeOptions.ifPresent(containerRuntimeArgs::addAll);
if (nativeConfig.debugBuildProcess && nativeConfig.publishDebugBuildProcessPort) {
nativeConfig.containerRuntimeOptions().ifPresent(containerRuntimeArgs::addAll);
if (nativeConfig.debugBuildProcess() && nativeConfig.publishDebugBuildProcessPort()) {
// publish the debug port onto the host if asked for
containerRuntimeArgs.add("--publish=" + NativeImageBuildStep.DEBUG_BUILD_PROCESS_PORT + ":"
+ NativeImageBuildStep.DEBUG_BUILD_PROCESS_PORT);
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ private String runCommandAndReadOutput(String[] command, String errorMsg) throws
protected void postBuild(Path outputDir, String nativeImageName, String resultingExecutableName) {
copyFromContainerVolume(outputDir, resultingExecutableName,
"Failed to copy native image from container volume back to the host.");
if (nativeConfig.debug.enabled) {
if (nativeConfig.debug().enabled()) {
copyFromContainerVolume(outputDir, "sources", "Failed to copy sources from container volume back to the host.");
String symbols = String.format("%s.debug", nativeImageName);
copyFromContainerVolume(outputDir, symbols, "Failed to copy debug symbols from container volume back to the host.");
Original file line number Diff line number Diff line change
@@ -183,7 +183,7 @@ public NativeImageBuildItem build(NativeConfig nativeConfig, LocalesBuildTimeCon
Optional<ProcessInheritIODisabledBuildItem> processInheritIODisabledBuildItem,
List<NativeImageFeatureBuildItem> nativeImageFeatures,
NativeImageRunnerBuildItem nativeImageRunner) {
if (nativeConfig.debug.enabled) {
if (nativeConfig.debug().enabled()) {
copyJarSourcesToLib(outputTargetBuildItem, curateOutcomeBuildItem);
copySourcesToSourceCache(outputTargetBuildItem);
}
@@ -204,7 +204,7 @@ public NativeImageBuildItem build(NativeConfig nativeConfig, LocalesBuildTimeCon
String resultingExecutableName = getResultingExecutableName(nativeImageName, nativeImageRunner.isContainerBuild());
Path generatedExecutablePath = outputDir.resolve(resultingExecutableName);
Path finalExecutablePath = outputTargetBuildItem.getOutputDirectory().resolve(resultingExecutableName);
if (nativeConfig.reuseExisting) {
if (nativeConfig.reuseExisting()) {
if (Files.exists(finalExecutablePath)) {
return new NativeImageBuildItem(finalExecutablePath,
NativeImageBuildItem.GraalVMVersion.unknown());
@@ -223,7 +223,7 @@ public NativeImageBuildItem build(NativeConfig nativeConfig, LocalesBuildTimeCon
}

try {
if (nativeConfig.cleanupServer) {
if (nativeConfig.cleanupServer()) {
log.warn(
"Your application is setting the deprecated 'quarkus.native.cleanup-server' configuration key"
+ " to true. Please consider removing this configuration key as it is ignored"
@@ -257,14 +257,14 @@ public NativeImageBuildItem build(NativeConfig nativeConfig, LocalesBuildTimeCon
NativeImageBuildRunner.Result buildNativeResult = buildRunner.build(nativeImageArgs,
nativeImageName,
resultingExecutableName, outputDir,
graalVMVersion, nativeConfig.debug.enabled,
graalVMVersion, nativeConfig.debug().enabled(),
processInheritIODisabled.isPresent() || processInheritIODisabledBuildItem.isPresent());
if (buildNativeResult.getExitCode() != 0) {
throw imageGenerationFailed(buildNativeResult.getExitCode(), isContainerBuild);
}
IoUtils.copy(generatedExecutablePath, finalExecutablePath);
Files.delete(generatedExecutablePath);
if (nativeConfig.debug.enabled) {
if (nativeConfig.debug().enabled()) {
final String symbolsName = String.format("%s.debug", nativeImageName);
Path generatedSymbols = outputDir.resolve(symbolsName);
if (generatedSymbols.toFile().exists()) {
@@ -285,7 +285,7 @@ public NativeImageBuildItem build(NativeConfig nativeConfig, LocalesBuildTimeCon
} catch (Exception e) {
throw new RuntimeException("Failed to build native image", e);
} finally {
if (nativeConfig.debug.enabled) {
if (nativeConfig.debug().enabled()) {
removeJarSourcesFromLib(outputTargetBuildItem);
IoUtils.recursiveDelete(outputDir.resolve(Paths.get(APP_SOURCES)));
}
@@ -310,8 +310,8 @@ private String getResultingExecutableName(String nativeImageName, boolean isCont
*/
@BuildStep
public NativeImageRunnerBuildItem resolveNativeImageBuildRunner(NativeConfig nativeConfig) {
boolean isExplicitContainerBuild = nativeConfig.containerBuild
.orElse(nativeConfig.containerRuntime.isPresent() || nativeConfig.remoteContainerBuild);
boolean isExplicitContainerBuild = nativeConfig.containerBuild()
.orElse(nativeConfig.containerRuntime().isPresent() || nativeConfig.remoteContainerBuild());
if (!isExplicitContainerBuild) {
NativeImageBuildLocalRunner localRunner = getNativeImageBuildLocalRunner(nativeConfig);
if (localRunner != null) {
@@ -326,7 +326,7 @@ public NativeImageRunnerBuildItem resolveNativeImageBuildRunner(NativeConfig nat
}
log.warn(errorMessage + " Attempting to fall back to container build.");
}
if (nativeConfig.remoteContainerBuild) {
if (nativeConfig.remoteContainerBuild()) {
return new NativeImageRunnerBuildItem(new NativeImageBuildRemoteContainerRunner(nativeConfig));
}
return new NativeImageRunnerBuildItem(new NativeImageBuildLocalContainerRunner(nativeConfig));
@@ -439,14 +439,14 @@ private void checkGraalVMVersion(GraalVM.Version version) {

private static NativeImageBuildLocalRunner getNativeImageBuildLocalRunner(NativeConfig nativeConfig) {
String executableName = getNativeImageExecutableName();
if (nativeConfig.graalvmHome.isPresent()) {
File file = Paths.get(nativeConfig.graalvmHome.get(), "bin", executableName).toFile();
if (nativeConfig.graalvmHome().isPresent()) {
File file = Paths.get(nativeConfig.graalvmHome().get(), "bin", executableName).toFile();
if (file.exists()) {
return new NativeImageBuildLocalRunner(file.getAbsolutePath());
}
}

File javaHome = nativeConfig.javaHome;
File javaHome = nativeConfig.javaHome();
if (javaHome == null) {
// try system property first - it will be the JAVA_HOME used by the current JVM
String home = System.getProperty(JAVA_HOME_SYS);
@@ -639,9 +639,9 @@ public Builder setNativeImageName(String nativeImageName) {
public NativeImageInvokerInfo build() {
List<String> nativeImageArgs = new ArrayList<>();
boolean enableSslNative = false;
boolean inlineBeforeAnalysis = nativeConfig.inlineBeforeAnalysis;
boolean addAllCharsets = nativeConfig.addAllCharsets;
boolean enableHttpsUrlHandler = nativeConfig.enableHttpsUrlHandler;
boolean inlineBeforeAnalysis = nativeConfig.inlineBeforeAnalysis();
boolean addAllCharsets = nativeConfig.addAllCharsets();
boolean enableHttpsUrlHandler = nativeConfig.enableHttpsUrlHandler();
for (NativeImageSystemPropertyBuildItem prop : nativeImageProperties) {
//todo: this should be specific build items
if (prop.getKey().equals("quarkus.ssl.native") && prop.getValue() != null) {
@@ -682,7 +682,7 @@ public NativeImageInvokerInfo build() {
nativeImageArgs.add("-H:IncludeLocales=" + includeLocales);
}

nativeImageArgs.add("-J-Dfile.encoding=" + nativeConfig.fileEncoding);
nativeImageArgs.add("-J-Dfile.encoding=" + nativeConfig.fileEncoding());

if (enableSslNative) {
enableHttpsUrlHandler = true;
@@ -713,7 +713,7 @@ public NativeImageInvokerInfo build() {
nativeImageArgs.add("-H:-ParseOnce");
}

if (nativeConfig.debug.enabled && graalVMVersion.compareTo(GraalVM.Version.VERSION_23_0_0) >= 0) {
if (nativeConfig.debug().enabled() && graalVMVersion.compareTo(GraalVM.Version.VERSION_23_0_0) >= 0) {
/*
* Instruct GraalVM / Mandrel to keep more accurate information about source locations when generating
* debug info for debugging and monitoring tools. This parameter may break compatibility with Truffle.
@@ -743,7 +743,7 @@ public NativeImageInvokerInfo build() {
// required by camel-quarkus-xstream
nativeImageArgs.add("-J--add-opens=java.base/java.util=ALL-UNNAMED");

if (nativeConfig.enableReports) {
if (nativeConfig.enableReports()) {
nativeImageArgs.add("-H:PrintAnalysisCallTreeType=CSV");
}

@@ -768,11 +768,11 @@ public NativeImageInvokerInfo build() {

nativeImageArgs.add("-H:+AllowFoldMethods");

if (nativeConfig.headless) {
if (nativeConfig.headless()) {
nativeImageArgs.add("-J-Djava.awt.headless=true");
}

if (nativeConfig.enableFallbackImages) {
if (nativeConfig.enableFallbackImages()) {
nativeImageArgs.add("--auto-fallback");
} else {
//Default: be strict as those fallback images aren't very useful
@@ -784,17 +784,17 @@ public NativeImageInvokerInfo build() {
nativeImageArgs.add("--link-at-build-time");
}

if (nativeConfig.reportErrorsAtRuntime) {
if (nativeConfig.reportErrorsAtRuntime()) {
nativeImageArgs.add("--report-unsupported-elements-at-runtime");
}
if (nativeConfig.reportExceptionStackTraces) {
if (nativeConfig.reportExceptionStackTraces()) {
nativeImageArgs.add("-H:+ReportExceptionStackTraces");
}
if (nativeConfig.debug.enabled) {
if (nativeConfig.debug().enabled()) {
nativeImageArgs.add("-g");
nativeImageArgs.add("-H:DebugInfoSourceSearchPath=" + APP_SOURCES);
}
if (nativeConfig.debugBuildProcess) {
if (nativeConfig.debugBuildProcess()) {
String debugBuildProcessHost;
if (containerBuild) {
debugBuildProcessHost = "0.0.0.0";
@@ -805,14 +805,14 @@ public NativeImageInvokerInfo build() {
.add("-J-Xrunjdwp:transport=dt_socket,address=" + debugBuildProcessHost + ":"
+ DEBUG_BUILD_PROCESS_PORT + ",server=y,suspend=y");
}
if (nativeConfig.dumpProxies) {
if (nativeConfig.dumpProxies()) {
nativeImageArgs.add("-Dsun.misc.ProxyGenerator.saveGeneratedFiles=true");
}
if (nativeConfig.nativeImageXmx.isPresent()) {
nativeImageArgs.add("-J-Xmx" + nativeConfig.nativeImageXmx.get());
if (nativeConfig.nativeImageXmx().isPresent()) {
nativeImageArgs.add("-J-Xmx" + nativeConfig.nativeImageXmx().get());
}
List<String> protocols = new ArrayList<>(2);
if (nativeConfig.enableHttpUrlHandler) {
if (nativeConfig.enableHttpUrlHandler()) {
protocols.add("http");
}
if (enableHttpsUrlHandler) {
@@ -833,47 +833,47 @@ public NativeImageInvokerInfo build() {
nativeImageArgs.add("-H:NativeLinkerOption=" + noPIE);
}

if (!nativeConfig.enableIsolates) {
if (!nativeConfig.enableIsolates()) {
nativeImageArgs.add("-H:-SpawnIsolates");
}
if (!nativeConfig.enableJni) {
if (!nativeConfig.enableJni()) {
log.warn(
"Your application is setting the deprecated 'quarkus.native.enable-jni' configuration key to false."
+ " Please consider removing this configuration key as it is ignored (JNI is always enabled) and it"
+ " will be removed in a future Quarkus version.");
}
if (nativeConfig.enableServer) {
if (nativeConfig.enableServer()) {
log.warn(
"Your application is setting the deprecated 'quarkus.native.enable-server' configuration key to true."
+ " Please consider removing this configuration key as it is ignored"
+ " (The Native image build server is always disabled) and it"
+ " will be removed in a future Quarkus version.");
}
if (nativeConfig.enableVmInspection) {
if (nativeConfig.enableVmInspection()) {
nativeImageArgs.add("-H:+AllowVMInspection");
}

if (nativeConfig.monitoring.isPresent()) {
List<NativeConfig.MonitoringOption> monitoringOptions = nativeConfig.monitoring.get();
if (nativeConfig.monitoring().isPresent()) {
List<NativeConfig.MonitoringOption> monitoringOptions = nativeConfig.monitoring().get();
if (!monitoringOptions.isEmpty()) {
nativeImageArgs.add("--enable-monitoring=" + monitoringOptions.stream()
.map(o -> o.name().toLowerCase(Locale.ROOT)).collect(Collectors.joining(",")));
}
}
if (nativeConfig.autoServiceLoaderRegistration) {
if (nativeConfig.autoServiceLoaderRegistration()) {
nativeImageArgs.add("-H:+UseServiceLoaderFeature");
//When enabling, at least print what exactly is being added:
nativeImageArgs.add("-H:+TraceServiceLoaderFeature");
} else {
nativeImageArgs.add("-H:-UseServiceLoaderFeature");
}
if (nativeConfig.fullStackTraces) {
if (nativeConfig.fullStackTraces()) {
nativeImageArgs.add("-H:+StackTrace");
} else {
nativeImageArgs.add("-H:-StackTrace");
}

if (nativeConfig.enableDashboardDump) {
if (nativeConfig.enableDashboardDump()) {
nativeImageArgs.add("-H:DashboardDump=" + outputTargetBuildItem.getBaseName() + "_dashboard.dump");
nativeImageArgs.add("-H:+DashboardAll");
}
@@ -941,8 +941,8 @@ public NativeImageInvokerInfo build() {
}

private void handleAdditionalProperties(List<String> command) {
if (nativeConfig.additionalBuildArgs.isPresent()) {
List<String> strings = nativeConfig.additionalBuildArgs.get();
if (nativeConfig.additionalBuildArgs().isPresent()) {
List<String> strings = nativeConfig.additionalBuildArgs().get();
for (String buildArg : strings) {
String trimmedBuildArg = buildArg.trim();
if (trimmedBuildArg.contains(TRUST_STORE_SYSTEM_PROPERTY_MARKER) && containerBuild) {
Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@ public void compress(NativeConfig nativeConfig, NativeImageRunnerBuildItem nativ
NativeImageBuildItem image,
BuildProducer<UpxCompressedBuildItem> upxCompressedProducer,
BuildProducer<ArtifactResultBuildItem> artifactResultProducer) {
if (nativeConfig.compression.level.isEmpty()) {
if (nativeConfig.compression().level().isEmpty()) {
log.debug("UPX compression disabled");
return;
}
@@ -66,8 +66,8 @@ public void compress(NativeConfig nativeConfig, NativeImageRunnerBuildItem nativ
}

private boolean runUpxFromHost(File upx, File executable, NativeConfig nativeConfig) {
String level = getCompressionLevel(nativeConfig.compression.level.getAsInt());
List<String> extraArgs = nativeConfig.compression.additionalArgs.orElse(Collections.emptyList());
String level = getCompressionLevel(nativeConfig.compression().level().getAsInt());
List<String> extraArgs = nativeConfig.compression().additionalArgs().orElse(Collections.emptyList());
List<String> args = Stream.concat(
Stream.concat(Stream.of(upx.getAbsolutePath(), level), extraArgs.stream()),
Stream.of(executable.getAbsolutePath()))
@@ -100,11 +100,11 @@ private boolean runUpxFromHost(File upx, File executable, NativeConfig nativeCon

private boolean runUpxInContainer(NativeImageBuildItem nativeImage, NativeConfig nativeConfig,
String effectiveBuilderImage) {
String level = getCompressionLevel(nativeConfig.compression.level.getAsInt());
List<String> extraArgs = nativeConfig.compression.additionalArgs.orElse(Collections.emptyList());
String level = getCompressionLevel(nativeConfig.compression().level().getAsInt());
List<String> extraArgs = nativeConfig.compression().additionalArgs().orElse(Collections.emptyList());

List<String> commandLine = new ArrayList<>();
ContainerRuntimeUtil.ContainerRuntime containerRuntime = nativeConfig.containerRuntime
ContainerRuntimeUtil.ContainerRuntime containerRuntime = nativeConfig.containerRuntime()
.orElseGet(ContainerRuntimeUtil::detectContainerRuntime);
commandLine.add(containerRuntime.getExecutableName());

Original file line number Diff line number Diff line change
@@ -74,11 +74,11 @@ public NonDefaultLocale(NativeConfig nativeConfig, LocalesBuildTimeConfig locale

@Override
public boolean getAsBoolean() {
return (nativeConfig.userLanguage.isPresent()
&& !Locale.getDefault().getLanguage().equals(nativeConfig.userLanguage.get()))
return (nativeConfig.userLanguage().isPresent()
&& !Locale.getDefault().getLanguage().equals(nativeConfig.userLanguage().get()))
||
(nativeConfig.userCountry.isPresent()
&& !Locale.getDefault().getCountry().equals(nativeConfig.userCountry.get()))
(nativeConfig.userCountry().isPresent()
&& !Locale.getDefault().getCountry().equals(nativeConfig.userCountry().get()))
||
!Locale.getDefault().equals(localesBuildTimeConfig.defaultLocale)
||
@@ -96,10 +96,10 @@ public boolean getAsBoolean() {
*/
public static String nativeImageUserLanguage(NativeConfig nativeConfig, LocalesBuildTimeConfig localesBuildTimeConfig) {
String language = localesBuildTimeConfig.defaultLocale.getLanguage();
if (nativeConfig.userLanguage.isPresent()) {
if (nativeConfig.userLanguage().isPresent()) {
log.warn(DEPRECATED_USER_LANGUAGE_WARNING);
// The deprecated option takes precedence for users who are already using it.
language = nativeConfig.userLanguage.get();
language = nativeConfig.userLanguage().get();
}
return language;
}
@@ -115,10 +115,10 @@ public static String nativeImageUserLanguage(NativeConfig nativeConfig, LocalesB
*/
public static String nativeImageUserCountry(NativeConfig nativeConfig, LocalesBuildTimeConfig localesBuildTimeConfig) {
String country = localesBuildTimeConfig.defaultLocale.getCountry();
if (nativeConfig.userCountry.isPresent()) {
if (nativeConfig.userCountry().isPresent()) {
log.warn(DEPRECATED_USER_COUNTRY_WARNING);
// The deprecated option takes precedence for users who are already using it.
country = nativeConfig.userCountry.get();
country = nativeConfig.userCountry().get();
}
return country;
}
@@ -136,10 +136,10 @@ public static String nativeImageIncludeLocales(NativeConfig nativeConfig, Locale
// We subtract what we already declare for native-image's user.language or user.country.
// Note the deprecated options still count.
additionalLocales.remove(localesBuildTimeConfig.defaultLocale);
if (nativeConfig.userCountry.isPresent() && nativeConfig.userLanguage.isPresent()) {
additionalLocales.remove(new Locale(nativeConfig.userLanguage.get(), nativeConfig.userCountry.get()));
} else if (nativeConfig.userLanguage.isPresent()) {
additionalLocales.remove(new Locale(nativeConfig.userLanguage.get()));
if (nativeConfig.userCountry().isPresent() && nativeConfig.userLanguage().isPresent()) {
additionalLocales.remove(new Locale(nativeConfig.userLanguage().get(), nativeConfig.userCountry().get()));
} else if (nativeConfig.userLanguage().isPresent()) {
additionalLocales.remove(new Locale(nativeConfig.userLanguage().get()));
}

return additionalLocales.stream()
Original file line number Diff line number Diff line change
@@ -53,8 +53,8 @@ void forwardResourcePatternConfigToBuildItem(
NativeConfig nativeConfig,
BuildProducer<NativeImageResourcePatternsBuildItem> nativeImageResourcePatterns) {

final Optional<List<String>> includes = nativeConfig.resources.includes;
final Optional<List<String>> excludes = nativeConfig.resources.excludes;
final Optional<List<String>> includes = nativeConfig.resources().includes();
final Optional<List<String>> excludes = nativeConfig.resources().excludes();
if (includes.isPresent() || excludes.isPresent()) {
final Builder builder = NativeImageResourcePatternsBuildItem.builder();
includes.ifPresent(builder::includeGlobs);
Original file line number Diff line number Diff line change
@@ -27,9 +27,7 @@ public void testBuilderImageProperlyDetected() {
assertThat(createConfig("aRandomString").getEffectiveBuilderImage()).isEqualTo("aRandomString");
}

private NativeConfig createConfig(String configValue) {
NativeConfig nativeConfig = new NativeConfig();
nativeConfig.builderImage = configValue;
return nativeConfig;
private NativeConfig createConfig(String builderImage) {
return new TestNativeConfig(builderImage);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
package io.quarkus.deployment.pkg;

import java.io.File;
import java.util.List;
import java.util.Optional;

import io.quarkus.runtime.util.ContainerRuntimeUtil;

public class TestNativeConfig implements NativeConfig {

private final String builderImage;

public TestNativeConfig(String builderImage) {
this.builderImage = builderImage;
}

@Override
public Optional<List<String>> additionalBuildArgs() {
return Optional.empty();
}

@Override
public boolean enableHttpUrlHandler() {
return false;
}

@Override
public boolean enableHttpsUrlHandler() {
return false;
}

@Override
public boolean enableAllSecurityServices() {
return false;
}

@Override
public boolean inlineBeforeAnalysis() {
return false;
}

@Override
public boolean enableJni() {
return false;
}

@Override
public boolean headless() {
return false;
}

@Override
public Optional<String> userLanguage() {
return Optional.empty();
}

@Override
public Optional<String> userCountry() {
return Optional.empty();
}

@Override
public String fileEncoding() {
return null;
}

@Override
public boolean addAllCharsets() {
return false;
}

@Override
public Optional<String> graalvmHome() {
return Optional.empty();
}

@Override
public File javaHome() {
return null;
}

@Override
public Optional<String> nativeImageXmx() {
return Optional.empty();
}

@Override
public boolean debugBuildProcess() {
return false;
}

@Override
public boolean publishDebugBuildProcessPort() {
return false;
}

@Override
public boolean cleanupServer() {
return false;
}

@Override
public boolean enableIsolates() {
return false;
}

@Override
public boolean enableFallbackImages() {
return false;
}

@Override
public boolean enableServer() {
return false;
}

@Override
public boolean autoServiceLoaderRegistration() {
return false;
}

@Override
public boolean dumpProxies() {
return false;
}

@Override
public Optional<Boolean> containerBuild() {
return Optional.empty();
}

@Override
public boolean remoteContainerBuild() {
return false;
}

@Override
public String builderImage() {
return builderImage;
}

@Override
public Optional<ContainerRuntimeUtil.ContainerRuntime> containerRuntime() {
return Optional.empty();
}

@Override
public Optional<List<String>> containerRuntimeOptions() {
return Optional.empty();
}

@Override
public boolean enableVmInspection() {
return false;
}

@Override
public Optional<List<MonitoringOption>> monitoring() {
return Optional.empty();
}

@Override
public boolean fullStackTraces() {
return false;
}

@Override
public boolean enableReports() {
return false;
}

@Override
public boolean reportExceptionStackTraces() {
return false;
}

@Override
public boolean reportErrorsAtRuntime() {
return false;
}

@Override
public boolean reuseExisting() {
return false;
}

@Override
public ResourcesConfig resources() {
return null;
}

@Override
public Debug debug() {
return null;
}

@Override
public boolean enableDashboardDump() {
return false;
}

@Override
public Compression compression() {
return null;
}
}
Original file line number Diff line number Diff line change
@@ -3,12 +3,12 @@
import static org.assertj.core.api.Assertions.assertThat;

import java.util.Collections;
import java.util.Optional;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIfSystemProperty;

import io.quarkus.deployment.pkg.NativeConfig;
import io.quarkus.deployment.pkg.TestNativeConfig;
import io.quarkus.runtime.util.ContainerRuntimeUtil;

class NativeImageBuildContainerRunnerTest {
@@ -19,13 +19,11 @@ class NativeImageBuildContainerRunnerTest {
void testBuilderImageBeingPickedUp() {
ContainerRuntimeUtil.ContainerRuntime containerRuntime = ContainerRuntimeUtil.detectContainerRuntime(true);

NativeConfig nativeConfig = new NativeConfig();
nativeConfig.containerRuntime = Optional.empty();
NativeConfig nativeConfig = new TestNativeConfig("graalvm");
boolean found;
NativeImageBuildLocalContainerRunner localRunner;
String[] command;

nativeConfig.builderImage = "graalvm";
localRunner = new NativeImageBuildLocalContainerRunner(nativeConfig);
command = localRunner.buildCommand(containerRuntime.getExecutableName(), Collections.emptyList(),
Collections.emptyList());
@@ -38,7 +36,7 @@ void testBuilderImageBeingPickedUp() {
}
assertThat(found).isTrue();

nativeConfig.builderImage = "mandrel";
nativeConfig = new TestNativeConfig("mandrel");
localRunner = new NativeImageBuildLocalContainerRunner(nativeConfig);
command = localRunner.buildCommand(containerRuntime.getExecutableName(), Collections.emptyList(),
Collections.emptyList());
@@ -51,7 +49,7 @@ void testBuilderImageBeingPickedUp() {
}
assertThat(found).isTrue();

nativeConfig.builderImage = "RandomString";
nativeConfig = new TestNativeConfig("RandomString");
localRunner = new NativeImageBuildLocalContainerRunner(nativeConfig);
command = localRunner.buildCommand(containerRuntime.getExecutableName(), Collections.emptyList(),
Collections.emptyList());
@@ -64,4 +62,5 @@ void testBuilderImageBeingPickedUp() {
}
assertThat(found).isTrue();
}

}
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ public final class ExtendedCharactersSupport {
@Record(STATIC_INIT)
@BuildStep(onlyIf = NativeOrNativeSourcesBuild.class)
public void preinitializeCharacterSets(NativeConfig config, OracleInitRecorder recorder) {
recorder.setupCharSets(config.addAllCharsets);
recorder.setupCharSets(config.addAllCharsets());
}

}

0 comments on commit 7c58b58

Please sign in to comment.