1- JDK_VERSIONS = [
2- "11" ,
3- "15" ,
4- "16" ,
5- "17" ,
6- ]
7-
8- PLATFORMS = [
9- "linux" ,
10- "macos" ,
11- "macos_aarch64" ,
12- "win" ,
13- ]
14-
15- # Remote JDK repos for those Linux platforms are only defined for JDK 11.
16- EXTRA_REMOTE_JDK11_REPOS = [
17- "remotejdk11_linux_aarch64" ,
18- "remotejdk11_linux_ppc64le" ,
19- "remotejdk11_linux_s390x" ,
20- ]
21-
22- REMOTE_JDK_REPOS = [("remotejdk" + version + "_" + platform ) for version in JDK_VERSIONS for platform in PLATFORMS ] + EXTRA_REMOTE_JDK11_REPOS
23-
24- REMOTE_JAVA_TOOLCHAINS = [("@" + name + "_toolchain_config_repo//:toolchain" ) for name in REMOTE_JDK_REPOS ]
25-
261module (
272 name = "rules_java" ,
283 compatibility_level = 1 ,
29- toolchains_to_register = [
30- "//toolchains:all" ,
31- "@local_jdk//:runtime_toolchain_definition" ,
32- ] + REMOTE_JAVA_TOOLCHAINS ,
33- version = "4.0.0" ,
4+ version = "5.1.0" ,
345)
356
367bazel_dep (name = "platforms" , version = "0.0.4" )
@@ -39,6 +10,8 @@ bazel_dep(name = "rules_cc", version = "0.0.1")
3910# rules_proto is required by @remote_java_tools, which is loaded via module extension.
4011bazel_dep (name = "rules_proto" , version = "4.0.0" )
4112
13+ register_toolchains ("//toolchains:all" )
14+
4215toolchains = use_extension ("//java:extensions.bzl" , "toolchains" )
4316
4417# Declare remote java tools repos
@@ -53,12 +26,39 @@ use_repo(toolchains, "remote_java_tools_darwin")
5326# Declare local jdk repo
5427use_repo (toolchains , "local_jdk" )
5528
29+ register_toolchains ("@local_jdk//:runtime_toolchain_definition" )
30+
5631# Declare all remote jdk toolchain config repos
32+ JDK_VERSIONS = [
33+ "11" ,
34+ "15" ,
35+ "16" ,
36+ "17" ,
37+ ]
38+
39+ PLATFORMS = [
40+ "linux" ,
41+ "macos" ,
42+ "macos_aarch64" ,
43+ "win" ,
44+ ]
45+
46+ # Remote JDK repos for those Linux platforms are only defined for JDK 11.
47+ EXTRA_REMOTE_JDK11_REPOS = [
48+ "remotejdk11_linux_aarch64" ,
49+ "remotejdk11_linux_ppc64le" ,
50+ "remotejdk11_linux_s390x" ,
51+ ]
52+
53+ REMOTE_JDK_REPOS = [("remotejdk" + version + "_" + platform ) for version in JDK_VERSIONS for platform in PLATFORMS ] + EXTRA_REMOTE_JDK11_REPOS
54+
5755[use_repo (
5856 toolchains ,
5957 repo + "_toolchain_config_repo" ,
6058) for repo in REMOTE_JDK_REPOS ]
6159
60+ [register_toolchains ("@" + name + "_toolchain_config_repo//:toolchain" ) for name in REMOTE_JDK_REPOS ]
61+
6262# Dev dependencies
6363bazel_dep (name = "rules_pkg" , dev_dependency = True , version = "0.5.1" )
6464bazel_dep (name = "bazel_skylib" , dev_dependency = True , version = "1.2.0" )
0 commit comments