blob: e4976f731691def1aaba633af9c371afdaa808d4 [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
Xùdōng Yánge2530202024-09-25 02:48:02 -040018load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
Xùdōng Yáng7a5c1fa2024-04-02 17:42:24 -040019load("//src/tools/bzlmod:utils.bzl", "get_canonical_repo_name")
Yun Peng33a313c2023-11-08 11:44:57 +010020
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 [
Xùdōng Yáng298d3d62024-05-13 15:11:14 -040027 # keep sorted
Yun Peng33a313c2023-11-08 11:44:57 +010028 "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",
Xùdōng Yáng298d3d62024-05-13 15:11:14 -040039 "rules_graalvm",
Yun Peng33a313c2023-11-08 11:44:57 +010040 "rules_java",
41 "rules_jvm_external",
Xùdōng Yáng7a5c1fa2024-04-02 17:42:24 -040042 "rules_kotlin",
Yun Peng33a313c2023-11-08 11:44:57 +010043 "rules_license",
44 "rules_pkg",
45 "rules_proto",
46 "rules_python",
47 "upb",
48 "zlib",
49 "zstd-jni",
50]] + [(get_canonical_repo_name("com_github_grpc_grpc") + suffix) for suffix in [
51 # Extra grpc dependencies introduced via its module extension
52 "~grpc_repo_deps_ext~bazel_gazelle", # TODO: Should be a bazel_dep
53 "~grpc_repo_deps_ext~bazel_skylib", # TODO: Should be removed
54 "~grpc_repo_deps_ext~com_envoyproxy_protoc_gen_validate",
55 "~grpc_repo_deps_ext~com_github_cncf_udpa",
56 "~grpc_repo_deps_ext~com_google_googleapis",
57 "~grpc_repo_deps_ext~envoy_api",
58 "~grpc_repo_deps_ext~rules_cc", # TODO: Should be removed
Xùdōng Yáng7a5c1fa2024-04-02 17:42:24 -040059]] + [
60 # TODO(pcloudy): Remove after https://github.com/bazelbuild/rules_kotlin/issues/1106 is fixed
61 get_canonical_repo_name("rules_kotlin") + "~rules_kotlin_extensions~com_github_jetbrains_kotlin",
Xùdōng Yáng84525a02024-05-22 14:46:00 -040062] + ["bazel_features~"]
Yun Peng33a313c2023-11-08 11:44:57 +010063
64##################################################################################
65#
66# Make sure all URLs below are mirrored to https://mirror.bazel.build
67#
68##################################################################################
Googler3c84aa82023-04-11 09:40:31 -070069
70def embedded_jdk_repositories():
71 """OpenJDK distributions used to create a version of Bazel bundled with the OpenJDK."""
Yun Peng33a313c2023-11-08 11:44:57 +010072 http_file(
Googler3c84aa82023-04-11 09:40:31 -070073 name = "openjdk_linux_vanilla",
Xùdōng Yángf5861072024-10-10 14:47:55 -040074 integrity = "sha256-MY0MLtPIdvt+oslSlFzc997PtSZMpRrs4VnmNaxT1UQ=",
Googler3c84aa82023-04-11 09:40:31 -070075 downloaded_file_path = "zulu-linux-vanilla.tar.gz",
Xùdōng Yángf5861072024-10-10 14:47:55 -040076 url = "https://cdn.azul.com/zulu/bin/zulu21.36.17-ca-jdk21.0.4-linux_x64.tar.gz",
Googler3c84aa82023-04-11 09:40:31 -070077 )
Yun Peng33a313c2023-11-08 11:44:57 +010078 http_file(
Googler3c84aa82023-04-11 09:40:31 -070079 name = "openjdk_linux_aarch64_vanilla",
Xùdōng Yángf5861072024-10-10 14:47:55 -040080 integrity = "sha256-2jwtfbM2cLz2ZTJEGut/M9zw0ifI2v5841zuZ/aCnEw=",
Googler3c84aa82023-04-11 09:40:31 -070081 downloaded_file_path = "zulu-linux-aarch64-vanilla.tar.gz",
Xùdōng Yángf5861072024-10-10 14:47:55 -040082 url = "https://cdn.azul.com/zulu/bin/zulu21.36.17-ca-jdk21.0.4-linux_aarch64.tar.gz",
Googler3c84aa82023-04-11 09:40:31 -070083 )
Yun Peng33a313c2023-11-08 11:44:57 +010084 http_file(
Googler3c84aa82023-04-11 09:40:31 -070085 name = "openjdk_linux_s390x_vanilla",
Xùdōng Yángf5861072024-10-10 14:47:55 -040086 integrity = "sha256-yQDI1k+rHlMnSXT6Skxzalo3VEhaXFb0lHKBSAdzZYo=",
Googler3c84aa82023-04-11 09:40:31 -070087 downloaded_file_path = "adoptopenjdk-s390x-vanilla.tar.gz",
Xùdōng Yángf5861072024-10-10 14:47:55 -040088 url = "https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.4%2B7/OpenJDK21U-jdk_s390x_linux_hotspot_21.0.4_7.tar.gz",
Googler3c84aa82023-04-11 09:40:31 -070089 )
Yun Peng33a313c2023-11-08 11:44:57 +010090 http_file(
91 name = "openjdk_linux_ppc64le_vanilla",
Xùdōng Yángf5861072024-10-10 14:47:55 -040092 integrity = "sha256-wgjND7kFYGRKkPkoZn0vU7/kCMlXpeNiBlha2HRCd2E=",
Yun Peng33a313c2023-11-08 11:44:57 +010093 downloaded_file_path = "adoptopenjdk-ppc64le-vanilla.tar.gz",
Xùdōng Yángf5861072024-10-10 14:47:55 -040094 url = "https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.4%2B7/OpenJDK21U-jdk_ppc64le_linux_hotspot_21.0.4_7.tar.gz",
Yun Peng33a313c2023-11-08 11:44:57 +010095 )
96 http_file(
Googler3c84aa82023-04-11 09:40:31 -070097 name = "openjdk_macos_x86_64_vanilla",
Xùdōng Yángf5861072024-10-10 14:47:55 -040098 integrity = "sha256-XOdaaiR8cCm3TEynz29g/SstaM4eiVb7RI0phDFrX+o=",
Googler3c84aa82023-04-11 09:40:31 -070099 downloaded_file_path = "zulu-macos-vanilla.tar.gz",
Xùdōng Yángf5861072024-10-10 14:47:55 -0400100 url = "https://cdn.azul.com/zulu/bin/zulu21.36.17-ca-jdk21.0.4-macosx_x64.tar.gz",
Googler3c84aa82023-04-11 09:40:31 -0700101 )
Yun Peng33a313c2023-11-08 11:44:57 +0100102 http_file(
Googler3c84aa82023-04-11 09:40:31 -0700103 name = "openjdk_macos_aarch64_vanilla",
Xùdōng Yángf5861072024-10-10 14:47:55 -0400104 integrity = "sha256-vCdQ+BoWbMbpwwroqrpU8lOoyOydjPwEpVX+IHEse/8=",
Googler3c84aa82023-04-11 09:40:31 -0700105 downloaded_file_path = "zulu-macos-aarch64-vanilla.tar.gz",
Xùdōng Yángf5861072024-10-10 14:47:55 -0400106 url = "https://cdn.azul.com/zulu/bin/zulu21.36.17-ca-jdk21.0.4-macosx_aarch64.tar.gz",
Googler3c84aa82023-04-11 09:40:31 -0700107 )
Yun Peng33a313c2023-11-08 11:44:57 +0100108 http_file(
Googler3c84aa82023-04-11 09:40:31 -0700109 name = "openjdk_win_vanilla",
Xùdōng Yángf5861072024-10-10 14:47:55 -0400110 integrity = "sha256-13Ha0Q0/C0QMNobR89K2izIIAqyXshLYdnGvPy7viEg=",
Googler3c84aa82023-04-11 09:40:31 -0700111 downloaded_file_path = "zulu-win-vanilla.zip",
Xùdōng Yángf5861072024-10-10 14:47:55 -0400112 url = "https://cdn.azul.com/zulu/bin/zulu21.36.17-ca-jdk21.0.4-win_x64.zip",
Googler3c84aa82023-04-11 09:40:31 -0700113 )
Yun Peng33a313c2023-11-08 11:44:57 +0100114 http_file(
Googler3c84aa82023-04-11 09:40:31 -0700115 name = "openjdk_win_arm64_vanilla",
Xùdōng Yángf5861072024-10-10 14:47:55 -0400116 integrity = "sha256-n4c+zPAwsdPch57B6w/14Rv3YALcgcXGRMNGK/bFFGs=",
Googler3c84aa82023-04-11 09:40:31 -0700117 downloaded_file_path = "zulu-win-arm64.zip",
Xùdōng Yángf5861072024-10-10 14:47:55 -0400118 url = "https://cdn.azul.com/zulu/bin/zulu21.36.17-ca-jdk21.0.4-win_aarch64.zip",
Yun Peng33a313c2023-11-08 11:44:57 +0100119 )
120
121def bazelci_rules_repo():
122 """Required by the Bazel CI jobs."""
123 http_archive(
124 name = "bazelci_rules",
125 sha256 = "eca21884e6f66a88c358e580fd67a6b148d30ab57b1680f62a96c00f9bc6a07e",
126 strip_prefix = "bazelci_rules-1.0.0",
127 url = "https://github.com/bazelbuild/continuous-integration/releases/download/rules-1.0.0/bazelci_rules-1.0.0.tar.gz",
128 )
129
130def android_deps_repos():
131 """Required by building the android tools."""
132 http_archive(
133 name = "desugar_jdk_libs",
134 sha256 = "ef71be474fbb3b3b7bd70cda139f01232c63b9e1bbd08c058b00a8d538d4db17",
135 strip_prefix = "desugar_jdk_libs-24dcd1dead0b64aae3d7c89ca9646b5dc4068009",
136 url = "https://github.com/google/desugar_jdk_libs/archive/24dcd1dead0b64aae3d7c89ca9646b5dc4068009.zip",
Googler3c84aa82023-04-11 09:40:31 -0700137 )