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