Skip to content

Commit

Permalink
Clean up jre usages.
Browse files Browse the repository at this point in the history
  • Loading branch information
fniephaus committed Feb 15, 2022
1 parent 40801a6 commit b7ba2fa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -362,13 +362,13 @@ private static Path getGraalVmHomeFromRelativeLauncherPath(Path executableOrObjF
}

/**
* Fallback for the GraalVM home using location of libpolyglot in jdk/jre layout.
* Fallback for the GraalVM home using location of libpolyglot in jdk layout.
*
* @param objectFile the path to libpolyglot
* @return the path to GraalVM home or null
*/
private static Path getGraalVmHomeLibPolyglotFallBack(Path objectFile) {
// <home>/jre/lib/polyglot/libpolyglot.so
// <home>/lib/polyglot/libpolyglot.so
Path parent = objectFile.getParent();
if (parent == null || !"polyglot".equals(getFileName(parent))) {
return null;
Expand All @@ -378,13 +378,9 @@ private static Path getGraalVmHomeLibPolyglotFallBack(Path objectFile) {
return null;
}
Path home = null;
Path jreOrJdk = parent.getParent();
if (jreOrJdk != null) {
if ("jre".equals(getFileName(jreOrJdk))) {
home = jreOrJdk.getParent();
} else {
home = jreOrJdk;
}
Path jdk = parent.getParent();
if (jdk != null) {
home = jdk;
}
return home != null && isJdkHome(home) ? home : null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,8 @@ protected Path getGraalVMHome() {
}

/**
* Returns filename of the binary, depending on OS. Binary will be searched in {@code bin} or
* {@code jre/bin} directory.
* Returns filename of the binary, depending on OS. Binary will be searched in {@code bin}
* directory.
*
* @param binaryName binary name, without path.
* @return OS-dependent binary filename.
Expand All @@ -574,14 +574,9 @@ protected final Path getGraalVMBinaryPath(String binaryName) {
throw abort("Cannot exec to GraalVM binary: could not find GraalVM home");
}
for (String executableName : executableNames) {
Path[] execPaths = new Path[]{
graalVMHome.resolve("bin").resolve(executableName),
graalVMHome.resolve("jre").resolve("bin").resolve(executableName)
};
for (Path execPath : execPaths) {
if (Files.exists(execPath)) {
return execPath;
}
Path execPath = graalVMHome.resolve("bin").resolve(executableName);
if (Files.exists(execPath)) {
return execPath;
}
}
throw abort("Cannot exec to GraalVM binary: could not find a '" + binaryName + "' executable");
Expand Down

0 comments on commit b7ba2fa

Please sign in to comment.