bazelbuild / bazelbuild/rules_rust
Crates Universe: Do I need to replicate intra-workspace `Cargo.toml` dependencies in `BUILD.bazel` files?
- Dominant language
- Starlark
- Stars
- 843
- Forks
- 651
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 15
Description
My team has a large Cargo workspace with numerous inter-dependent Cargo subpackages. We primarily use pure Cargo to develop/build code, so `Cargo.toml` files are the source of truth for capturing dependencies, but we'd also like to have the option to build with Bazel, e.g. for Python-Rust bindings (since we use Bazel to run Python code). We'd rather not duplicate all the subpackage intra-workspace dependency info already captured in `Cargo.toml` files into `BUILD.bazel` files, but I can't figure out how to avoid this...? E.g. the `Cargo.Bazel.lock` file appears to only capture external dependency info, and doesn't pick up intra-workspace dependencies, meaning `all_crate_deps()` only returns labels for external dependency targets -- is this expected?
Overall I'm wondering: Is there some way to make `Cargo.toml` files the source of truth for everything, without making/manually populating a duplicative `BUILD.bazel` for every workspace package? Sorry if I'm woefully misunderstanding how the Crates Universe rules work!
Contributor guide
Assessment
This issue has not been assessed yet.