diff options
author | cushon <cushon@google.com> | 2018-06-11 08:30:15 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-06-11 08:31:36 -0700 |
commit | 72141a1330aaf88d4a44e5fda8541c2cdf915c77 (patch) | |
tree | a218af7e30c72c98e3ef2c1b31ce386be4889549 /src/main | |
parent | e28c0ab84c7967e10cc3cd5333560c54653084bd (diff) |
update bazel's embedded jdk to jdk9
- Updates the embedded JDK to Azul Zulu 9.0.7
- All integration tests use Bazel with the embedded JDK
Also updated: http://storage.googleapis.com/bazel-mirror/openjdk/index.html
Closes #5312, #5314, #5315
PiperOrigin-RevId: 200055008
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/cpp/blaze.cc | 7 | ||||
-rw-r--r-- | src/main/cpp/startup_options.cc | 16 | ||||
-rw-r--r-- | src/main/cpp/startup_options.h | 3 |
3 files changed, 22 insertions, 4 deletions
diff --git a/src/main/cpp/blaze.cc b/src/main/cpp/blaze.cc index 7487c76c90..d6ede0c7b0 100644 --- a/src/main/cpp/blaze.cc +++ b/src/main/cpp/blaze.cc @@ -417,6 +417,13 @@ static vector<string> GetArgumentArray( result.push_back("-XX:HeapDumpPath=" + blaze_util::PathAsJvmFlag(heap_crash_path)); + // TODO(b/109998449): only assume JDK >= 9 for embedded JDKs + if (!globals->options->GetEmbeddedJavabase().empty()) { + // quiet warnings from com.google.protobuf.UnsafeUtil, + // see: https://github.com/google/protobuf/issues/3781 + result.push_back("--add-opens=java.base/java.nio=ALL-UNNAMED"); + } + result.push_back("-Xverify:none"); vector<string> user_options; diff --git a/src/main/cpp/startup_options.cc b/src/main/cpp/startup_options.cc index 8f028f55c6..7b5625c2ef 100644 --- a/src/main/cpp/startup_options.cc +++ b/src/main/cpp/startup_options.cc @@ -414,16 +414,24 @@ string StartupOptions::GetSystemJavabase() const { return blaze::GetSystemJavabase(); } +string StartupOptions::GetEmbeddedJavabase() { + string bundled_jre_path = blaze_util::JoinPath( + install_base, "_embedded_binaries/embedded_tools/jdk"); + if (blaze_util::CanExecuteFile(blaze_util::JoinPath( + bundled_jre_path, GetJavaBinaryUnderJavabase()))) { + return bundled_jre_path; + } + return ""; +} + string StartupOptions::GetHostJavabase() { // 1) Allow overriding the host_javabase via --host_javabase. if (!host_javabase.empty()) { return host_javabase; } if (default_host_javabase.empty()) { - string bundled_jre_path = blaze_util::JoinPath( - install_base, "_embedded_binaries/embedded_tools/jdk"); - if (blaze_util::CanExecuteFile(blaze_util::JoinPath( - bundled_jre_path, GetJavaBinaryUnderJavabase()))) { + string bundled_jre_path = GetEmbeddedJavabase(); + if (!bundled_jre_path.empty()) { // 2) Use a bundled JVM if we have one. default_host_javabase = bundled_jre_path; } else { diff --git a/src/main/cpp/startup_options.h b/src/main/cpp/startup_options.h index 84079f1b3f..3998195545 100644 --- a/src/main/cpp/startup_options.h +++ b/src/main/cpp/startup_options.h @@ -266,6 +266,9 @@ class StartupOptions { // from a blazerc file, if a key is not present, it is the default. std::map<std::string, std::string> option_sources; + // Returns the embedded JDK, or an empty string. + std::string GetEmbeddedJavabase(); + // Returns the GetHostJavabase. This should be called after parsing // the --host_javabase option. std::string GetHostJavabase(); |