WORKSPACE 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Use of this software is governed by the Business Source License
  4. # included in the LICENSE file.
  5. #
  6. # As of the Change Date specified in that file, in accordance with
  7. # the Business Source License, use of this software will be governed
  8. # by the Apache License, Version 2.0.
  9. load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
  10. load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
  11. """
  12. Materialize's Bazel Workspace.
  13. This `WORKSPACE` file defines all of the rule sets and remote repositories that
  14. we depend on. It's important to note that ordering matters. If an object is
  15. declared more than once it's the _first_ invocation that gets used. This can be
  16. especially tricky when rule sets have their own dependencies, generally
  17. included by calling a `*_dependencies()` macro.
  18. """
  19. # `bazel-lib`/`bazel-skylib`
  20. #
  21. # Provides generic rules for Bazel to help make things fit together.
  22. #
  23. # For example, Rust build scripts might require files live in a certain
  24. # location, but the dependent `c_library` can't specify an output location.
  25. # `bazel-lib` provides rules to copy files into a new directory that we can
  26. # then provide to the Rust rule.
  27. #
  28. # Note: In an ideal world the two rule sets would be combined into one.
  29. BAZEL_SKYLIB_VERSION = "1.7.1"
  30. BAZEL_SKYLIB_INTEGRITY = "sha256-vCg8381SalLDIBJ5zaS8KYZS76iYsQtNsIN9xRZSdW8="
  31. maybe(
  32. http_archive,
  33. name = "bazel_skylib",
  34. integrity = BAZEL_SKYLIB_INTEGRITY,
  35. urls = [
  36. "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/{0}/bazel-skylib-{0}.tar.gz".format(BAZEL_SKYLIB_VERSION),
  37. "https://github.com/bazelbuild/bazel-skylib/releases/download/{0}/bazel-skylib-{0}.tar.gz".format(BAZEL_SKYLIB_VERSION),
  38. ],
  39. )
  40. ASPECT_BAZEL_LIB_VERSION = "2.7.0"
  41. ASPECT_BAZEL_LIB_INTEGRITY = "sha256-NX2tnSEjJ8NdkkQZDvAQqtMV5z/6G+0aKeIMNy+co0Y="
  42. maybe(
  43. http_archive,
  44. name = "aspect_bazel_lib",
  45. integrity = ASPECT_BAZEL_LIB_INTEGRITY,
  46. strip_prefix = "bazel-lib-{0}".format(ASPECT_BAZEL_LIB_VERSION),
  47. url = "https://github.com/aspect-build/bazel-lib/releases/download/v{0}/bazel-lib-v{0}.tar.gz".format(ASPECT_BAZEL_LIB_VERSION),
  48. )
  49. load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies", "aspect_bazel_lib_register_toolchains")
  50. # Required bazel-lib dependencies
  51. aspect_bazel_lib_dependencies()
  52. # Register bazel-lib toolchains
  53. aspect_bazel_lib_register_toolchains()
  54. # C Repositories
  55. #
  56. # Loads all of the C dependencies that we rely on.
  57. load("//misc/bazel/c_deps:repositories.bzl", "c_repositories")
  58. c_repositories()
  59. # `rules_cc`
  60. #
  61. # Rules for building C/C++ projects. These are slowly being upstreamed into the
  62. # Bazel source tree, but some projects (e.g. protobuf) still depend on this
  63. # rule set.
  64. RULES_CC_VERSION = "0.1.1"
  65. RULES_CC_INTEGRITY = "sha256-cS13hosxUt1hjE1k+q3e/MWWX5D13m5t0dXdzQvoLUI="
  66. maybe(
  67. http_archive,
  68. name = "rules_cc",
  69. integrity = RULES_CC_INTEGRITY,
  70. strip_prefix = "rules_cc-{0}".format(RULES_CC_VERSION),
  71. urls = [
  72. "https://github.com/bazelbuild/rules_cc/releases/download/{0}/rules_cc-{0}.tar.gz".format(RULES_CC_VERSION),
  73. ],
  74. )
  75. # `rules_pkg`
  76. #
  77. # Rules for building archives, e.g. `tar` or `zip`, for packages.
  78. RULES_PKG_VERSION = "0.7.0"
  79. RULES_PKG_INTEGRITY = "sha256-iimOgydi7aGDBZfWT+fbWBeKqEzVkm121bdE1lWJQcI="
  80. maybe(
  81. http_archive,
  82. name = "rules_pkg",
  83. integrity = RULES_PKG_INTEGRITY,
  84. urls = [
  85. "https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/{0}/rules_pkg-{0}.tar.gz".format(RULES_PKG_VERSION),
  86. "https://github.com/bazelbuild/rules_pkg/releases/download/{0}/rules_pkg-{0}.tar.gz".format(RULES_PKG_VERSION),
  87. ],
  88. )
  89. # `rules_foreign_cc`
  90. #
  91. # Rules for building C/C++ projects that use foreign build systems, e.g. Make. One case that we use
  92. # this for is building `openssl`.
  93. #
  94. # TODO(parkmycar): We maintain a fork with the following fixes applied to the `mz-fixes` branch:
  95. #
  96. # 1. Versions of `make` >4.3 are buggy and have a segfault, we hit this segfault when building jemalloc.
  97. # See: <https://github.com/bazelbuild/rules_foreign_cc/issues/898>
  98. # See: <https://github.com/MaterializeInc/rules_foreign_cc/commit/8e28ba0bbbf7e73d70333b625bfec4a65114d8be>
  99. #
  100. # 2. Some libraries, e.g. jemalloc, preprocess and compile code in two separate steps, so we need
  101. # to make sure the sysroot is provided in CPPFLAGS, if it's set in CFLAGS.
  102. # See: <https://github.com/bazelbuild/rules_foreign_cc/pull/1023>
  103. # See: <https://github.com/MaterializeInc/rules_foreign_cc/commit/2199b1c304140fa959c3703b0b7e9cbf7d39c4c2>
  104. #
  105. # 3. Specify the AR tool to use when bootstrapping `make`. On macOS explicitly set the path to
  106. # be llvm-ar which we know exists in our toolchain.
  107. # See: <https://github.com/MaterializeInc/rules_foreign_cc/commit/e94986f05edf95fff025b6aeb995e09be8889b89>
  108. #
  109. # 4. `make` 4.2 fails to compile on Linux because of unrecognized symbols so we patch the source.
  110. # See: <https://github.com/MaterializeInc/rules_foreign_cc/commit/de4a79280f54d8796e86b7ab0b631939b7b44d05>
  111. #
  112. # 5. Mirror the GNU source code for `make` from the `MaterializeInc/toolchains` repository. We've
  113. # previously seen the upstream GNU FTP server go down which causes CI to break.
  114. # See: <https://github.com/MaterializeInc/rules_foreign_cc/commit/c994a0d6a86480d274dc1937d8861a56e6011cf0>
  115. RULES_FOREIGN_CC_VERSION = "c994a0d6a86480d274dc1937d8861a56e6011cf0"
  116. RULES_FOREIGN_CC_INTEGRITY = "sha256-kFSk41S84sVupSj7p+OxlHV5wXKoo67PvBy2vlXiQsg="
  117. maybe(
  118. http_archive,
  119. name = "rules_foreign_cc",
  120. integrity = RULES_FOREIGN_CC_INTEGRITY,
  121. strip_prefix = "rules_foreign_cc-{0}".format(RULES_FOREIGN_CC_VERSION),
  122. url = "https://github.com/MaterializeInc/rules_foreign_cc/archive/{0}.tar.gz".format(RULES_FOREIGN_CC_VERSION),
  123. )
  124. load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
  125. rules_foreign_cc_dependencies(make_version = "4.2")
  126. # `clang`/`llvm`
  127. #
  128. # Normally Bazel will use the system's version of clang as the default C
  129. # toolchain. This prevents the builds from being hermetic though so we include
  130. # our own.
  131. #
  132. # All of the clang related tools are provided under the `@llvm_toolchain_llvm`
  133. # repo. To see what's available run `bazel query @llvm_toolchain_llvm//...`.
  134. # System roots that we use, this is where clang will search for things like libc.
  135. _SYSROOT_DARWIN_BUILD_FILE = """
  136. filegroup(
  137. name = "sysroot",
  138. srcs = glob(
  139. include = ["**"],
  140. exclude = ["**/*:*"],
  141. ),
  142. visibility = ["//visibility:public"],
  143. )
  144. """
  145. DARWIN_SYSROOT_VERSION = "14.5"
  146. DARWIN_SYSROOT_INTEGRITY = "sha256-JCleYWOca1Z/B4Li1iwDKGEP/IkWWgKqXoygtJXyNTU="
  147. http_archive(
  148. name = "sysroot_darwin_universal",
  149. build_file_content = _SYSROOT_DARWIN_BUILD_FILE,
  150. integrity = DARWIN_SYSROOT_INTEGRITY,
  151. strip_prefix = "MacOSX{0}.sdk-min".format(DARWIN_SYSROOT_VERSION),
  152. urls = ["https://github.com/MaterializeInc/toolchains/releases/download/macos-sysroot-sdk-{0}-1/MacOSX{0}.sdk-min.tar.zst".format(DARWIN_SYSROOT_VERSION)],
  153. )
  154. _LINUX_SYSROOT_BUILD_FILE = """
  155. filegroup(
  156. name = "sysroot",
  157. srcs = glob(["*/**"]),
  158. visibility = ["//visibility:public"],
  159. )
  160. """
  161. # Format is <KERNEL_VERSION-GLIBC_VERSION-LIBSTDCXX_VERSION>
  162. LINUX_SYSROOT_VERSION = "5_10-2_35-11_4_0"
  163. LINUX_SYSROOT_X86_64_INTEGRITY = "sha256-H2q1ti0l6vETl6QBOIvwuizpAJrvKCMObTuw/0Gedy0="
  164. http_archive(
  165. name = "linux_sysroot-x86_64",
  166. build_file_content = _LINUX_SYSROOT_BUILD_FILE,
  167. integrity = LINUX_SYSROOT_X86_64_INTEGRITY,
  168. strip_prefix = "sysroot",
  169. urls = ["https://github.com/MaterializeInc/toolchains/releases/download/linux-sysroot-{0}/linux-sysroot-x86_64.tar.zst".format(LINUX_SYSROOT_VERSION)],
  170. )
  171. LINUX_SYSROOT_AARCH64_INTEGRITY = "sha256-kUasOepnmvdoJlI2JHm9T5o3alaS17xS4avwKDyaxMQ="
  172. http_archive(
  173. name = "linux_sysroot-aarch64",
  174. build_file_content = _LINUX_SYSROOT_BUILD_FILE,
  175. integrity = LINUX_SYSROOT_AARCH64_INTEGRITY,
  176. strip_prefix = "sysroot",
  177. urls = ["https://github.com/MaterializeInc/toolchains/releases/download/linux-sysroot-{0}/linux-sysroot-aarch64.tar.zst".format(LINUX_SYSROOT_VERSION)],
  178. )
  179. # Version of clang/llvm we use.
  180. #
  181. # We build our own clang toolchain, see the <https://github.com/MaterializeInc/toolchains> repository.
  182. LLVM_VERSION = "20.1.6"
  183. # We have a few variants of our clang toolchain, either improving how it's built or adding new tools.
  184. LLVM_VERSION_SUFFIX = "1"
  185. # Version of the "toolchains_llvm" rule set, _not_ the version of clang/llvm.
  186. #
  187. # We depend on a commit that includes <https://github.com/bazel-contrib/toolchains_llvm/pull/438>.
  188. TOOLCHAINS_LLVM_VERSION = "9f0a7cb0f752ffd430a5c80d749a2e84cb348876"
  189. TOOLCHAINS_LLVM_INTEGRITY = "sha256-9SY8+RwP3KPfaLtjQGzJmknOcxEpTkmu/h1ntaljYdw="
  190. maybe(
  191. http_archive,
  192. name = "toolchains_llvm",
  193. integrity = TOOLCHAINS_LLVM_INTEGRITY,
  194. strip_prefix = "toolchains_llvm-{0}".format(TOOLCHAINS_LLVM_VERSION),
  195. url = "https://github.com/bazel-contrib/toolchains_llvm/archive/{0}.tar.gz".format(TOOLCHAINS_LLVM_VERSION),
  196. )
  197. load("@toolchains_llvm//toolchain:deps.bzl", "bazel_toolchain_dependencies")
  198. bazel_toolchain_dependencies()
  199. load("@toolchains_llvm//toolchain:rules.bzl", "llvm_toolchain")
  200. llvm_toolchain(
  201. name = "llvm_toolchain",
  202. llvm_version = LLVM_VERSION,
  203. sha256 = {
  204. "darwin-aarch64": "02fb0842f75ec34f3df2162c27d01773bd122cf27e01e9e051bb56f9edec66f1",
  205. "darwin-x86_64": "4b382146c4483cf68b730df3329a975505205dc73dc86cfe9f3bacad06e22d49",
  206. "linux-aarch64": "46af59ce8c53338d90b72c401b5560d44bbb02df118f0f0daf08bf897a05f1a9",
  207. "linux-x86_64": "acf8c45aaa3f012d1f140893b5760daafd5965635941a4999c68d2d04a8aae4f",
  208. },
  209. sysroot = {
  210. "darwin-aarch64": "@sysroot_darwin_universal//:sysroot",
  211. "darwin-x86_64": "@sysroot_darwin_universal//:sysroot",
  212. "linux-x86_64": "@linux_sysroot-x86_64//:sysroot",
  213. "linux-aarch64": "@linux_sysroot-aarch64//:sysroot",
  214. },
  215. urls = {
  216. "darwin-aarch64": ["https://github.com/MaterializeInc/toolchains/releases/download/clang-{0}-{1}/darwin_aarch64.tar.zst".format(LLVM_VERSION, LLVM_VERSION_SUFFIX)],
  217. "darwin-x86_64": ["https://github.com/MaterializeInc/toolchains/releases/download/clang-{0}-{1}/darwin_x86_64.tar.zst".format(LLVM_VERSION, LLVM_VERSION_SUFFIX)],
  218. "linux-aarch64": ["https://github.com/MaterializeInc/toolchains/releases/download/clang-{0}-{1}/linux_aarch64.tar.zst".format(LLVM_VERSION, LLVM_VERSION_SUFFIX)],
  219. "linux-x86_64": ["https://github.com/MaterializeInc/toolchains/releases/download/clang-{0}-{1}/linux_x86_64.tar.zst".format(LLVM_VERSION, LLVM_VERSION_SUFFIX)],
  220. },
  221. )
  222. load("@llvm_toolchain//:toolchains.bzl", "llvm_register_toolchains")
  223. llvm_register_toolchains()
  224. # `rules_perl`
  225. #
  226. # Provides a `perl` toolchain which is required to build some libraries (e.g. openssl).
  227. RULES_PERL_VERISON = "0.1.0"
  228. RULES_PERL_INTEGRITY = "sha256-XO+tvypJvzQh7eAJ8sWiyYNquueSYg7S/5kYQTN1UyU="
  229. maybe(
  230. http_archive,
  231. name = "rules_perl",
  232. integrity = RULES_PERL_INTEGRITY,
  233. strip_prefix = "rules_perl-{0}".format(RULES_PERL_VERISON),
  234. urls = [
  235. "https://github.com/bazelbuild/rules_perl/archive/refs/tags/{0}.tar.gz".format(RULES_PERL_VERISON),
  236. ],
  237. )
  238. load("@rules_perl//perl:deps.bzl", "perl_register_toolchains", "perl_rules_dependencies")
  239. perl_rules_dependencies()
  240. perl_register_toolchains()
  241. # Extra setup.
  242. #
  243. # Some libraries (e.g. protobuf) require bespoke rule sets. Because they're
  244. # specific to a single library we move their definitions into separate files
  245. # to avoid cluter.
  246. load("//misc/bazel/c_deps:extra_setup.bzl", "protoc_setup")
  247. protoc_setup()
  248. # `rules_rust`
  249. #
  250. # Rules for building Rust crates, and several convienence macros for building all transitive
  251. # dependencies.
  252. RULES_RUST_VERSION = "0.59.3"
  253. RULES_RUST_INTEGRITY = "sha256-pPPz9Yewxoqs6ZhcQAaI8AeFCy/S/ipQTEkTbZ3syz4="
  254. maybe(
  255. http_archive,
  256. name = "rules_rust",
  257. integrity = RULES_RUST_INTEGRITY,
  258. strip_prefix = "rules_rust-mz-{0}".format(RULES_RUST_VERSION),
  259. urls = [
  260. "https://github.com/MaterializeInc/rules_rust/releases/download/mz-{0}/rules_rust-mz-{0}.tar.zst".format(RULES_RUST_VERSION),
  261. ],
  262. )
  263. load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies")
  264. rules_rust_dependencies()
  265. # `rustc`
  266. #
  267. # Fetch and register the relevant Rust toolchains. We use a custom macro that
  268. # depends on `rules_rust` but cuts down on bloat from their defaults.
  269. RUST_VERSION = "1.88.0"
  270. RUST_NIGHTLY_VERSION = "nightly/2025-06-28"
  271. load("//misc/bazel/toolchains:rust.bzl", "bindgen_toolchains", "rust_toolchains")
  272. rust_toolchains(
  273. [
  274. RUST_VERSION,
  275. RUST_NIGHTLY_VERSION,
  276. ],
  277. {
  278. "aarch64-apple-darwin": {
  279. "stable": {
  280. "cargo": "bf7cdf06cbed243f4ed0f9c852a6aa080797d1350a455282033091ec2526d7cc",
  281. "clippy": "a1ebfd7eac1dd1e879cde7d4a775689e5bd7d80c576930604c7589576d4fe2fe",
  282. "llvm-tools": "8d864504e0f4e5e37ad81840f5a353f5029128a713e2907d8c13da2f3cfba4c3",
  283. "rust-std": "00c1bb3ddb383c9aaace344332f2e523552464abf5133645a49764b3c02b0421",
  284. "rustc": "d278edbf97698d63779dfe8116c252cd957d25f284ae282a2d435a49710b6a35"
  285. },
  286. "nightly": {
  287. "cargo": "efe388459b9cb6dc2d0bf3cd75ccd6acc9dbfa61928691af3bd46d892e078ae4",
  288. "clippy": "8fc88c6421e02c2b9afb7b9ab6dfd981a5a9df189f80fd6f580ee8fbd053aa66",
  289. "llvm-tools": "c19f937183373639e0cd5f69f784a889cb3e0424943c20c90ee486b95f1e5777",
  290. "rust-std": "71745eb4d21138fa4e1fd900101423887e32f1ac8c4464c1e09068a04e668486",
  291. "rustc": "e77d89b08325f8e48b444887a63685be5cfba007aa421468cdaafc7ad11ccadf"
  292. },
  293. },
  294. "aarch64-unknown-linux-gnu": {
  295. "stable": {
  296. "cargo": "e3877f6e13076924335d4a55edfa4d0f0d26affde0208cd6e84289eeb98cd142",
  297. "clippy": "1872bb486bfd146982aa9d62aa3fe71dc9c0085eb810988e8a38a17d40015f80",
  298. "llvm-tools": "db8e48dfaf01617b1504d1993c143305034abb0823a3da0920d9e66b3f6bbdee",
  299. "rust-std": "525d0e622e8832c997c6deb9d9fbcbde73376c0c3a3a9325d7ecee17d6a781dc",
  300. "rustc": "db3ba9ea32ad6fc0073011ddeaa22fa0f54effd455c7c189bba6edc65fa3be02",
  301. },
  302. "nightly": {
  303. "cargo": "59cd66c433362868848e9006f212e9dc8cafb2c5fd18125dd0c4d578af518f0d",
  304. "clippy": "e53cf91e18431babd154fd90673120f104d86596131fe7368679f3e411f4a195",
  305. "llvm-tools": "f9c3de5cb8be8a188c8cd0fbd930587d08de53e84959e251d89d508df9517245",
  306. "rust-std": "f07461eb88cf74a30e65074ead447cf6241c2d2b517e6d7e975611af8e496205",
  307. "rustc": "0978bc7c2e30cb86bdab482adda80f1463382e8a8de9e7f8f4193411e95aeacc",
  308. },
  309. },
  310. "x86_64-apple-darwin": {
  311. "stable": {
  312. "cargo": "2fce4753d4b1db641ba8d3a6b88c8aa32c4e647025edcecaf56509ff25167e28",
  313. "clippy": "d8485a21f968ea3c8d376165245fe4c108e19bf78bb6ebbb36a19d590aaee9a5",
  314. "llvm-tools": "62b95c0193be2bc185089c2d9595ddde76fbeeb366a851688fc0701e478321ca",
  315. "rust-std": "54939bc8868d358471d6c75edbc3699b1c533b9016fb883bc40b94f5a387a39d",
  316. "rustc": "9ef9e30341e1ffba8911d7c0932820398ec40d18070140b1b5ae3b45505421b1",
  317. },
  318. "nightly": {
  319. "cargo": "a386f271be4a0e3b1ebcabd21bcd952d254742aa186d244c4147b2fa7c23db97",
  320. "clippy": "f11376ea76263c869d61b5c5167fdc4e5e22df4c05acbec5a844639131fee84f",
  321. "llvm-tools": "a4637e5fdd6ffffc578785584bfc763239a72793049a8e82169b0ced5aea5ccb",
  322. "rust-std": "82bfd882298bb7c3f3d411e6802e299819de1611c5f8911fd21fdd4e02cce8b1",
  323. "rustc": "a1e936b584003ed3349087114a259c9863f503e9086dea55924bc6f164e2d020",
  324. },
  325. },
  326. "x86_64-unknown-linux-gnu": {
  327. "stable": {
  328. "cargo": "19d17e0823d028f6724894aafb448604182e306315178862cbd9adaedbf0c4d4",
  329. "clippy": "9c1b6dc33b7cc5176b09a27f7aba3fcda6d6001001e7e9b840fbd11ad745ca5f",
  330. "llvm-tools": "f7fa5ec5d30ab7d5719721200872b40cd3a6fc662853f0fec90119737917edba",
  331. "rust-std": "3690f22a19fb1e967c5547c00212b3574a1d711f81644e910248ea09488de9d0",
  332. "rustc": "c3be3242b48b07e75608f52f3621d469e0f35d2e7091344fcfc4adcb51dda3e3",
  333. },
  334. "nightly": {
  335. "cargo": "df68f8a59aeb24ee59d8be66397ed69adb0ba1301f5246dd281a2efdeaa50521",
  336. "clippy": "0e1174d5962f50f3c27c3e3b67254c8e3e4f5496a98d49e55014f79ab38ecf29",
  337. "llvm-tools": "ac13f78c6437e7b29fc51aaa8263773f58b68e57c2656e41e96529fb0e374fca",
  338. "rust-std": "86da8256ed210aa387ad7188939450123024f62cacc2b91651a49a6c5b429a36",
  339. "rustc": "112ab1bd953f60e80cce587378596d314285113b5722da850365946c907a3523",
  340. },
  341. },
  342. },
  343. )
  344. # Rust `bindgen`
  345. #
  346. # Rules and Toolchains for running [`bindgen`](https://github.com/rust-lang/rust-bindgen)
  347. # a tool for generating Rust FFI bindings to C.
  348. maybe(
  349. http_archive,
  350. name = "rules_rust_bindgen",
  351. integrity = RULES_RUST_INTEGRITY,
  352. strip_prefix = "rules_rust-mz-{0}/extensions/bindgen".format(RULES_RUST_VERSION),
  353. urls = [
  354. "https://github.com/MaterializeInc/rules_rust/releases/download/mz-{0}/rules_rust-mz-{0}.tar.zst".format(RULES_RUST_VERSION),
  355. ],
  356. )
  357. load("@rules_rust_bindgen//:repositories.bzl", "rust_bindgen_dependencies")
  358. rust_bindgen_dependencies()
  359. bindgen_toolchains(
  360. "{0}-{1}".format(LLVM_VERSION, LLVM_VERSION_SUFFIX),
  361. {
  362. "darwin_aarch64": "sha256-QxhHE2vvRcbe1ppF9ZonKWa4Y6AwnP8cVsCO0xLkZvU=",
  363. "darwin_x86_64": "sha256-PcZ4VlQ8vxZP3mffLXj3vxh7VImDfIUvFdqR9z+uFNc=",
  364. "linux_aarch64": "sha256-W8GBaB49peXQunPziisAWm8K6xLF/WcOijOHXlHe6Bk=",
  365. "linux_x86_64": "sha256-8TXbBywRoUcZ/Aulm2Ps+FOU2RBKWA32AQDKCPoOyUw=",
  366. },
  367. )
  368. # Load all dependencies for crate_universe.
  369. load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")
  370. crate_universe_dependencies()
  371. load("@rules_rust//crate_universe:defs.bzl", "crate", "crates_repository")
  372. crates_repository(
  373. name = "crates_io",
  374. annotations = {
  375. # `crates_repository` fails to automatically add the depenency on `tracing` when
  376. # `tokio_unstable` is enabled, so we manually specify it.
  377. "tokio": [
  378. crate.annotation(
  379. rustc_flags = ["--cfg=tokio_unstable"],
  380. deps = ["@crates_io//:tracing"],
  381. ),
  382. ],
  383. "decnumber-sys": [crate.annotation(
  384. additive_build_file = "@//misc/bazel/c_deps:rust-sys/BUILD.decnumber.bazel",
  385. gen_build_script = False,
  386. # Note: This is a target we add from the additive build file above.
  387. deps = [":decnumber"],
  388. )],
  389. "librocksdb-sys": [crate.annotation(
  390. # Note: The below targets are from the additive build file.
  391. additive_build_file = "@//misc/bazel/c_deps:rust-sys/BUILD.rocksdb.bazel",
  392. compile_data = [":out_dir"],
  393. compile_data_glob_excludes = ["rocksdb/**"],
  394. gen_build_script = False,
  395. rustc_env = {
  396. "OUT_DIR": "$(execpath :out_dir)",
  397. },
  398. deps = [
  399. ":bindings",
  400. ":rocksdb",
  401. ],
  402. )],
  403. "tikv-jemalloc-sys": [crate.annotation(
  404. gen_build_script = False,
  405. deps = ["@jemalloc"],
  406. )],
  407. "rdkafka-sys": [crate.annotation(
  408. additive_build_file = "@//misc/bazel/c_deps:rust-sys/BUILD.librdkafka.bazel",
  409. gen_build_script = False,
  410. # Note: This is a target we add from the additive build file above.
  411. deps = [":librdkafka"],
  412. )],
  413. "libz-sys": [crate.annotation(
  414. additive_build_file = "@//misc/bazel/c_deps:rust-sys/BUILD.libz.bazel",
  415. gen_build_script = False,
  416. # Note: This is a target we add from the additive build file above.
  417. deps = [":zlib"],
  418. )],
  419. # TODO(parkmycar): Refactor this to build the version of zlib from the `bzip2-sys` crate.
  420. "bzip2-sys": [crate.annotation(
  421. gen_build_script = False,
  422. deps = ["@bzip2"],
  423. )],
  424. "lzma-sys": [crate.annotation(
  425. additive_build_file = "@//misc/bazel/c_deps:rust-sys/BUILD.lzma-sys.bazel",
  426. gen_build_script = False,
  427. # Note: This is a target we add from the additive build file above.
  428. deps = [":xz"],
  429. )],
  430. "openssl-sys": [crate.annotation(
  431. build_script_data = [
  432. "@openssl//:openssl_lib",
  433. "@openssl//:openssl_include",
  434. ],
  435. build_script_data_glob = ["build/**/*.c"],
  436. build_script_env = {
  437. "OPENSSL_STATIC": "true",
  438. "OPENSSL_NO_VENDOR": "1",
  439. "OPENSSL_LIB_DIR": "$(execpath @openssl//:openssl_lib)",
  440. "OPENSSL_INCLUDE_DIR": "$(execpath @openssl//:openssl_include)",
  441. },
  442. compile_data = ["@openssl//:openssl_lib"],
  443. )],
  444. "protobuf-src": [crate.annotation(
  445. # Note: We shouldn't ever depend on protobuf-src, but if we do, don't try to bootstrap
  446. # `protoc`.
  447. gen_build_script = False,
  448. rustc_env = {"INSTALL_DIR": "fake"},
  449. )],
  450. "protobuf-native": [crate.annotation(
  451. additive_build_file = "@//misc/bazel/c_deps:rust-sys/BUILD.protobuf-native.bazel",
  452. gen_build_script = False,
  453. deps = [":protobuf-native-bridge"],
  454. )],
  455. "psm": [crate.annotation(
  456. additive_build_file = "@//misc/bazel/c_deps:rust-sys/BUILD.psm.bazel",
  457. gen_build_script = False,
  458. # Note: All of the targets we build for support switching stacks, if we ever want to
  459. # support Windows we'll have to revist this.
  460. rustc_flags = [
  461. "--check-cfg=cfg(switchable_stack,asm,link_asm)",
  462. "--cfg=asm",
  463. "--cfg=link_asm",
  464. "--cfg=switchable_stack",
  465. ],
  466. # Note: This is a target we add from the additive build file above.
  467. deps = ["psm_s"],
  468. )],
  469. "launchdarkly-server-sdk": [crate.annotation(
  470. build_script_env = {
  471. "CARGO_PKG_AUTHORS": "LaunchDarkly",
  472. "CARGO_PKG_DESCRIPTION": "",
  473. "CARGO_PKG_HOMEPAGE": "https://docs.launchdarkly.com/sdk/server-side/rust",
  474. "CARGO_PKG_LICENSE": "Apache-2.0",
  475. "CARGO_PKG_REPOSITORY": "https://github.com/launchdarkly/rust-server-sdk",
  476. "RUSTDOC": "",
  477. },
  478. )],
  479. # Compile the backtrace crate and its dependencies with all optimizations, even in dev
  480. # builds, since otherwise backtraces can take 20s+ to symbolize. With optimizations
  481. # enabled, symbolizing a backtrace takes less than 1s.
  482. "addr2line": [crate.annotation(rustc_flags = ["-Copt-level=3"])],
  483. "adler2": [crate.annotation(rustc_flags = ["-Copt-level=3"])],
  484. "backtrace": [crate.annotation(rustc_flags = ["-Copt-level=3"])],
  485. "gimli": [crate.annotation(rustc_flags = ["-Copt-level=3"])],
  486. "miniz_oxide": [crate.annotation(rustc_flags = ["-Copt-level=3"])],
  487. "object": [crate.annotation(rustc_flags = ["-Copt-level=3"])],
  488. "rustc-demangle": [crate.annotation(rustc_flags = ["-Copt-level=3"])],
  489. "timely": [crate.annotation(rustc_flags = ["-Copt-level=3"])],
  490. "differential-dataflow": [crate.annotation(rustc_flags = ["-Copt-level=3"])],
  491. "insta": [crate.annotation(rustc_flags = ["-Copt-level=3"])],
  492. "similar": [crate.annotation(rustc_flags = ["-Copt-level=3"])],
  493. },
  494. cargo_config = "//:.cargo/config.toml",
  495. cargo_lockfile = "//:Cargo.lock",
  496. generator_sha256s = {
  497. "aarch64-apple-darwin": "c38c9c0efc11fcf9c32b9e0f4f4849df7c823f207c7f5ba5f6ab1e0e2167693d",
  498. "aarch64-unknown-linux-gnu": "5bdc9a10ec5f17f5140a81ce7cb0c0ce6e82d4d862d3ce3a301ea23f72f20630",
  499. "x86_64-unknown-linux-gnu": "abcd8212d64ea4c0f5e856af663c05ebeb2800a02c251f6eb62061f4e8ca1735",
  500. },
  501. generator_urls = {
  502. "aarch64-apple-darwin": "https://github.com/MaterializeInc/rules_rust/releases/download/mz-{0}/cargo-bazel-aarch64-apple-darwin".format(RULES_RUST_VERSION),
  503. "aarch64-unknown-linux-gnu": "https://github.com/MaterializeInc/rules_rust/releases/download/mz-{0}/cargo-bazel-aarch64-unknown-linux-gnu".format(RULES_RUST_VERSION),
  504. "x86_64-unknown-linux-gnu": "https://github.com/MaterializeInc/rules_rust/releases/download/mz-{0}/cargo-bazel-x86_64-unknown-linux-gnu".format(RULES_RUST_VERSION),
  505. },
  506. # When `isolated` is true, Bazel will create a new `$CARGO_HOME`, i.e. it
  507. # won't use `~/.cargo`, when re-pinning. This is nice but not totally
  508. # necessary, and it makes re-pinning painfully slow, so we disable it.
  509. isolated = False,
  510. manifests = [
  511. "//:Cargo.toml",
  512. "//:src/adapter-types/Cargo.toml",
  513. "//:src/adapter/Cargo.toml",
  514. "//:src/alloc-default/Cargo.toml",
  515. "//:src/alloc/Cargo.toml",
  516. "//:src/arrow-util/Cargo.toml",
  517. "//:src/audit-log/Cargo.toml",
  518. "//:src/auth/Cargo.toml",
  519. "//:src/authenticator/Cargo.toml",
  520. "//:src/avro/Cargo.toml",
  521. "//:src/aws-secrets-controller/Cargo.toml",
  522. "//:src/aws-util/Cargo.toml",
  523. "//:src/balancerd/Cargo.toml",
  524. "//:src/build-info/Cargo.toml",
  525. "//:src/build-tools/Cargo.toml",
  526. "//:src/catalog-debug/Cargo.toml",
  527. "//:src/catalog-protos/Cargo.toml",
  528. "//:src/catalog/Cargo.toml",
  529. "//:src/ccsr/Cargo.toml",
  530. "//:src/cloud-api/Cargo.toml",
  531. "//:src/cloud-provider/Cargo.toml",
  532. "//:src/cloud-resources/Cargo.toml",
  533. "//:src/cluster-client/Cargo.toml",
  534. "//:src/cluster/Cargo.toml",
  535. "//:src/clusterd/Cargo.toml",
  536. "//:src/compute-client/Cargo.toml",
  537. "//:src/compute-types/Cargo.toml",
  538. "//:src/compute/Cargo.toml",
  539. "//:src/controller-types/Cargo.toml",
  540. "//:src/controller/Cargo.toml",
  541. "//:src/durable-cache/Cargo.toml",
  542. "//:src/dyncfg/Cargo.toml",
  543. "//:src/dyncfg-file/Cargo.toml",
  544. "//:src/dyncfg-launchdarkly/Cargo.toml",
  545. "//:src/dyncfgs/Cargo.toml",
  546. "//:src/environmentd/Cargo.toml",
  547. "//:src/expr-derive/Cargo.toml",
  548. "//:src/expr-derive-impl/Cargo.toml",
  549. "//:src/expr-parser/Cargo.toml",
  550. "//:src/expr-test-util/Cargo.toml",
  551. "//:src/expr/Cargo.toml",
  552. "//:src/fivetran-destination/Cargo.toml",
  553. "//:src/frontegg-auth/Cargo.toml",
  554. "//:src/frontegg-client/Cargo.toml",
  555. "//:src/frontegg-mock/Cargo.toml",
  556. "//:src/http-util/Cargo.toml",
  557. "//:src/interchange/Cargo.toml",
  558. "//:src/kafka-util/Cargo.toml",
  559. "//:src/license-keys/Cargo.toml",
  560. "//:src/lowertest-derive/Cargo.toml",
  561. "//:src/lowertest/Cargo.toml",
  562. "//:src/lsp-server/Cargo.toml",
  563. "//:src/materialized/Cargo.toml",
  564. "//:src/metabase/Cargo.toml",
  565. "//:src/metrics/Cargo.toml",
  566. "//:src/mysql-util/Cargo.toml",
  567. "//:src/mz/Cargo.toml",
  568. "//:src/mz-debug/Cargo.toml",
  569. "//:src/npm/Cargo.toml",
  570. "//:src/orchestrator-kubernetes/Cargo.toml",
  571. "//:src/orchestrator-process/Cargo.toml",
  572. "//:src/orchestrator-tracing/Cargo.toml",
  573. "//:src/orchestratord/Cargo.toml",
  574. "//:src/orchestrator/Cargo.toml",
  575. "//:src/ore-build/Cargo.toml",
  576. "//:src/ore-proc/Cargo.toml",
  577. "//:src/ore/Cargo.toml",
  578. "//:src/persist-cli/Cargo.toml",
  579. "//:src/persist-client/Cargo.toml",
  580. "//:src/persist-proc/Cargo.toml",
  581. "//:src/persist-types/Cargo.toml",
  582. "//:src/persist/Cargo.toml",
  583. "//:src/pgcopy/Cargo.toml",
  584. "//:src/pgrepr-consts/Cargo.toml",
  585. "//:src/pgrepr/Cargo.toml",
  586. "//:src/pgtest/Cargo.toml",
  587. "//:src/pgtz/Cargo.toml",
  588. "//:src/pgwire-common/Cargo.toml",
  589. "//:src/pgwire/Cargo.toml",
  590. "//:src/postgres-client/Cargo.toml",
  591. "//:src/postgres-util/Cargo.toml",
  592. "//:src/prof-http/Cargo.toml",
  593. "//:src/prof/Cargo.toml",
  594. "//:src/proto/Cargo.toml",
  595. "//:src/regexp/Cargo.toml",
  596. "//:src/repr-test-util/Cargo.toml",
  597. "//:src/repr/Cargo.toml",
  598. "//:src/rocksdb-types/Cargo.toml",
  599. "//:src/rocksdb/Cargo.toml",
  600. "//:src/s3-datagen/Cargo.toml",
  601. "//:src/secrets/Cargo.toml",
  602. "//:src/segment/Cargo.toml",
  603. "//:src/server-core/Cargo.toml",
  604. "//:src/service/Cargo.toml",
  605. "//:src/sql-lexer/Cargo.toml",
  606. "//:src/sql-parser/Cargo.toml",
  607. "//:src/sql-pretty/Cargo.toml",
  608. "//:src/sql-server-util/Cargo.toml",
  609. "//:src/sql/Cargo.toml",
  610. "//:src/sqllogictest/Cargo.toml",
  611. "//:src/ssh-util/Cargo.toml",
  612. "//:src/storage-client/Cargo.toml",
  613. "//:src/storage-controller/Cargo.toml",
  614. "//:src/storage-operators/Cargo.toml",
  615. "//:src/storage-types/Cargo.toml",
  616. "//:src/storage/Cargo.toml",
  617. "//:src/testdrive/Cargo.toml",
  618. "//:src/timely-util/Cargo.toml",
  619. "//:src/timestamp-oracle/Cargo.toml",
  620. "//:src/tls-util/Cargo.toml",
  621. "//:src/tracing/Cargo.toml",
  622. "//:src/transform/Cargo.toml",
  623. "//:src/txn-wal/Cargo.toml",
  624. "//:src/walkabout/Cargo.toml",
  625. "//:src/workspace-hack/Cargo.toml",
  626. "//:test/metabase/smoketest/Cargo.toml",
  627. "//:test/test-util/Cargo.toml",
  628. "//:misc/bazel/cargo-gazelle/Cargo.toml",
  629. ],
  630. rust_version = RUST_VERSION,
  631. # Restricting the set of platform triples we support _greatly_ reduces the
  632. # time it takes to "Splice Cargo Workspace" because it reduces the amount
  633. # of metadata that needs to be collected.
  634. #
  635. # Feel free to add more targets if need be but try to keep this list small.
  636. supported_platform_triples = [
  637. "aarch64-unknown-linux-gnu",
  638. "x86_64-unknown-linux-gnu",
  639. "aarch64-apple-darwin",
  640. "x86_64-apple-darwin",
  641. "wasm32-unknown-unknown",
  642. ],
  643. # Only used if developing rules_rust.
  644. # generator = "@cargo_bazel_bootstrap//:cargo-bazel",
  645. )
  646. load("@crates_io//:defs.bzl", "crate_repositories")
  647. crate_repositories()
  648. crate_universe_dependencies()
  649. load("@rules_rust//cargo:deps.bzl", "cargo_dependencies")
  650. cargo_dependencies()
  651. # Third-Party Rust Tools
  652. #
  653. # A few crates bind to an external C/C++ library using `cxx`. To build these
  654. # with Bazel we need to include the `cxx` command line binary.
  655. load("//misc/bazel/rust_deps:repositories.bzl", "rust_repositories")
  656. rust_repositories()
  657. # Load and include any dependencies the third-party Rust binaries require.
  658. #
  659. # Ideally we would call `load(...)` from `rust_repositories()`, but load
  660. # statements can only be called from the top-level WORKSPACE, so we must do it
  661. # here.
  662. #
  663. # TODO(parkmycar): This should get better when we switch to bzlmod.
  664. load("@cxxbridge//:defs.bzl", cxxbridge_cmd_deps = "crate_repositories")
  665. cxxbridge_cmd_deps()
  666. # git Submodules
  667. #
  668. # We include any git Submodules as local Bazel repositories so we can access
  669. # their contents or build them.
  670. new_local_repository(
  671. name = "fivetran_sdk",
  672. build_file = "//misc/bazel:git_submodules/BUILD.fivetran_sdk.bazel",
  673. path = "misc/fivetran-sdk",
  674. )
  675. # tools
  676. #
  677. # Extra non-critical tools (e.g. linters or formatters) that are used as part of the development
  678. # cycle.
  679. load("//misc/bazel/tools:repositories.bzl", "tools_repositories")
  680. tools_repositories()