1# Copyright 2019 The Bazel Authors. All rights reserved. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15"""Development and production dependencies of rules_java.""" 16 17load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") 18load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") 19load("//toolchains:jdk_build_file.bzl", "JDK_BUILD_TEMPLATE") 20load("//toolchains:local_java_repository.bzl", "local_java_repository") 21load("//toolchains:remote_java_repository.bzl", "remote_java_repository") 22 23def java_tools_repos(): 24 """ Declares the remote java_tools repositories """ 25 maybe( 26 http_archive, 27 name = "remote_java_tools", 28 sha256 = "cbb62ecfef61568ded46260a8e8e8430755db7ec9638c0c7ff668a656f6c042f", 29 urls = [ 30 "https://mirror.bazel.build/bazel_java_tools/releases/java/v12.3/java_tools-v12.3.zip", 31 "https://github.com/bazelbuild/java_tools/releases/download/java_v12.3/java_tools-v12.3.zip", 32 ], 33 ) 34 35 maybe( 36 http_archive, 37 name = "remote_java_tools_linux", 38 sha256 = "32157b5218b151009f5b99bf5e2f65e28823d269dfbba8cd57e7da5e7cdd291d", 39 urls = [ 40 "https://mirror.bazel.build/bazel_java_tools/releases/java/v12.3/java_tools_linux-v12.3.zip", 41 "https://github.com/bazelbuild/java_tools/releases/download/java_v12.3/java_tools_linux-v12.3.zip", 42 ], 43 ) 44 45 maybe( 46 http_archive, 47 name = "remote_java_tools_windows", 48 sha256 = "ec6f91387d2353eacb0ca0492f35f68c5c7b0e7a80acd1fb825088b4b069fab1", 49 urls = [ 50 "https://mirror.bazel.build/bazel_java_tools/releases/java/v12.3/java_tools_windows-v12.3.zip", 51 "https://github.com/bazelbuild/java_tools/releases/download/java_v12.3/java_tools_windows-v12.3.zip", 52 ], 53 ) 54 55 maybe( 56 http_archive, 57 name = "remote_java_tools_darwin_x86_64", 58 sha256 = "3c3fb1967a0f35c73ff509505de53ca4611518922a6b7c8c22a468aa7503132c", 59 urls = [ 60 "https://mirror.bazel.build/bazel_java_tools/releases/java/v12.3/java_tools_darwin_x86_64-v12.3.zip", 61 "https://github.com/bazelbuild/java_tools/releases/download/java_v12.3/java_tools_darwin_x86_64-v12.3.zip", 62 ], 63 ) 64 65 maybe( 66 http_archive, 67 name = "remote_java_tools_darwin_arm64", 68 sha256 = "29aa0c2de4e3cf45bc55d2995ba803ecbd1173a8d363860abbc309551db7931b", 69 urls = [ 70 "https://mirror.bazel.build/bazel_java_tools/releases/java/v12.3/java_tools_darwin_arm64-v12.3.zip", 71 "https://github.com/bazelbuild/java_tools/releases/download/java_v12.3/java_tools_darwin_arm64-v12.3.zip", 72 ], 73 ) 74 75def local_jdk_repo(): 76 maybe( 77 local_java_repository, 78 name = "local_jdk", 79 build_file_content = JDK_BUILD_TEMPLATE, 80 ) 81 82def remote_jdk8_repos(name = ""): 83 """Imports OpenJDK 8 repositories. 84 85 Args: 86 name: The name of this macro (not used) 87 """ 88 maybe( 89 remote_java_repository, 90 name = "remote_jdk8_linux_aarch64", 91 target_compatible_with = [ 92 "@platforms//os:linux", 93 "@platforms//cpu:aarch64", 94 ], 95 sha256 = "f4072e82faa5a09fab2accf2892d4684324fc999d614583c3ff785e87c03963f", 96 strip_prefix = "zulu8.50.51.263-ca-jdk8.0.275-linux_aarch64", 97 urls = [ 98 "https://mirror.bazel.build/openjdk/azul-zulu-8.50.0.51-ca-jdk8.0.275/zulu8.50.51.263-ca-jdk8.0.275-linux_aarch64.tar.gz", 99 "https://cdn.azul.com/zulu-embedded/bin/zulu8.50.51.263-ca-jdk8.0.275-linux_aarch64.tar.gz", 100 ], 101 version = "8", 102 ) 103 maybe( 104 remote_java_repository, 105 name = "remote_jdk8_linux_s390x", 106 target_compatible_with = [ 107 "@platforms//os:linux", 108 "@platforms//cpu:s390x", 109 ], 110 sha256 = "276a431c79b7e94bc1b1b4fd88523383ae2d635ea67114dfc8a6174267f8fb2c", 111 strip_prefix = "jdk8u292-b10", 112 urls = [ 113 "https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u292-b10/OpenJDK8U-jdk_s390x_linux_hotspot_8u292b10.tar.gz", 114 ], 115 version = "8", 116 ) 117 maybe( 118 remote_java_repository, 119 name = "remote_jdk8_linux", 120 target_compatible_with = [ 121 "@platforms//os:linux", 122 "@platforms//cpu:x86_64", 123 ], 124 sha256 = "1db6b2fa642950ee1b4b1ec2b6bc8a9113d7a4cd723f79398e1ada7dab1c981c", 125 strip_prefix = "zulu8.50.0.51-ca-jdk8.0.275-linux_x64", 126 urls = [ 127 "https://mirror.bazel.build/openjdk/azul-zulu-8.50.0.51-ca-jdk8.0.275/zulu8.50.0.51-ca-jdk8.0.275-linux_x64.tar.gz", 128 "https://cdn.azul.com/zulu/bin/zulu8.50.0.51-ca-jdk8.0.275-linux_x64.tar.gz", 129 ], 130 version = "8", 131 ) 132 maybe( 133 remote_java_repository, 134 name = "remote_jdk8_macos_aarch64", 135 target_compatible_with = [ 136 "@platforms//os:macos", 137 "@platforms//cpu:aarch64", 138 ], 139 sha256 = "e5c84a46bbd985c3a53358db9c97a6fd4930f92b833c3163a0d1e47dab59768c", 140 strip_prefix = "zulu8.62.0.19-ca-jdk8.0.332-macosx_aarch64", 141 urls = [ 142 "https://cdn.azul.com/zulu/bin/zulu8.62.0.19-ca-jdk8.0.332-macosx_aarch64.tar.gz", 143 ], 144 version = "8", 145 ) 146 maybe( 147 remote_java_repository, 148 name = "remote_jdk8_macos", 149 target_compatible_with = [ 150 "@platforms//os:macos", 151 "@platforms//cpu:x86_64", 152 ], 153 sha256 = "b03176597734299c9a15b7c2cc770783cf14d121196196c1248e80c026b59c17", 154 strip_prefix = "zulu8.50.0.51-ca-jdk8.0.275-macosx_x64", 155 urls = [ 156 "https://mirror.bazel.build/openjdk/azul-zulu-8.50.0.51-ca-jdk8.0.275/zulu8.50.0.51-ca-jdk8.0.275-macosx_x64.tar.gz", 157 "https://cdn.azul.com/zulu/bin/zulu8.50.0.51-ca-jdk8.0.275-macosx_x64.tar.gz", 158 ], 159 version = "8", 160 ) 161 maybe( 162 remote_java_repository, 163 name = "remote_jdk8_windows", 164 target_compatible_with = [ 165 "@platforms//os:windows", 166 "@platforms//cpu:x86_64", 167 ], 168 sha256 = "49759b2bd2ab28231a21ff3a3bb45824ddef55d89b5b1a05a62e26a365da0774", 169 strip_prefix = "zulu8.50.0.51-ca-jdk8.0.275-win_x64", 170 urls = [ 171 "https://mirror.bazel.build/openjdk/azul-zulu-8.50.0.51-ca-jdk8.0.275/zulu8.50.0.51-ca-jdk8.0.275-win_x64.zip", 172 "https://cdn.azul.com/zulu/bin/zulu8.50.0.51-ca-jdk8.0.275-win_x64.zip", 173 ], 174 version = "8", 175 ) 176 REMOTE_JDK8_REPOS = [ 177 "remote_jdk8_linux_aarch64", 178 "remote_jdk8_linux_s390x", 179 "remote_jdk8_linux", 180 "remote_jdk8_macos_aarch64", 181 "remote_jdk8_macos", 182 "remote_jdk8_windows", 183 ] 184 for name in REMOTE_JDK8_REPOS: 185 native.register_toolchains("@" + name + "_toolchain_config_repo//:toolchain") 186 187def remote_jdk11_repos(): 188 """Imports OpenJDK 11 repositories.""" 189 maybe( 190 remote_java_repository, 191 name = "remotejdk11_linux", 192 target_compatible_with = [ 193 "@platforms//os:linux", 194 "@platforms//cpu:x86_64", 195 ], 196 sha256 = "e064b61d93304012351242bf0823c6a2e41d9e28add7ea7f05378b7243d34247", 197 strip_prefix = "zulu11.56.19-ca-jdk11.0.15-linux_x64", 198 urls = [ 199 "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-linux_x64.tar.gz", 200 "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-linux_x64.tar.gz", 201 ], 202 version = "11", 203 ) 204 205 maybe( 206 remote_java_repository, 207 name = "remotejdk11_linux_aarch64", 208 target_compatible_with = [ 209 "@platforms//os:linux", 210 "@platforms//cpu:aarch64", 211 ], 212 sha256 = "fc7c41a0005180d4ca471c90d01e049469e0614cf774566d4cf383caa29d1a97", 213 strip_prefix = "zulu11.56.19-ca-jdk11.0.15-linux_aarch64", 214 urls = [ 215 "https://mirror.bazel.build/cdn.azul.com/zulu-embedded/bin/zulu11.56.19-ca-jdk11.0.15-linux_aarch64.tar.gz", 216 "https://cdn.azul.com/zulu-embedded/bin/zulu11.56.19-ca-jdk11.0.15-linux_aarch64.tar.gz", 217 ], 218 version = "11", 219 ) 220 221 maybe( 222 remote_java_repository, 223 name = "remotejdk11_linux_ppc64le", 224 target_compatible_with = [ 225 "@platforms//os:linux", 226 "@platforms//cpu:ppc", 227 ], 228 sha256 = "a8fba686f6eb8ae1d1a9566821dbd5a85a1108b96ad857fdbac5c1e4649fc56f", 229 strip_prefix = "jdk-11.0.15+10", 230 urls = [ 231 "https://mirror.bazel.build/github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15+10/OpenJDK11U-jdk_ppc64le_linux_hotspot_11.0.15_10.tar.gz", 232 "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15+10/OpenJDK11U-jdk_ppc64le_linux_hotspot_11.0.15_10.tar.gz", 233 ], 234 version = "11", 235 ) 236 237 maybe( 238 remote_java_repository, 239 name = "remotejdk11_linux_s390x", 240 target_compatible_with = [ 241 "@platforms//os:linux", 242 "@platforms//cpu:s390x", 243 ], 244 sha256 = "a58fc0361966af0a5d5a31a2d8a208e3c9bb0f54f345596fd80b99ea9a39788b", 245 strip_prefix = "jdk-11.0.15+10", 246 urls = [ 247 "https://mirror.bazel.build/github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15+10/OpenJDK11U-jdk_s390x_linux_hotspot_11.0.15_10.tar.gz", 248 "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15+10/OpenJDK11U-jdk_s390x_linux_hotspot_11.0.15_10.tar.gz", 249 ], 250 version = "11", 251 ) 252 253 maybe( 254 remote_java_repository, 255 name = "remotejdk11_macos", 256 target_compatible_with = [ 257 "@platforms//os:macos", 258 "@platforms//cpu:x86_64", 259 ], 260 sha256 = "2614e5c5de8e989d4d81759de4c333aa5b867b17ab9ee78754309ba65c7f6f55", 261 strip_prefix = "zulu11.56.19-ca-jdk11.0.15-macosx_x64", 262 urls = [ 263 "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-macosx_x64.tar.gz", 264 "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-macosx_x64.tar.gz", 265 ], 266 version = "11", 267 ) 268 269 maybe( 270 remote_java_repository, 271 name = "remotejdk11_macos_aarch64", 272 target_compatible_with = [ 273 "@platforms//os:macos", 274 "@platforms//cpu:aarch64", 275 ], 276 sha256 = "6bb0d2c6e8a29dcd9c577bbb2986352ba12481a9549ac2c0bcfd00ed60e538d2", 277 strip_prefix = "zulu11.56.19-ca-jdk11.0.15-macosx_aarch64", 278 urls = [ 279 "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-macosx_aarch64.tar.gz", 280 "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-macosx_aarch64.tar.gz", 281 ], 282 version = "11", 283 ) 284 285 maybe( 286 remote_java_repository, 287 name = "remotejdk11_win", 288 target_compatible_with = [ 289 "@platforms//os:windows", 290 "@platforms//cpu:x86_64", 291 ], 292 sha256 = "a106c77389a63b6bd963a087d5f01171bd32aa3ee7377ecef87531390dcb9050", 293 strip_prefix = "zulu11.56.19-ca-jdk11.0.15-win_x64", 294 urls = [ 295 "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-win_x64.zip", 296 "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-win_x64.zip", 297 ], 298 version = "11", 299 ) 300 301 maybe( 302 remote_java_repository, 303 name = "remotejdk11_win_arm64", 304 target_compatible_with = [ 305 "@platforms//os:windows", 306 "@platforms//cpu:arm64", 307 ], 308 sha256 = "b8a28e6e767d90acf793ea6f5bed0bb595ba0ba5ebdf8b99f395266161e53ec2", 309 strip_prefix = "jdk-11.0.13+8", 310 urls = [ 311 "https://mirror.bazel.build/aka.ms/download-jdk/microsoft-jdk-11.0.13.8.1-windows-aarch64.zip", 312 ], 313 version = "11", 314 ) 315 316def remote_jdk17_repos(): 317 """Imports OpenJDK 17 repositories.""" 318 maybe( 319 remote_java_repository, 320 name = "remotejdk17_linux", 321 target_compatible_with = [ 322 "@platforms//os:linux", 323 "@platforms//cpu:x86_64", 324 ], 325 sha256 = "20c91a922eec795f3181eaa70def8b99d8eac56047c9a14bfb257c85b991df1b", 326 strip_prefix = "zulu17.38.21-ca-jdk17.0.5-linux_x64", 327 urls = [ 328 "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.38.21-ca-jdk17.0.5-linux_x64.tar.gz", 329 "https://cdn.azul.com/zulu/bin/zulu17.38.21-ca-jdk17.0.5-linux_x64.tar.gz", 330 ], 331 version = "17", 332 ) 333 334 maybe( 335 remote_java_repository, 336 name = "remotejdk17_linux_aarch64", 337 target_compatible_with = [ 338 "@platforms//os:linux", 339 "@platforms//cpu:aarch64", 340 ], 341 sha256 = "dbc6ae9163e7ff469a9ab1f342cd1bc1f4c1fb78afc3c4f2228ee3b32c4f3e43", 342 strip_prefix = "zulu17.38.21-ca-jdk17.0.5-linux_aarch64", 343 urls = [ 344 "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.38.21-ca-jdk17.0.5-linux_aarch64.tar.gz", 345 "https://cdn.azul.com/zulu/bin/zulu17.38.21-ca-jdk17.0.5-linux_aarch64.tar.gz", 346 ], 347 version = "17", 348 ) 349 350 maybe( 351 remote_java_repository, 352 name = "remotejdk17_linux_s390x", 353 target_compatible_with = [ 354 "@platforms//os:linux", 355 "@platforms//cpu:s390x", 356 ], 357 sha256 = "fdc82f4b06c880762503b0cb40e25f46cf8190d06011b3b768f4091d3334ef7f", 358 strip_prefix = "jdk-17.0.4.1+1", 359 urls = [ 360 "https://mirror.bazel.build/github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.4.1%2B1/OpenJDK17U-jdk_s390x_linux_hotspot_17.0.4.1_1.tar.gz", 361 "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.4.1%2B1/OpenJDK17U-jdk_s390x_linux_hotspot_17.0.4.1_1.tar.gz", 362 ], 363 version = "17", 364 ) 365 366 maybe( 367 remote_java_repository, 368 name = "remotejdk17_linux_ppc64le", 369 target_compatible_with = [ 370 "@platforms//os:linux", 371 "@platforms//cpu:ppc", 372 ], 373 sha256 = "cbedd0a1428b3058d156e99e8e9bc8769e0d633736d6776a4c4d9136648f2fd1", 374 strip_prefix = "jdk-17.0.4.1+1", 375 urls = [ 376 "https://mirror.bazel.build/github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.4.1%2B1/OpenJDK17U-jdk_ppc64le_linux_hotspot_17.0.4.1_1.tar.gz", 377 "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.4.1%2B1/OpenJDK17U-jdk_ppc64le_linux_hotspot_17.0.4.1_1.tar.gz", 378 ], 379 version = "17", 380 ) 381 382 maybe( 383 remote_java_repository, 384 name = "remotejdk17_macos", 385 target_compatible_with = [ 386 "@platforms//os:macos", 387 "@platforms//cpu:x86_64", 388 ], 389 sha256 = "e6317cee4d40995f0da5b702af3f04a6af2bbd55febf67927696987d11113b53", 390 strip_prefix = "zulu17.38.21-ca-jdk17.0.5-macosx_x64", 391 urls = [ 392 "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.38.21-ca-jdk17.0.5-macosx_x64.tar.gz", 393 "https://cdn.azul.com/zulu/bin/zulu17.38.21-ca-jdk17.0.5-macosx_x64.tar.gz", 394 ], 395 version = "17", 396 ) 397 398 maybe( 399 remote_java_repository, 400 name = "remotejdk17_macos_aarch64", 401 target_compatible_with = [ 402 "@platforms//os:macos", 403 "@platforms//cpu:aarch64", 404 ], 405 sha256 = "515dd56ec99bb5ae8966621a2088aadfbe72631818ffbba6e4387b7ee292ab09", 406 strip_prefix = "zulu17.38.21-ca-jdk17.0.5-macosx_aarch64", 407 urls = [ 408 "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.38.21-ca-jdk17.0.5-macosx_aarch64.tar.gz", 409 "https://cdn.azul.com/zulu/bin/zulu17.38.21-ca-jdk17.0.5-macosx_aarch64.tar.gz", 410 ], 411 version = "17", 412 ) 413 maybe( 414 remote_java_repository, 415 name = "remotejdk17_win", 416 target_compatible_with = [ 417 "@platforms//os:windows", 418 "@platforms//cpu:x86_64", 419 ], 420 sha256 = "9972c5b62a61b45785d3d956c559e079d9e91f144ec46225f5deeda214d48f27", 421 strip_prefix = "zulu17.38.21-ca-jdk17.0.5-win_x64", 422 urls = [ 423 "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.38.21-ca-jdk17.0.5-win_x64.zip", 424 "https://cdn.azul.com/zulu/bin/zulu17.38.21-ca-jdk17.0.5-win_x64.zip", 425 ], 426 version = "17", 427 ) 428 maybe( 429 remote_java_repository, 430 name = "remotejdk17_win_arm64", 431 target_compatible_with = [ 432 "@platforms//os:windows", 433 "@platforms//cpu:arm64", 434 ], 435 sha256 = "bc3476f2161bf99bc9a243ff535b8fc033b34ce9a2fa4b62fb8d79b6bfdc427f", 436 strip_prefix = "zulu17.38.21-ca-jdk17.0.5-win_aarch64", 437 urls = [ 438 "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.38.21-ca-jdk17.0.5-win_aarch64.zip", 439 "https://cdn.azul.com/zulu/bin/zulu17.38.21-ca-jdk17.0.5-win_aarch64.zip", 440 ], 441 version = "17", 442 ) 443 444def remote_jdk20_repos(): 445 """Imports OpenJDK 20 repositories.""" 446 maybe( 447 remote_java_repository, 448 name = "remotejdk20_linux", 449 target_compatible_with = [ 450 "@platforms//os:linux", 451 "@platforms//cpu:x86_64", 452 ], 453 sha256 = "0386418db7f23ae677d05045d30224094fc13423593ce9cd087d455069893bac", 454 strip_prefix = "zulu20.28.85-ca-jdk20.0.0-linux_x64", 455 urls = [ 456 "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu20.28.85-ca-jdk20.0.0-linux_x64.tar.gz", 457 "https://cdn.azul.com/zulu/bin/zulu20.28.85-ca-jdk20.0.0-linux_x64.tar.gz", 458 ], 459 version = "20", 460 ) 461 462 maybe( 463 remote_java_repository, 464 name = "remotejdk20_linux_aarch64", 465 target_compatible_with = [ 466 "@platforms//os:linux", 467 "@platforms//cpu:aarch64", 468 ], 469 sha256 = "47ce58ead9a05d5d53b96706ff6fa0eb2e46755ee67e2b416925e28f5b55038a", 470 strip_prefix = "zulu20.28.85-ca-jdk20.0.0-linux_aarch64", 471 urls = [ 472 "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu20.28.85-ca-jdk20.0.0-linux_aarch64.tar.gz", 473 "https://cdn.azul.com/zulu/bin/zulu20.28.85-ca-jdk20.0.0-linux_aarch64.tar.gz", 474 ], 475 version = "20", 476 ) 477 478 maybe( 479 remote_java_repository, 480 name = "remotejdk20_macos", 481 target_compatible_with = [ 482 "@platforms//os:macos", 483 "@platforms//cpu:x86_64", 484 ], 485 sha256 = "fde6cc17a194ea0d9b0c6c0cb6178199d8edfc282d649eec2c86a9796e843f86", 486 strip_prefix = "zulu20.28.85-ca-jdk20.0.0-macosx_x64", 487 urls = [ 488 "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu20.28.85-ca-jdk20.0.0-macosx_x64.tar.gz", 489 "https://cdn.azul.com/zulu/bin/zulu20.28.85-ca-jdk20.0.0-macosx_x64.tar.gz", 490 ], 491 version = "20", 492 ) 493 494 maybe( 495 remote_java_repository, 496 name = "remotejdk20_macos_aarch64", 497 target_compatible_with = [ 498 "@platforms//os:macos", 499 "@platforms//cpu:aarch64", 500 ], 501 sha256 = "a2eff6a940c2df3a2352278027e83f5959f34dcfc8663034fe92be0f1b91ce6f", 502 strip_prefix = "zulu20.28.85-ca-jdk20.0.0-macosx_aarch64", 503 urls = [ 504 "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu20.28.85-ca-jdk20.0.0-macosx_aarch64.tar.gz", 505 "https://cdn.azul.com/zulu/bin/zulu20.28.85-ca-jdk20.0.0-macosx_aarch64.tar.gz", 506 ], 507 version = "20", 508 ) 509 maybe( 510 remote_java_repository, 511 name = "remotejdk20_win", 512 target_compatible_with = [ 513 "@platforms//os:windows", 514 "@platforms//cpu:x86_64", 515 ], 516 sha256 = "ac5f6a7d84dbbb0bb4d376feb331cc4c49a9920562f2a5e85b7a6b4863b10e1e", 517 strip_prefix = "zulu20.28.85-ca-jdk20.0.0-win_x64", 518 urls = [ 519 "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu20.28.85-ca-jdk20.0.0-win_x64.zip", 520 "https://cdn.azul.com/zulu/bin/zulu20.28.85-ca-jdk20.0.0-win_x64.zip", 521 ], 522 version = "20", 523 ) 524 525def rules_java_dependencies(): 526 """An utility method to load all dependencies of rules_java. 527 528 Loads the remote repositories used by default in Bazel. 529 """ 530 531 local_jdk_repo() 532 remote_jdk11_repos() 533 remote_jdk17_repos() 534 remote_jdk20_repos() 535 java_tools_repos() 536 537def rules_java_toolchains(name = "toolchains"): 538 """An utility method to load all Java toolchains. 539 540 Args: 541 name: The name of this macro (not used) 542 """ 543 JDKS = { 544 # Must match JDK repos defined in remote_jdk11_repos() 545 "11": ["linux", "linux_aarch64", "linux_ppc64le", "linux_s390x", "macos", "macos_aarch64", "win", "win_arm64"], 546 # Must match JDK repos defined in remote_jdk17_repos() 547 "17": ["linux", "linux_aarch64", "linux_ppc64le", "linux_s390x", "macos", "macos_aarch64", "win", "win_arm64"], 548 # Must match JDK repos defined in remote_jdk20_repos() 549 "20": ["linux", "linux_aarch64", "macos", "macos_aarch64", "win"], 550 } 551 552 REMOTE_JDK_REPOS = [("remotejdk" + version + "_" + platform) for version in JDKS for platform in JDKS[version]] 553 554 native.register_toolchains("//toolchains:all") 555 native.register_toolchains("@local_jdk//:runtime_toolchain_definition") 556 for name in REMOTE_JDK_REPOS: 557 native.register_toolchains("@" + name + "_toolchain_config_repo//:toolchain") 558