private boolean buildStaticImage = true;
@GraalCommandPart(order = 17, template = "--allow-incomplete-classpath")
- private boolean allowIncompleteClasspath = true;
+ private Boolean allowIncompleteClasspath; // recent version make it a default
@GraalCommandPart(order = 18, template = "--report-unsupported-elements-at-runtime")
private boolean reportUnsupportedElementsAtRuntime = true;
private boolean inheritIO = true;
+ /**
+ * @param graalVersion the graalvm version used to complete this configuration, in particular allowIncompleteClasspath and enableAllSecurityServices.
+ */
+ public void complete(final String graalVersion) {
+ if (graalVersion != null && (graalVersion.startsWith("21.") || graalVersion.startsWith("20."))) {
+ if (allowIncompleteClasspath == null) {
+ allowIncompleteClasspath = true;
+ }
+ if (enableAllSecurityServices == null) {
+ enableAllSecurityServices = true;
+ }
+ }
+ }
+
public enum FallbackMode {
no, auto, force
}
"native-image", "-classpath",
"-H:MaxRuntimeCompileMethods=1000", "-H:+EnforceMaxRuntimeCompileMethods",
"-H:+AddAllCharsets", "-H:+ReportExceptionStackTraces",
- "--no-fallback", "--static", "--allow-incomplete-classpath",
+ "--no-fallback", "--static",
"--report-unsupported-elements-at-runtime",
"main", "main.graal.exec")),
new Case(
"native-image", "-classpath", "foo" + File.pathSeparator + "bar",
"-H:MaxRuntimeCompileMethods=1000", "-H:+EnforceMaxRuntimeCompileMethods",
"-H:+AddAllCharsets", "-H:+ReportExceptionStackTraces",
- "--no-fallback", "--static", "--allow-incomplete-classpath",
+ "--no-fallback", "--static",
"--report-unsupported-elements-at-runtime",
"main", "main.graal.exec")),
new Case(
* It contains the graal version and can be suffixed by the graal java version prefixed with "r" (as on sdkman).
*/
@Parameter(property = "arthur.graalVersion", defaultValue = "20.3.0.r8")
- private String graalVersion;
+ protected String graalVersion;
/**
* In case Graal must be downloaded to get native-image, which platform to download, auto will handle it for you.
import static java.lang.ClassLoader.getSystemClassLoader;
import static java.util.Comparator.comparing;
import static java.util.Optional.ofNullable;
+import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toMap;
import static lombok.AccessLevel.PROTECTED;
/**
* Should incomplete classpath be tolerated.
*/
- @Parameter(property = "arthur.allowIncompleteClasspath", defaultValue = "true")
- private boolean allowIncompleteClasspath;
+ @Parameter(property = "arthur.allowIncompleteClasspath")
+ private Boolean allowIncompleteClasspath;
/**
* Should unsupported element be reported at runtime or not. It is not a recommended option but it is often needed.
/**
* Should security services be included.
*/
- @Parameter(property = "arthur.enableAllSecurityServices", defaultValue = "true")
- private boolean enableAllSecurityServices;
+ @Parameter(property = "arthur.enableAllSecurityServices")
+ private Boolean enableAllSecurityServices;
/**
* Which main to compile.
final Map<Artifact, Path> classpathEntries = findClasspathFiles().collect(toMap(Map.Entry::getKey, Map.Entry::getValue, (a, b) -> a));
final ArthurNativeImageConfiguration configuration = getConfiguration(classpathEntries.values());
+ configuration.complete(graalVersion);
+
if (nativeImage == null) {
final SdkmanGraalVMInstaller graalInstaller = createInstaller();
final Path graalHome = graalInstaller.install();
final ClassLoader parentLoader = useTcclAsScanningParentClassLoader ?
thread.getContextClassLoader() : getSystemClassLoader();
final ClassLoader oldLoader = thread.getContextClassLoader();
+ if (getLog().isDebugEnabled()) {
+ getLog().debug("Classpath:\n" + Stream.of(urls).map(URL::toExternalForm).collect(joining("\n")));
+ }
try (final URLClassLoader loader = new URLClassLoader(urls, parentLoader) {
@Override
protected Class<?> loadClass(final String name, final boolean resolve) throws ClassNotFoundException {