Skip to content

Commit

Permalink
Merge pull request #904 from gsmet/ssl-library-path-macos
Browse files Browse the repository at this point in the history
Fix the library path for MacOS for SSL support
  • Loading branch information
gsmet authored Feb 14, 2019
2 parents 98c3f75 + 6e76c6d commit 8f8df4e
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
package org.jboss.shamrock.deployment.steps;

import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -80,12 +83,18 @@ void build(List<SubstrateConfigBuildItem> substrateConfigBuildItems,
String graalVmHome = System.getenv("GRAALVM_HOME");

if (graalVmHome != null) {
String graalVmLibDirectory = graalVmHome + File.separator + "jre" + File.separator + "lib" + File.separator;
Path graalVmLibDirectory = Paths.get(graalVmHome, "jre", "lib");
Path linuxLibDirectory = graalVmLibDirectory.resolve("amd64");

if (Files.exists(linuxLibDirectory)) {
// On Linux, the SunEC library is in jre/lib/amd64/
systemProperty.produce(new SystemPropertyBuildItem("java.library.path", linuxLibDirectory.toString()));
} else {
// On MacOS, the SunEC library is directly in jre/lib/
systemProperty.produce(new SystemPropertyBuildItem("java.library.path", graalVmLibDirectory.toString()));
}
systemProperty.produce(
new SystemPropertyBuildItem("java.library.path", graalVmLibDirectory + "amd64"));
systemProperty.produce(
new SystemPropertyBuildItem("javax.net.ssl.trustStore", graalVmLibDirectory + "security" + File.separator + "cacerts"));
new SystemPropertyBuildItem("javax.net.ssl.trustStore", graalVmLibDirectory.resolve(Paths.get("security", "cacerts")).toString()));
} else {
log.warn(
"SSL is enabled but the GRAALVM_HOME environment variable is not set. The java.library.path property has not been set and will need to be set manually.");
Expand Down

0 comments on commit 8f8df4e

Please sign in to comment.