crate_universe: keep the bootstrap's build cache across rebuilds (#4453) This change gives `@cargo_bazel_bootstrap` a build cache. `cargo-bazel` is built from source with Cargo whenever this rules_rust has no prebuilt binary, and the repository was rebuilt from nothing each time one of its inputs changed, a repin of `crate_universe/Cargo.lock` included, which took half a minute per rebuild. Cargo's target directory now lives in `@cargo_bazel_bootstrap_cache`, a repository with no inputs that Bazel never refetches, so a rebuild recompiles what changed: a touched source file rebuilds in under a second. The cache is private to `crate_universe`; `cargo_bootstrap_repository` gains a `cache` attribute to name it. The bootstrap also prints a notice when it runs, since building the generator from source is only expected of rules_rust itself: releases ship a binary, and `CARGO_BAZEL_GENERATOR_URL` names one to use instead.
This repository provides rules for building Rust projects with Bazel.
The fastest way to try this in an empty project is to click the green “Use this template” button on https://github.com/bazel-starters/rust.
General discussions and announcements take place in the GitHub Discussions, but there are additional places where community members gather to discuss rules_rust.
Please refer to the full documentation.