Skip to content

Commit

Permalink
Check GraalVM version before returning macos/darwin platform. (#1123)
Browse files Browse the repository at this point in the history
* Check GraalVM version before returning macos/darwin platform.
This closes #1121
  • Loading branch information
johanvos authored Feb 18, 2022
1 parent 8214115 commit 3a23d5b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public Path getGraalPath() {
return Objects.requireNonNull(this.publicConfig.getGraalPath(), "GraalVM Path is not defined");
}

private Version getGraalVersion() throws IOException {
public Version getGraalVersion() throws IOException {
String pattern = "GraalVM .*?(\\d\\d.\\d.\\d)";
ProcessRunner graalJava;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import com.gluonhq.substrate.util.Logger;
import com.gluonhq.substrate.util.ProcessRunner;
import com.gluonhq.substrate.util.Strings;
import com.gluonhq.substrate.util.Version;

import java.io.BufferedWriter;
import java.io.File;
Expand Down Expand Up @@ -359,6 +360,13 @@ private String getJniPlatformArg() {

private String getJniPlatform() {
Triplet target = projectConfiguration.getTargetTriplet();
boolean graalVM221 = false;
try {
Version graalVersion = projectConfiguration.getGraalVersion();
graalVM221 = ((graalVersion.getMajor() > 21) && (graalVersion.getMinor() >0));
} catch (IOException ex) {
Logger.logFatal(ex, "Could not detect GraalVM version, stopping now.");
}
String os = target.getOs();
String arch = target.getArch();
switch (os) {
Expand All @@ -380,7 +388,7 @@ private String getJniPlatform() {
}
return "IOS_AARCH64";
case Constants.OS_DARWIN:
return "DARWIN_AMD64";
return graalVM221 ? "MACOS_AMD64" : "DARWIN_AMD64";
case Constants.OS_WINDOWS:
return "WINDOWS_AMD64";
case Constants.OS_ANDROID:
Expand Down

0 comments on commit 3a23d5b

Please sign in to comment.