Make crate module extension os and arch dependent (#2939)

This PR is follow up to #2453 and marks the `crate` extension as
`os_dependent` and `arch_dependent`.

For `crate.from_cargo`, the extension specifies reproducibility via the
`reproducible` attribute of `extension_metadata` which makes Bazel skip
the extension when writing the lockfile.

But in the case of `crate.from_specs`, the current implementation marks
the extension as non reproducible since the crates will not be backed by
a lockfile.
And because the `crate` module extension depends on `rust_host_tools`
(which are os / arch dependent), the entry in the lockfile for the
module extension includes the checksum of the `rustc` and `cargo`
binaries for whatever host it was resolved for.

This makes the bazel lock file platform dependent in that case.

This PR will result in a new os/arch specific entry in the lockfile for
users of `crate.from_specs`.
And will have no impact for users of `crate.from_cargo`.

Thanks to @fmeum for the guidance.
1 file changed
tree: 9ac2c655e35edd82f69b91715a8ab23f78577c84
  1. .bazelci/
  2. .bcr/
  3. .github/
  4. bindgen/
  5. cargo/
  6. crate_universe/
  7. docs/
  8. examples/
  9. ffi/
  10. nix/
  11. proto/
  12. rust/
  13. test/
  14. tools/
  15. util/
  16. wasm_bindgen/
  17. .bazelignore
  18. .bazelrc
  19. .clang-format
  20. .clippy.toml
  21. .envrc
  22. .gitattributes
  23. .gitignore
  24. .prettierrc.toml
  25. .rustfmt.toml
  26. ARCHITECTURE.md
  27. AUTHORS
  28. BUILD.bazel
  29. buildifier
  30. CODEOWNERS
  31. COMPATIBILITY.md
  32. CONTRIBUTING.md
  33. CONTRIBUTORS
  34. LICENSE.txt
  35. MODULE.bazel
  36. README.md
  37. version.bzl
  38. WORKSPACE.bazel
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.