Speedup manifest splicing by removing workspace discovery logic (#3570)

The original implementation required users to specify all manifests
belonging to the workspace, and had a validation pass that walked the
repo to verify the list was in sync. This PR swaps that for a `cargo
metadata` call, which lists the manifests making up the workspace. We
can then call `ctx.watch` on them to invalidate the extension when they
are modified (which was previously impossible if they were not passed to
the extension as labels). This also means users only need to specify the
workspace-root Cargo.toml now :)

There is still an edge-case where a newly-added Cargo.toml won't trigger
invalidation if it's covered by one of the wildcard `members` patterns,
but that was already a pre-existing issue. In practice, we'd expect
invalidation in that case to be triggered by a Cargo.lock change, or to
be unnecessary if the crate does not add new deps to crate resolution.

Fixes https://github.com/bazelbuild/rules_rust/issues/3425
Fixes https://github.com/bazelbuild/rules_rust/issues/3515
Fixes https://github.com/bazelbuild/rules_rust/issues/3518

Obsoletes https://github.com/bazelbuild/rules_rust/pull/3387

Co-authored-by: Daniel Wagner-Hall <dawagner@gmail.com>
9 files changed
tree: 324561118e4f18ca0d957a77e81cb6872b36cbea
  1. .bazelci/
  2. .bcr/
  3. .github/
  4. cargo/
  5. crate_universe/
  6. docs/
  7. examples/
  8. extensions/
  9. ffi/
  10. nix/
  11. rust/
  12. test/
  13. tools/
  14. util/
  15. .bazelignore
  16. .bazelrc
  17. .clang-format
  18. .clippy.toml
  19. .envrc
  20. .gitattributes
  21. .gitignore
  22. .pre-commit-config.yaml
  23. .prettierrc.toml
  24. .rustfmt.toml
  25. .typos.toml
  26. ARCHITECTURE.md
  27. AUTHORS
  28. BUILD.bazel
  29. CODEOWNERS
  30. COMPATIBILITY.md
  31. CONTRIBUTING.md
  32. CONTRIBUTORS
  33. LICENSE.txt
  34. MODULE.bazel
  35. README.md
  36. version.bzl
  37. WORKSPACE.bazel
  38. WORKSPACE.bzlmod
README.md

Rust Rules

  • Postsubmit Build status

Overview

This repository provides rules for building Rust projects with Bazel.

Community

General discussions and announcements take place in the GitHub Discussions, but there are additional places where community members gather to discuss rules_rust.

Documentation

Please refer to the full documentation.