blob: d558ff0cbf4bcf936e1321780a1a1088cf0e2a14 [file] [log] [blame]
Googler75c7ad02022-05-23 13:27:49 -07001# Part of the Crubit project, under the Apache License v2.0 with LLVM
2# Exceptions. See /LICENSE for license information.
3# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
6
Teddy Katzadb0c172022-11-23 01:02:01 -08007# https://github.com/bazelbuild/bazel-skylib/releases/tag/1.3.0
8
9http_archive(
Jing Lu031ff6a2023-08-23 03:24:29 -070010 name = "platforms",
11 sha256 = "3a561c99e7bdbe9173aa653fd579fe849f1d8d67395780ab4770b1f381431d51",
12 urls = [
13 "https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.7/platforms-0.0.7.tar.gz",
14 "https://github.com/bazelbuild/platforms/releases/download/0.0.7/platforms-0.0.7.tar.gz",
15 ],
16)
17
18http_archive(
Teddy Katzadb0c172022-11-23 01:02:01 -080019 name = "bazel_skylib",
20 sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506",
21 urls = [
22 "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
23 "https://github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
24 ],
25)
26
27load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
28
29bazel_skylib_workspace()
30
Googler75c7ad02022-05-23 13:27:49 -070031http_archive(
Lukasz Anforowiczaaa2a0f2023-04-11 09:01:14 -070032 name = "rules_license",
33 sha256 = "6157e1e68378532d0241ecd15d3c45f6e5cfd98fc10846045509fb2a7cc9e381",
34 urls = [
35 "https://mirror.bazel.build/github.com/bazelbuild/rules_license/releases/download/0.0.4/rules_license-0.0.4.tar.gz",
36 "https://github.com/bazelbuild/rules_license/releases/download/0.0.4/rules_license-0.0.4.tar.gz",
37 ],
38)
39
40http_archive(
Googler75c7ad02022-05-23 13:27:49 -070041 name = "rules_rust",
Jing Lu2ecfa602023-08-02 01:47:01 -070042 patch_args = [
43 "-p1",
44 ],
45 patches = [
46 # copybara:strip_begin(Google-internal)
47 # The patch is based on the copybara transformations here:
48 # http://google3/third_party/bazel_rules/rules_rust/copy.bara.sky;l=398;rcl=549936350
49 # copybara:strip_end
50 "@@//bazel/rules_rust:attach_rust_bindings_from_cc_aspect.patch",
51 ],
Jing Luba67ca72023-07-18 04:55:56 -070052 sha256 = "4a9cb4fda6ccd5b5ec393b2e944822a62e050c7c06f1ea41607f14c4fdec57a2",
53 urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.25.1/rules_rust-v0.25.1.tar.gz"],
Googler75c7ad02022-05-23 13:27:49 -070054)
55
56load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains")
57
58rules_rust_dependencies()
59
Yongheng Chen90812652024-07-24 15:43:21 -070060RUST_TOOLCHAIN_VERSION = "nightly/2024-07-20"
Jing Luba67ca72023-07-18 04:55:56 -070061
Marcel Hlopko84aeda42022-07-08 02:38:30 -070062rust_register_toolchains(
Jing Lud476b752023-07-27 09:25:47 -070063 allocator_library = "@//common:rust_allocator_shims",
Lukasz Anforowiczc3f27f62023-04-13 13:43:30 -070064 dev_components = True,
Googlercaa102f2023-07-28 04:26:51 -070065 edition = "2021",
66 versions = [
67 RUST_TOOLCHAIN_VERSION,
68 ],
Lukasz Anforowiczc3f27f62023-04-13 13:43:30 -070069)
Googler75c7ad02022-05-23 13:27:49 -070070
71load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")
72
73crate_universe_dependencies()
74
75load("@rules_rust//crate_universe:defs.bzl", "crate", "crates_repository", "render_config")
76
Jing Luba67ca72023-07-18 04:55:56 -070077# after changing `packages`, re-generate Cargo.lock:
Googler75c7ad02022-05-23 13:27:49 -070078# CARGO_BAZEL_REPIN=1 bazelisk sync --only=crate_index
79crates_repository(
80 name = "crate_index",
Jing Luba67ca72023-07-18 04:55:56 -070081 cargo_lockfile = "//:Cargo.lock",
Googler75c7ad02022-05-23 13:27:49 -070082 packages = {
83 "anyhow": crate.spec(
84 version = ">0.0.0",
85 ),
Lukasz Anforowicz459800d2023-04-13 07:08:27 -070086 "clap": crate.spec(
87 features = [
Jing Luba67ca72023-07-18 04:55:56 -070088 "derive",
Lukasz Anforowicz459800d2023-04-13 07:08:27 -070089 "color",
90 "derive",
91 "env",
Lukasz Anforowicz459800d2023-04-13 07:08:27 -070092 "std",
Jing Luba67ca72023-07-18 04:55:56 -070093 "string",
Lukasz Anforowicz459800d2023-04-13 07:08:27 -070094 "suggestions",
Lukasz Anforowicz459800d2023-04-13 07:08:27 -070095 ],
Jing Luba67ca72023-07-18 04:55:56 -070096 version = ">=4.3.12",
Lukasz Anforowicz459800d2023-04-13 07:08:27 -070097 ),
98 "either": crate.spec(
99 version = ">1.0.0",
100 ),
Devin Jeanpierre6ed0f602023-03-01 17:22:54 -0800101 "flagset": crate.spec(
102 version = ">0.0.0",
103 ),
Devin Jeanpierre656d7162024-08-20 13:42:33 -0700104 "googletest": crate.spec(
105 version = ">0.0.0",
106 ),
Googler75c7ad02022-05-23 13:27:49 -0700107 "itertools": crate.spec(
108 version = ">0.0.0",
109 ),
110 "maplit": crate.spec(
111 version = ">0.0.0",
112 ),
Michael VanBemmel5014b3e2022-08-03 16:27:34 -0700113 "once_cell": crate.spec(
114 version = ">0.0.0",
115 ),
Googler75c7ad02022-05-23 13:27:49 -0700116 "pin-project": crate.spec(
117 version = ">0.0.0",
118 ),
119 "proc-macro2": crate.spec(
120 version = ">0.0.0",
121 ),
122 "quote": crate.spec(
123 version = ">0.0.0",
124 ),
Jing Lu04f9f5c2023-07-27 11:09:26 -0700125 "regex": crate.spec(
126 version = ">=1.6.0",
127 ),
Marcel Hlopko3a95e022022-07-08 00:26:16 -0700128 "salsa": crate.spec(
129 version = ">0.0.0",
130 ),
Googler75c7ad02022-05-23 13:27:49 -0700131 "serde": crate.spec(
Googlercaa102f2023-07-28 04:26:51 -0700132 features = [
133 "derive",
134 "rc",
135 ],
Googler75c7ad02022-05-23 13:27:49 -0700136 version = ">0.0.0",
137 ),
138 "serde_json": crate.spec(
139 version = ">0.0.0",
140 ),
Marcel Hlopko9bcf75d2022-06-03 02:22:46 -0700141 "static_assertions": crate.spec(
Marcel Hlopko9bcf75d2022-06-03 02:22:46 -0700142 version = ">0.0.0",
143 ),
Googler75c7ad02022-05-23 13:27:49 -0700144 "syn": crate.spec(
145 features = ["extra-traits"],
146 version = ">0.0.0",
147 ),
Jing Lu04f9f5c2023-07-27 11:09:26 -0700148 "tempfile": crate.spec(
149 version = "=3.4.0",
Googlercaa102f2023-07-28 04:26:51 -0700150 ),
Lukasz Anforowicz9fca6b42023-04-11 12:02:59 -0700151 "unicode-ident": crate.spec(
Lukasz Anforowiczf22cf762023-04-06 15:08:17 -0700152 version = ">0.0.0",
153 ),
Googler75c7ad02022-05-23 13:27:49 -0700154 },
Googler75c7ad02022-05-23 13:27:49 -0700155 render_config = render_config(
156 default_package_name = "",
157 ),
Jing Luba67ca72023-07-18 04:55:56 -0700158 rust_version = RUST_TOOLCHAIN_VERSION,
Googler75c7ad02022-05-23 13:27:49 -0700159)
160
161load("@crate_index//:defs.bzl", "crate_repositories")
162
163crate_repositories()
164
Luca Versaric21d92f2022-05-25 00:56:30 -0700165# https://google.github.io/googletest/quickstart-bazel.html
Luca Versaric21d92f2022-05-25 00:56:30 -0700166http_archive(
Googlercaa102f2023-07-28 04:26:51 -0700167 name = "com_google_googletest",
168 sha256 = "7fda611bceb5a793824a3c63ecbf68d2389e70c38f5763e9b1d415ca24912f44",
169 strip_prefix = "googletest-1336c4b6d1a6f4bc6beebccb920e5ff858889292",
170 urls = ["https://github.com/google/googletest/archive/1336c4b6d1a6f4bc6beebccb920e5ff858889292.zip"],
Luca Versaric21d92f2022-05-25 00:56:30 -0700171)
172
Lukasz Anforowicz88328ed2023-04-13 06:50:41 -0700173# zstd is a dependency of llvm. See https://reviews.llvm.org/D143344#4232172
174http_archive(
175 name = "llvm_zstd",
176 build_file = "@llvm-raw//utils/bazel/third_party_build:zstd.BUILD",
177 sha256 = "7c42d56fac126929a6a85dbc73ff1db2411d04f104fae9bdea51305663a83fd0",
178 strip_prefix = "zstd-1.5.2",
179 urls = [
Googlercaa102f2023-07-28 04:26:51 -0700180 "https://github.com/facebook/zstd/releases/download/v1.5.2/zstd-1.5.2.tar.gz",
Lukasz Anforowicz88328ed2023-04-13 06:50:41 -0700181 ],
182)
183
Jing Lud905a5f2023-05-31 09:23:01 -0700184# @llvm-project//llvm:Support needs zlib.
185http_archive(
186 name = "llvm_zlib",
187 build_file = "@llvm-raw//utils/bazel/third_party_build:zlib-ng.BUILD",
188 sha256 = "e36bb346c00472a1f9ff2a0a4643e590a254be6379da7cddd9daeb9a7f296731",
189 strip_prefix = "zlib-ng-2.0.7",
190 urls = [
191 "https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.0.7.zip",
192 ],
193)
194
Matthew Riley03a01e32022-05-24 10:16:04 -0700195# Create the "loader" repository, then use it to configure the desired LLVM
196# repository. For more details, see the comment in bazel/llvm.bzl.
Googler75c7ad02022-05-23 13:27:49 -0700197
Googlercaa102f2023-07-28 04:26:51 -0700198load("//bazel:llvm.bzl", "llvm_loader_repository", "llvm_loader_repository_dependencies")
199
Matthew Riley03a01e32022-05-24 10:16:04 -0700200llvm_loader_repository_dependencies()
Googlercaa102f2023-07-28 04:26:51 -0700201
Matthew Riley03a01e32022-05-24 10:16:04 -0700202llvm_loader_repository(name = "llvm-loader")
Googler75c7ad02022-05-23 13:27:49 -0700203
Matthew Riley03a01e32022-05-24 10:16:04 -0700204load("@llvm-loader//:llvm.bzl", "llvm_repository")
Googlercaa102f2023-07-28 04:26:51 -0700205
Matthew Riley03a01e32022-05-24 10:16:04 -0700206llvm_repository(name = "llvm-project")
Sam McCall000d1c62023-06-23 14:10:13 -0700207
208# protobuf (used in nullability/; crubit proper should not depend on it)
209http_archive(
210 name = "rules_proto",
211 sha256 = "dc3fb206a2cb3441b485eb1e423165b231235a1ea9b031b4433cf7bc1fa460dd",
212 strip_prefix = "rules_proto-5.3.0-21.7",
213 urls = [
214 "https://github.com/bazelbuild/rules_proto/archive/refs/tags/5.3.0-21.7.tar.gz",
215 ],
216)
Googlercaa102f2023-07-28 04:26:51 -0700217
Sam McCall000d1c62023-06-23 14:10:13 -0700218load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
Googlercaa102f2023-07-28 04:26:51 -0700219
Sam McCall000d1c62023-06-23 14:10:13 -0700220rules_proto_dependencies()
Googlercaa102f2023-07-28 04:26:51 -0700221
Sam McCall000d1c62023-06-23 14:10:13 -0700222rules_proto_toolchains()