by dijit · 5y ago · 0 comments
It seems like cargo does a lot of heavy lifting w.r.t. dependencies which Bazel does not like. Do you have to vendor your dependencies- and your dependencies dependencies. Ad infinitum.
There is cargo-raze which helps, but only if you’re making a rust library: not if you’re making a binary.
So maybe it works for this case.
I'm really hoping bzlmod helps in this case: https://www.youtube.com/watch?v=TxOCKtU39Fs
The story for external deps is indeed extremely painful right now.
Cargo raze should let you consume libraries you've imported in a rust_binary target, if that's what you're talking about. It's also possible, but slightly more annoying, to vendor the dependency tree if you need to rely on pulling from a local mirror.
I've also used it to import cargo binaries (i.e wasm-bindgen-cli) into a Bazel workspace -- it just makes the resulting target something like @raze_some_bin//:bin