blob: 5a872615b973fa14cab0b4351f525455a1c8f44d [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
Devin Jeanpierre03a38a22024-04-19 15:00:41 -070060RUST_TOOLCHAIN_VERSION = "nightly/2024-04-14"
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 ),
Googler75c7ad02022-05-23 13:27:49 -0700104 "itertools": crate.spec(
105 version = ">0.0.0",
106 ),
107 "maplit": crate.spec(
108 version = ">0.0.0",
109 ),
Michael VanBemmel5014b3e2022-08-03 16:27:34 -0700110 "once_cell": crate.spec(
111 version = ">0.0.0",
112 ),
Googler75c7ad02022-05-23 13:27:49 -0700113 "pin-project": crate.spec(
114 version = ">0.0.0",
115 ),
116 "proc-macro2": crate.spec(
117 version = ">0.0.0",
118 ),
119 "quote": crate.spec(
120 version = ">0.0.0",
121 ),
Jing Lu04f9f5c2023-07-27 11:09:26 -0700122 "regex": crate.spec(
123 version = ">=1.6.0",
124 ),
Marcel Hlopko3a95e022022-07-08 00:26:16 -0700125 "salsa": crate.spec(
126 version = ">0.0.0",
127 ),
Googler75c7ad02022-05-23 13:27:49 -0700128 "serde": crate.spec(
Googlercaa102f2023-07-28 04:26:51 -0700129 features = [
130 "derive",
131 "rc",
132 ],
Googler75c7ad02022-05-23 13:27:49 -0700133 version = ">0.0.0",
134 ),
135 "serde_json": crate.spec(
136 version = ">0.0.0",
137 ),
Marcel Hlopko9bcf75d2022-06-03 02:22:46 -0700138 "static_assertions": crate.spec(
Marcel Hlopko9bcf75d2022-06-03 02:22:46 -0700139 version = ">0.0.0",
140 ),
Googler75c7ad02022-05-23 13:27:49 -0700141 "syn": crate.spec(
142 features = ["extra-traits"],
143 version = ">0.0.0",
144 ),
Jing Lu04f9f5c2023-07-27 11:09:26 -0700145 "tempfile": crate.spec(
146 version = "=3.4.0",
Googlercaa102f2023-07-28 04:26:51 -0700147 ),
Lukasz Anforowicz9fca6b42023-04-11 12:02:59 -0700148 "unicode-ident": crate.spec(
Lukasz Anforowiczf22cf762023-04-06 15:08:17 -0700149 version = ">0.0.0",
150 ),
Googler75c7ad02022-05-23 13:27:49 -0700151 },
Googler75c7ad02022-05-23 13:27:49 -0700152 render_config = render_config(
153 default_package_name = "",
154 ),
Jing Luba67ca72023-07-18 04:55:56 -0700155 rust_version = RUST_TOOLCHAIN_VERSION,
Googler75c7ad02022-05-23 13:27:49 -0700156)
157
158load("@crate_index//:defs.bzl", "crate_repositories")
159
160crate_repositories()
161
Luca Versaric21d92f2022-05-25 00:56:30 -0700162# https://google.github.io/googletest/quickstart-bazel.html
Luca Versaric21d92f2022-05-25 00:56:30 -0700163http_archive(
Googlercaa102f2023-07-28 04:26:51 -0700164 name = "com_google_googletest",
165 sha256 = "7fda611bceb5a793824a3c63ecbf68d2389e70c38f5763e9b1d415ca24912f44",
166 strip_prefix = "googletest-1336c4b6d1a6f4bc6beebccb920e5ff858889292",
167 urls = ["https://github.com/google/googletest/archive/1336c4b6d1a6f4bc6beebccb920e5ff858889292.zip"],
Luca Versaric21d92f2022-05-25 00:56:30 -0700168)
169
Lukasz Anforowicz88328ed2023-04-13 06:50:41 -0700170# zstd is a dependency of llvm. See https://reviews.llvm.org/D143344#4232172
171http_archive(
172 name = "llvm_zstd",
173 build_file = "@llvm-raw//utils/bazel/third_party_build:zstd.BUILD",
174 sha256 = "7c42d56fac126929a6a85dbc73ff1db2411d04f104fae9bdea51305663a83fd0",
175 strip_prefix = "zstd-1.5.2",
176 urls = [
Googlercaa102f2023-07-28 04:26:51 -0700177 "https://github.com/facebook/zstd/releases/download/v1.5.2/zstd-1.5.2.tar.gz",
Lukasz Anforowicz88328ed2023-04-13 06:50:41 -0700178 ],
179)
180
Jing Lud905a5f2023-05-31 09:23:01 -0700181# @llvm-project//llvm:Support needs zlib.
182http_archive(
183 name = "llvm_zlib",
184 build_file = "@llvm-raw//utils/bazel/third_party_build:zlib-ng.BUILD",
185 sha256 = "e36bb346c00472a1f9ff2a0a4643e590a254be6379da7cddd9daeb9a7f296731",
186 strip_prefix = "zlib-ng-2.0.7",
187 urls = [
188 "https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.0.7.zip",
189 ],
190)
191
Matthew Riley03a01e32022-05-24 10:16:04 -0700192# Create the "loader" repository, then use it to configure the desired LLVM
193# repository. For more details, see the comment in bazel/llvm.bzl.
Googler75c7ad02022-05-23 13:27:49 -0700194
Googlercaa102f2023-07-28 04:26:51 -0700195load("//bazel:llvm.bzl", "llvm_loader_repository", "llvm_loader_repository_dependencies")
196
Matthew Riley03a01e32022-05-24 10:16:04 -0700197llvm_loader_repository_dependencies()
Googlercaa102f2023-07-28 04:26:51 -0700198
Matthew Riley03a01e32022-05-24 10:16:04 -0700199llvm_loader_repository(name = "llvm-loader")
Googler75c7ad02022-05-23 13:27:49 -0700200
Matthew Riley03a01e32022-05-24 10:16:04 -0700201load("@llvm-loader//:llvm.bzl", "llvm_repository")
Googlercaa102f2023-07-28 04:26:51 -0700202
Matthew Riley03a01e32022-05-24 10:16:04 -0700203llvm_repository(name = "llvm-project")
Sam McCall000d1c62023-06-23 14:10:13 -0700204
205# protobuf (used in nullability/; crubit proper should not depend on it)
206http_archive(
207 name = "rules_proto",
208 sha256 = "dc3fb206a2cb3441b485eb1e423165b231235a1ea9b031b4433cf7bc1fa460dd",
209 strip_prefix = "rules_proto-5.3.0-21.7",
210 urls = [
211 "https://github.com/bazelbuild/rules_proto/archive/refs/tags/5.3.0-21.7.tar.gz",
212 ],
213)
Googlercaa102f2023-07-28 04:26:51 -0700214
Sam McCall000d1c62023-06-23 14:10:13 -0700215load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
Googlercaa102f2023-07-28 04:26:51 -0700216
Sam McCall000d1c62023-06-23 14:10:13 -0700217rules_proto_dependencies()
Googlercaa102f2023-07-28 04:26:51 -0700218
Sam McCall000d1c62023-06-23 14:10:13 -0700219rules_proto_toolchains()