blob: df83febdbf952692072586c27ea74982e4581c9b [file] [log] [blame]
# External dependencies for the java_* rules.
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("@bazel_tools//tools/jdk:jdk_build_file.bzl", "JDK_BUILD_TEMPLATE")
load("@bazel_tools//tools/jdk:local_java_repository.bzl", "local_java_repository")
load("@bazel_tools//tools/jdk:remote_java_repository.bzl", "remote_java_repository")
maybe(
local_java_repository,
name = "local_jdk",
java_home = DEFAULT_SYSTEM_JAVABASE,
build_file_content = JDK_BUILD_TEMPLATE,
)
# OpenJDK distributions that should only be downloaded on demand (e.g. when
# building a java_library or a genrule that uses java make variables).
# This will allow us to stop bundling the full JDK with Bazel.
# Note that while these are currently the same as the openjdk_* rules in
# Bazel's WORKSPACE file, but they don't have to be the same.
# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
{remotejdk11_linux}
target_compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
],
version = "11",
)
# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
{remotejdk11_linux_aarch64}
target_compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:aarch64",
],
version = "11",
)
# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
{remotejdk11_linux_ppc64le}
target_compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:ppc",
],
version = "11",
)
# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
{remotejdk11_linux_s390x}
target_compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:s390x",
],
version = "11",
)
# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
{remotejdk11_macos}
target_compatible_with = [
"@platforms//os:macos",
"@platforms//cpu:x86_64",
],
version = "11",
)
# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
{remotejdk11_macos_aarch64}
target_compatible_with = [
"@platforms//os:macos",
"@platforms//cpu:aarch64",
],
version = "11",
)
# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
{remotejdk11_win}
target_compatible_with = [
"@platforms//os:windows",
"@platforms//cpu:x86_64",
],
version = "11",
)
# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
{remotejdk11_win_arm64}
target_compatible_with = [
"@platforms//os:windows",
"@platforms//cpu:arm64",
],
version = "11",
)
# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
{remotejdk17_linux}
target_compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
],
version = "17",
)
# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
{remotejdk17_linux_aarch64}
target_compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:aarch64",
],
version = "17",
)
# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
{remotejdk17_macos}
target_compatible_with = [
"@platforms//os:macos",
"@platforms//cpu:x86_64",
],
version = "17",
)
# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
{remotejdk17_macos_aarch64}
target_compatible_with = [
"@platforms//os:macos",
"@platforms//cpu:aarch64",
],
version = "17",
)
# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
{remotejdk17_win}
target_compatible_with = [
"@platforms//os:windows",
"@platforms//cpu:x86_64",
],
version = "17",
)
maybe(
remote_java_repository,
{remotejdk17_win_arm64}
target_compatible_with = [
"@platforms//os:windows",
"@platforms//cpu:arm64",
],
version = "17",
)
# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
{remotejdk18_linux}
target_compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
],
version = "18",
)
# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
{remotejdk18_linux_aarch64}
target_compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:aarch64",
],
version = "18",
)
# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
{remotejdk18_macos}
target_compatible_with = [
"@platforms//os:macos",
"@platforms//cpu:x86_64",
],
version = "18",
)
# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
{remotejdk18_macos_aarch64}
target_compatible_with = [
"@platforms//os:macos",
"@platforms//cpu:aarch64",
],
version = "18",
)
# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
{remotejdk18_win}
target_compatible_with = [
"@platforms//os:windows",
"@platforms//cpu:x86_64",
],
version = "18",
)
# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
{remotejdk18_win_arm64}
target_compatible_with = [
"@platforms//os:windows",
"@platforms//cpu:arm64",
],
version = "18",
)
maybe(
http_archive,
{remote_java_tools}
)
maybe(
http_archive,
{remote_java_tools_linux}
)
maybe(
http_archive,
{remote_java_tools_windows}
)
maybe(
http_archive,
{remote_java_tools_darwin_x86_64}
)
maybe(
http_archive,
{remote_java_tools_darwin_arm64}
)
maybe(
http_archive,
{rules_java}
)
# Needed only because of java_tools.
maybe(
http_archive,
{rules_cc}
)
# Needed only because of java_tools.
maybe(
http_archive,
{rules_proto}
)
register_toolchains("@bazel_tools//tools/jdk:all")