Skip to content

Instantly share code, notes, and snippets.

@stephenjudkins
Last active November 7, 2019 17:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stephenjudkins/80d80fd764a6be53dde8648cac0500bc to your computer and use it in GitHub Desktop.
Save stephenjudkins/80d80fd764a6be53dde8648cac0500bc to your computer and use it in GitHub Desktop.
bazel-managed JDK
build --javabase=//:jdk
build --host_javabase=//:jdk
build --java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
build --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
alias(
name = "jdk",
actual = select(
{
"@bazel_tools//src/conditions:darwin": "@jdk8_macos//:jdk",
"@bazel_tools//src/conditions:darwin_x86_64": "@jdk8_macos//:jdk",
"@bazel_tools//src/conditions:linux_x86_64": "@jdk8_linux//:jdk",
},
no_match_error = "Could not find a JDK for host execution environment, please explicitly" +
" provide one using `--host_javabase.`",
),
visibility = ["//visibility:public"],
)
load(
"@bazel_tools//tools/build_defs/repo:http.bzl",
"http_archive",
"http_jar",
"http_file",
)
# Embedded JDKs
http_archive(
name = "jdk8_linux",
build_file = "@local_jdk//:BUILD.bazel",
sha256 = "568e7578f1b20b1e62a8ed2c374bad4eb0e75d221323ccfa6ba8d7bc56cf33cf",
strip_prefix = "zulu8.38.0.13-ca-jdk8.0.212-linux_x64",
urls = [
"https://cdn.azul.com/zulu/bin/zulu8.38.0.13-ca-jdk8.0.212-linux_x64.tar.gz",
],
)
http_archive(
name = "jdk8_macos",
build_file = "@local_jdk//:BUILD.bazel",
sha256 = "64538f3eed34a298cc48168e89326fd323a55d801a3e6b2c3cc948effe124250",
strip_prefix = "zulu8.38.0.13-ca-jdk8.0.212-macosx_x64",
urls = [
"https://cdn.azul.com/zulu/bin/zulu8.38.0.13-ca-jdk8.0.212-macosx_x64.tar.gz",
],
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment