GERONIMO-6816 set GRAALVM_HOME when installing native-image, it is now needed
diff --git a/arthur-impl/src/main/java/org/apache/geronimo/arthur/impl/nativeimage/ArthurNativeImageExecutor.java b/arthur-impl/src/main/java/org/apache/geronimo/arthur/impl/nativeimage/ArthurNativeImageExecutor.java
index 2826c0a..1b30943 100644
--- a/arthur-impl/src/main/java/org/apache/geronimo/arthur/impl/nativeimage/ArthurNativeImageExecutor.java
+++ b/arthur-impl/src/main/java/org/apache/geronimo/arthur/impl/nativeimage/ArthurNativeImageExecutor.java
@@ -36,6 +36,7 @@
import java.util.function.BiConsumer;
import java.util.function.Function;
+import static java.util.Collections.emptyMap;
import static java.util.Optional.ofNullable;
@Slf4j
@@ -56,7 +57,8 @@
final List<String> command = new CommandGenerator().generate(configuration.configuration);
new ProcessExecutor(
configuration.configuration.isInheritIO(),
- command)
+ command,
+ emptyMap())
.run();
}
diff --git a/arthur-impl/src/main/java/org/apache/geronimo/arthur/impl/nativeimage/installer/SdkmanGraalVMInstaller.java b/arthur-impl/src/main/java/org/apache/geronimo/arthur/impl/nativeimage/installer/SdkmanGraalVMInstaller.java
index f9de1b8..6ad4c59 100644
--- a/arthur-impl/src/main/java/org/apache/geronimo/arthur/impl/nativeimage/installer/SdkmanGraalVMInstaller.java
+++ b/arthur-impl/src/main/java/org/apache/geronimo/arthur/impl/nativeimage/installer/SdkmanGraalVMInstaller.java
@@ -17,6 +17,7 @@
package org.apache.geronimo.arthur.impl.nativeimage.installer;
import static java.util.Arrays.asList;
+import static java.util.Collections.singletonMap;
import static java.util.Comparator.comparing;
import static java.util.Objects.requireNonNull;
@@ -80,7 +81,9 @@
try {
if (findNativeImage(bin).count() == 0) { // likely only UNIx, windows comes with native-image.cmd
log.info("Installing native-image");
- new ProcessExecutor(configuration.isInheritIO(), asList(findGu(bin).toAbsolutePath().toString(), "install", "native-image")).run();
+ new ProcessExecutor(
+ configuration.isInheritIO(), asList(findGu(bin).toAbsolutePath().toString(), "install", "native-image"),
+ singletonMap("GRAALVM_HOME", home.toString())).run();
} else {
log.debug("native-image is already available");
}
diff --git a/arthur-impl/src/main/java/org/apache/geronimo/arthur/impl/nativeimage/process/ProcessExecutor.java b/arthur-impl/src/main/java/org/apache/geronimo/arthur/impl/nativeimage/process/ProcessExecutor.java
index 3f6b5ff..c004898 100644
--- a/arthur-impl/src/main/java/org/apache/geronimo/arthur/impl/nativeimage/process/ProcessExecutor.java
+++ b/arthur-impl/src/main/java/org/apache/geronimo/arthur/impl/nativeimage/process/ProcessExecutor.java
@@ -18,6 +18,7 @@
import java.io.IOException;
import java.util.List;
+import java.util.Map;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -27,6 +28,7 @@
public class ProcessExecutor implements Runnable {
private final boolean inheritIO;
private final List<String> command;
+ private final Map<String, String> env;
@Override
public void run() {
@@ -37,6 +39,9 @@
Process process = null;
try {
final ProcessBuilder builder = new ProcessBuilder(command);
+ if (env != null) {
+ builder.environment().putAll(env);
+ }
if (inheritIO) {
builder.inheritIO();
}