Fix cargo-bazel recompile for MODULE.bazel (#2570)

- Addresses https://github.com/bazelbuild/rules_rust/issues/2531
- Wrote a function, thats basically copy / pasted from
`crates_universe/private/generate_utils.bzl` to account for the
`module_ctx` Can probably make the original function more generic if
thats more desired. I'm not sure if the maintainers would prefer a one
off, since the `MODULE.bazel `feature set for `crates_universe` isn't
exactly "Stable" yet.
- Noticed theres no way to "bootstrap" the new `cargo` features in
`MODULE.bazel` , like you can for `crates_universe`. May need to open an
issue for this. Tested by using the `CARGO_BAZEL_GENERATOR_URL` and
`CARGO_BAZEL_GENERATOR_SHA256` environmentals. This looks to cause some
failing unit tests. Not sure how to get support on this
- Failsafe of using the cargo buildstrap `cargo-bazel` if no URLs are
found, and if theres no environmentals.

---------

Co-authored-by: UebelAndre <github@uebelandre.com>
2 files changed
tree: 76a6a8703d1a1721442e989538f1bf2e9f6f00fe
  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. .envrc
  21. .gitattributes
  22. .gitignore
  23. .prettierrc.toml
  24. .rustfmt.toml
  25. ARCHITECTURE.md
  26. AUTHORS
  27. BUILD.bazel
  28. CODEOWNERS
  29. COMPATIBILITY.md
  30. CONTRIBUTING.md
  31. CONTRIBUTORS
  32. LICENSE.txt
  33. MODULE.bazel
  34. README.md
  35. version.bzl
  36. 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.