1module( 2 name = "rules_java", 3 version = "7.6.1", 4 # Requires @bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type. 5 bazel_compatibility = [">=7.0.0"], 6 compatibility_level = 1, 7) 8 9bazel_dep(name = "platforms", version = "0.0.4") 10bazel_dep(name = "rules_cc", version = "0.0.2") 11bazel_dep(name = "bazel_features", version = "1.11.0") 12bazel_dep(name = "bazel_skylib", version = "1.6.1") 13 14# Required by @remote_java_tools, which is loaded via module extension. 15bazel_dep(name = "rules_proto", version = "4.0.0") 16bazel_dep(name = "rules_license", version = "0.0.3") 17 18register_toolchains("//toolchains:all") 19 20toolchains = use_extension("//java:extensions.bzl", "toolchains") 21 22# Declare remote java tools repos 23use_repo(toolchains, "remote_java_tools") 24use_repo(toolchains, "remote_java_tools_linux") 25use_repo(toolchains, "remote_java_tools_windows") 26use_repo(toolchains, "remote_java_tools_darwin_x86_64") 27use_repo(toolchains, "remote_java_tools_darwin_arm64") 28 29# Declare local jdk repo 30use_repo(toolchains, "local_jdk") 31 32register_toolchains( 33 "@local_jdk//:runtime_toolchain_definition", 34 "@local_jdk//:bootstrap_runtime_toolchain_definition", 35) 36 37# Declare all remote jdk toolchain config repos 38JDKS = { 39 # Must match JDK repos defined in remote_jdk8_repos() 40 "8": [ 41 "linux", 42 "linux_aarch64", 43 "linux_s390x", 44 "macos", 45 "macos_aarch64", 46 "windows", 47 ], 48 # Must match JDK repos defined in remote_jdk11_repos() 49 "11": [ 50 "linux", 51 "linux_aarch64", 52 "linux_ppc64le", 53 "linux_s390x", 54 "macos", 55 "macos_aarch64", 56 "win", 57 "win_arm64", 58 ], 59 # Must match JDK repos defined in remote_jdk17_repos() 60 "17": [ 61 "linux", 62 "linux_aarch64", 63 "linux_ppc64le", 64 "linux_s390x", 65 "macos", 66 "macos_aarch64", 67 "win", 68 "win_arm64", 69 ], 70 # Must match JDK repos defined in remote_jdk21_repos() 71 "21": [ 72 "linux", 73 "linux_aarch64", 74 "linux_ppc64le", 75 "linux_s390x", 76 "macos", 77 "macos_aarch64", 78 "win", 79 "win_arm64", 80 ], 81} 82 83REMOTE_JDK_REPOS = [(("remote_jdk" if version == "8" else "remotejdk") + version + "_" + platform) for version in JDKS for platform in JDKS[version]] 84 85[use_repo( 86 toolchains, 87 repo + "_toolchain_config_repo", 88) for repo in REMOTE_JDK_REPOS] 89 90[register_toolchains("@" + name + "_toolchain_config_repo//:all") for name in REMOTE_JDK_REPOS] 91 92# Dev dependencies 93bazel_dep(name = "rules_pkg", version = "0.9.1", dev_dependency = True) 94 95# Override rules_python version to deal with #161 and https://github.com/bazelbuild/bazel/issues/20458 96single_version_override( 97 module_name = "rules_python", 98 version = "0.24.0", 99) 100