bazel: remove java toolchain (#1427)

I thought we needed this since we saw issues on nixOS where we couldn't find a jdk.
It turns out this is not actually required.
This commit is contained in:
Malte Poll 2023-03-14 13:55:33 +01:00 committed by GitHub
parent 6ea5588bdc
commit e4b5ef0ed4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 68 deletions

View File

@ -11,11 +11,6 @@ build --experimental_output_directory_naming_scheme=diff_against_baseline
build --incompatible_enable_cc_toolchain_resolution
build --action_env BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
# disable automatic toolchain detection for Java
build --incompatible_use_toolchain_resolution_for_java_rules
build --java_runtime_version=pinned_remotejdk_11
build --tool_java_runtime_version=pinned_remotejdk_11
# inject version information into binaries
build --stamp --workspace_status_command=tools/workspace_status

View File

@ -1,7 +1,3 @@
load("//bazel/toolchains:java_deps.bzl", "java_deps")
java_deps()
# Go toolchain
load("//bazel/toolchains:go_rules_deps.bzl", "go_deps")

View File

@ -1,59 +0,0 @@
"""Java toolchain dependencies for Bazel.
Defines hermetic java toolchains.
"""
load("@bazel_tools//tools/jdk:remote_java_repository.bzl", "remote_java_repository")
HASHES = {
"linux_aarch64": "9f5ac83b584a297c792cc5feb67c752a2d9fc1259abec3a477e96be8b672f452",
"linux_x86_64": "6fae6811b0f3aebb14c3e59a5fde14481cff412ef8ca23221993f1ab33269aab",
"osx_aarch64": "2a3f56af83f9d180dfce5d6e771a292bbbd68a77c7c18ed3bdb607e86d773704",
"osx_x86_64": "6234ebb7567c416ff28e2f080569e67656ae8fcdb3b601d8348d4d504ca79e68",
}
OS = {
"linux": "linux",
"osx": "macosx",
}
ARCH = {
"aarch64": "aarch64",
"x86_64": "x64",
}
def java_deps():
for os in OS:
for arch in ["x86_64", "aarch64"]:
_java_repository(
os = os,
arch = arch,
zulu_version = "11.62.17",
jdk_version = "11.0.18",
)
def _java_repository(os, arch, zulu_version, jdk_version, jdk_major = 11):
"""Defines a java repository for the given os and architecture.
Args:
os: The os of the java repository.
arch: The architecture of the java repository.
jdk_major: The major version of the java repository.
zulu_version: The zulu version of the java repository.
jdk_version: The jdk version of the java repository.
"""
path = "zulu-embedded" if os == "linux" and arch == "aarch64" else "zulu"
remote_java_repository(
name = "pinned_remotejdk%s_%s_%s" % (jdk_major, os, arch),
prefix = "pinned_remotejdk",
sha256 = HASHES["%s_%s" % (os, arch)],
strip_prefix = "zulu%s-ca-jdk%s-%s_%s" % (zulu_version, jdk_version, OS[os], ARCH[arch]),
target_compatible_with = [
"@platforms//os:" + os,
"@platforms//cpu:" + arch,
],
urls = [
"https://cdn.azul.com/%s/bin/zulu%s-ca-jdk%s-%s_%s.tar.gz" % (path, zulu_version, jdk_version, OS[os], ARCH[arch]),
],
version = jdk_major,
)