blob: 11f27205fc22780de0776893b7831d7214ea5375 [file] [log] [blame]
Googler3c84aa82023-04-11 09:40:31 -07001# Copyright 2023 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"""Macros for defining dependencies we need to build Bazel.
15
16"""
17
Googler13ecdf52024-01-02 12:15:30 -080018load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
Yun Peng849da312024-01-30 10:16:17 -080019load("//src/tools/bzlmod:utils.bzl", "get_canonical_repo_name")
Yun Pengc1f2aff2023-11-07 09:51:02 -080020
21##################################################################################
22#
23# The list of repositories required while bootstrapping Bazel offline
24#
25##################################################################################
26DIST_ARCHIVE_REPOS = [get_canonical_repo_name(repo) for repo in [
Fabian Meumertzheimb9a05782024-05-13 09:18:57 -070027 # keep sorted
Yun Pengc1f2aff2023-11-07 09:51:02 -080028 "abseil-cpp",
29 "apple_support",
30 "bazel_skylib",
31 "blake3",
32 "c-ares",
33 "com_github_grpc_grpc",
34 "com_google_protobuf",
35 "io_bazel_skydoc",
36 "platforms",
37 "rules_cc",
38 "rules_go",
Fabian Meumertzheimb9a05782024-05-13 09:18:57 -070039 "rules_graalvm",
Yun Pengc1f2aff2023-11-07 09:51:02 -080040 "rules_java",
41 "rules_jvm_external",
Yun Peng849da312024-01-30 10:16:17 -080042 "rules_kotlin",
Yun Pengc1f2aff2023-11-07 09:51:02 -080043 "rules_license",
44 "rules_pkg",
45 "rules_proto",
46 "rules_python",
Googler8ef7b702024-04-25 05:46:55 -070047 "sqlite3",
Yun Pengc1f2aff2023-11-07 09:51:02 -080048 "upb",
49 "zlib",
50 "zstd-jni",
51]] + [(get_canonical_repo_name("com_github_grpc_grpc") + suffix) for suffix in [
52 # Extra grpc dependencies introduced via its module extension
53 "~grpc_repo_deps_ext~bazel_gazelle", # TODO: Should be a bazel_dep
54 "~grpc_repo_deps_ext~bazel_skylib", # TODO: Should be removed
55 "~grpc_repo_deps_ext~com_envoyproxy_protoc_gen_validate",
56 "~grpc_repo_deps_ext~com_github_cncf_udpa",
57 "~grpc_repo_deps_ext~com_google_googleapis",
58 "~grpc_repo_deps_ext~envoy_api",
59 "~grpc_repo_deps_ext~rules_cc", # TODO: Should be removed
Yun Peng849da312024-01-30 10:16:17 -080060]] + [
61 # TODO(pcloudy): Remove after https://github.com/bazelbuild/rules_kotlin/issues/1106 is fixed
62 get_canonical_repo_name("rules_kotlin") + "~rules_kotlin_extensions~com_github_jetbrains_kotlin",
Xdng Yng6d840d12024-05-21 14:01:28 -070063] + ["bazel_features~"]
Yun Pengc1f2aff2023-11-07 09:51:02 -080064
65##################################################################################
66#
67# Make sure all URLs below are mirrored to https://mirror.bazel.build
68#
69##################################################################################
Googler3c84aa82023-04-11 09:40:31 -070070
71def embedded_jdk_repositories():
72 """OpenJDK distributions used to create a version of Bazel bundled with the OpenJDK."""
Yun Pengc1f2aff2023-11-07 09:51:02 -080073 http_file(
Googler3c84aa82023-04-11 09:40:31 -070074 name = "openjdk_linux_vanilla",
Yun Pengc1f2aff2023-11-07 09:51:02 -080075 sha256 = "0c0eadfbdc47a7ca64aeab51b9c061f71b6e4d25d2d87674512e9b6387e9e3a6",
Googler3c84aa82023-04-11 09:40:31 -070076 downloaded_file_path = "zulu-linux-vanilla.tar.gz",
Yun Pengc1f2aff2023-11-07 09:51:02 -080077 url = "https://cdn.azul.com/zulu/bin/zulu21.28.85-ca-jdk21.0.0-linux_x64.tar.gz",
Googler3c84aa82023-04-11 09:40:31 -070078 )
Yun Pengc1f2aff2023-11-07 09:51:02 -080079 http_file(
Googler3c84aa82023-04-11 09:40:31 -070080 name = "openjdk_linux_aarch64_vanilla",
Yun Pengc1f2aff2023-11-07 09:51:02 -080081 sha256 = "1fb64b8036c5d463d8ab59af06bf5b6b006811e6012e3b0eb6bccf57f1c55835",
Googler3c84aa82023-04-11 09:40:31 -070082 downloaded_file_path = "zulu-linux-aarch64-vanilla.tar.gz",
Yun Pengc1f2aff2023-11-07 09:51:02 -080083 url = "https://cdn.azul.com/zulu/bin/zulu21.28.85-ca-jdk21.0.0-linux_aarch64.tar.gz",
Googler3c84aa82023-04-11 09:40:31 -070084 )
85
Yun Pengc1f2aff2023-11-07 09:51:02 -080086 http_file(
Googler3c84aa82023-04-11 09:40:31 -070087 name = "openjdk_linux_s390x_vanilla",
Zheng Wei Tane771e662024-02-01 05:04:01 -080088 sha256 = "0d5676c50821e0d0b951bf3ffd717e7a13be2a89d8848a5c13b4aedc6f982c78",
Googler3c84aa82023-04-11 09:40:31 -070089 downloaded_file_path = "adoptopenjdk-s390x-vanilla.tar.gz",
Zheng Wei Tane771e662024-02-01 05:04:01 -080090 url = "https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2%2B13/OpenJDK21U-jdk_s390x_linux_hotspot_21.0.2_13.tar.gz",
Googler3c84aa82023-04-11 09:40:31 -070091 )
92
Yun Pengc1f2aff2023-11-07 09:51:02 -080093 # JDK21 unavailable so use JDK19 instead for linux ppc64le.
94 http_file(
95 name = "openjdk_linux_ppc64le_vanilla",
Zheng Wei Tane771e662024-02-01 05:04:01 -080096 sha256 = "d08de863499d8851811c893e8915828f2cd8eb67ed9e29432a6b4e222d80a12f",
Yun Pengc1f2aff2023-11-07 09:51:02 -080097 downloaded_file_path = "adoptopenjdk-ppc64le-vanilla.tar.gz",
Zheng Wei Tane771e662024-02-01 05:04:01 -080098 url = "https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2%2B13/OpenJDK21U-jdk_ppc64le_linux_hotspot_21.0.2_13.tar.gz",
Yun Pengc1f2aff2023-11-07 09:51:02 -080099 )
100 http_file(
Googler3c84aa82023-04-11 09:40:31 -0700101 name = "openjdk_macos_x86_64_vanilla",
Yun Pengc1f2aff2023-11-07 09:51:02 -0800102 sha256 = "9639b87db586d0c89f7a9892ae47f421e442c64b97baebdff31788fbe23265bd",
Googler3c84aa82023-04-11 09:40:31 -0700103 downloaded_file_path = "zulu-macos-vanilla.tar.gz",
Yun Pengc1f2aff2023-11-07 09:51:02 -0800104 url = "https://cdn.azul.com/zulu/bin/zulu21.28.85-ca-jdk21.0.0-macosx_x64.tar.gz",
Googler3c84aa82023-04-11 09:40:31 -0700105 )
Yun Pengc1f2aff2023-11-07 09:51:02 -0800106 http_file(
Googler3c84aa82023-04-11 09:40:31 -0700107 name = "openjdk_macos_aarch64_vanilla",
Yun Pengc1f2aff2023-11-07 09:51:02 -0800108 sha256 = "2a7a99a3ea263dbd8d32a67d1e6e363ba8b25c645c826f5e167a02bbafaff1fa",
Googler3c84aa82023-04-11 09:40:31 -0700109 downloaded_file_path = "zulu-macos-aarch64-vanilla.tar.gz",
Yun Pengc1f2aff2023-11-07 09:51:02 -0800110 url = "https://cdn.azul.com/zulu/bin/zulu21.28.85-ca-jdk21.0.0-macosx_aarch64.tar.gz",
Googler3c84aa82023-04-11 09:40:31 -0700111 )
Yun Pengc1f2aff2023-11-07 09:51:02 -0800112 http_file(
Googler3c84aa82023-04-11 09:40:31 -0700113 name = "openjdk_win_vanilla",
Yun Pengc1f2aff2023-11-07 09:51:02 -0800114 sha256 = "e9959d500a0d9a7694ac243baf657761479da132f0f94720cbffd092150bd802",
Googler3c84aa82023-04-11 09:40:31 -0700115 downloaded_file_path = "zulu-win-vanilla.zip",
Yun Pengc1f2aff2023-11-07 09:51:02 -0800116 url = "https://cdn.azul.com/zulu/bin/zulu21.28.85-ca-jdk21.0.0-win_x64.zip",
Googler3c84aa82023-04-11 09:40:31 -0700117 )
118
Yun Pengc1f2aff2023-11-07 09:51:02 -0800119 # JDK21 unavailable from zulu, we'll use Microsoft's OpenJDK build instead.
120 http_file(
Googler3c84aa82023-04-11 09:40:31 -0700121 name = "openjdk_win_arm64_vanilla",
Yun Pengc1f2aff2023-11-07 09:51:02 -0800122 sha256 = "975603e684f2ec5a525b3b5336d6aa0b09b5b7d2d0d9e271bd6a9892ad550181",
Googler3c84aa82023-04-11 09:40:31 -0700123 downloaded_file_path = "zulu-win-arm64.zip",
Yun Pengc1f2aff2023-11-07 09:51:02 -0800124 url = "https://aka.ms/download-jdk/microsoft-jdk-21.0.0-windows-aarch64.zip",
125 )
126
Yun Pengc1f2aff2023-11-07 09:51:02 -0800127def android_deps_repos():
128 """Required by building the android tools."""
129 http_archive(
130 name = "desugar_jdk_libs",
131 sha256 = "ef71be474fbb3b3b7bd70cda139f01232c63b9e1bbd08c058b00a8d538d4db17",
132 strip_prefix = "desugar_jdk_libs-24dcd1dead0b64aae3d7c89ca9646b5dc4068009",
133 url = "https://github.com/google/desugar_jdk_libs/archive/24dcd1dead0b64aae3d7c89ca9646b5dc4068009.zip",
Googler3c84aa82023-04-11 09:40:31 -0700134 )