1# Developing crate_universe 2 3## Bootstrapping 4 5Crate Universe repository rules are backed by a binary called `cargo-bazel`. 6This can be built using cargo by simply changing directories to 7`@rules_rust//crate_universe` and running the following: 8 9```shell 10cargo build --bin=cargo-bazel 11``` 12 13It's then recommended to export the `CARGO_BAZEL_GENERATOR_URL` environment 14variable to be a `file://` url to the built binary on disk. 15 16```shell 17export CARGO_BAZEL_GENERATOR_URL=file://$(pwd)/target/debug/cargo-bazel 18``` 19 20From here on, the repository rule can be run 21 22## Using non-release rules_rust 23 24If a project does not get `rules_rust` from a release artifact from the Github 25releases page (e.g. using an archive from a commit or branch) then `cargo-bazel` 26binaries will have to manually be specified for repository rules that consume it. 27It's highly recommended to build `cargo-bazel` binaries yourself and host them 28somewhere the project can safely access them. Without this, repository rules will 29attempt to build the binary using [cargo_bootstrap_repository][cbr] as a fallback. 30This is very time consuming and in no way the recommended workflow for anything 31other than developing `rules_rust` directly. 32 33[cbr]: https://bazelbuild.github.io/rules_rust/cargo.html#cargo_bootstrap_repository 34 35## Updating vendored crates 36 37A lot of crates are vendored into this repo, e.g. in examples and tests. To 38re-vendor them all, a bash script is provided: 39 40```sh 41bazel run //crate_universe/tools:vendor 42``` 43