@@ -249,6 +249,21 @@ crate_universe_dependencies()
249249
250250load ("@rules_rust//crate_universe:defs.bzl" , "crates_repository" )
251251
252+ # If we don't specify which platforms to build, rust_*_library targets will
253+ # select() across platforms that are not guaranteed to exist in the local Bazel,
254+ # which breaks the build.
255+ #
256+ # This is probably a Bazel bug, because rules_rust
257+ # specifies the correct module dependency and Bazel just ignores it and fetches
258+ # an old version.
259+ #
260+ # TODO(the80srobot): Find the right Bazel subproject and file a bug.
261+ RUST_SUPPORTED_PLATFORM_TRIPLES = [
262+ "i686-apple-darwin" ,
263+ "x86_64-apple-darwin" ,
264+ "aarch64-apple-darwin" ,
265+ ]
266+
252267crates_repository (
253268 name = "crate_index" ,
254269 cargo_lockfile = "//:Cargo.lock" ,
@@ -259,15 +274,32 @@ crates_repository(
259274 # the root Cargo file.
260275 "//:Source/santad/Logs/EndpointSecurity/ParquetLogger/Cargo.toml" ,
261276 ],
262- # Removing this causes rust_*_library targets to select across platforms that
263- # might not be defined, breaking the build.
264- supported_platform_triples = [
265- "i686-apple-darwin" ,
266- "x86_64-apple-darwin" ,
267- "aarch64-apple-darwin" ,
268- ],
277+ supported_platform_triples = RUST_SUPPORTED_PLATFORM_TRIPLES ,
269278)
270279
271280load ("@crate_index//:defs.bzl" , "crate_repositories" )
272281
273282crate_repositories ()
283+
284+ # cxxbridge is a codegen tool for Rust/C++ bindings. To understand why this is
285+ # set up the way it is, read
286+ # http://bazelbuild.github.io/rules_rust/crate_universe.html#binary-dependencies.
287+ http_archive (
288+ name = "cxxbridge-cmd" ,
289+ build_file = "//external_patches/cxxbridge-cmd:BUILD" ,
290+ sha256 = "dc5db43c367778010dff55b602f71eccff712b8edf54a3f08687bd1c7cbad6df" ,
291+ strip_prefix = "cxxbridge-cmd-1.0.110" ,
292+ type = "tar.gz" ,
293+ urls = ["https://crates.io/api/v1/crates/cxxbridge-cmd/1.0.110/download" ],
294+ )
295+
296+ # See above for notes.
297+ crates_repository (
298+ name = "cxxbridge_cmd_deps" ,
299+ cargo_lockfile = "//external_patches/cxxbridge-cmd:Cargo.lock" ,
300+ lockfile = "//external_patches/cxxbridge-cmd:Cargo.Bazel.lock" ,
301+ manifests = ["@cxxbridge-cmd//:Cargo.toml" ],
302+ supported_platform_triples = RUST_SUPPORTED_PLATFORM_TRIPLES ,
303+ )
304+ load ("@cxxbridge_cmd_deps//:defs.bzl" , cxxbridge_cmd_deps = "crate_repositories" )
305+ cxxbridge_cmd_deps ()
0 commit comments