bindgen: don't `register_toolchains` in Bzlmod (#3231)

I'm currently in the process of getting rules_ros2 onto Bzlmod. One
challenge is that its rust support requires rules_rust_bindgen, which
depends on llvm-project, which takes more than GitHub Action's maximum
configurable job timeout (10h) to build. See
https://github.com/mvukov/rules_ros2/pull/238#discussion_r1929687153

This PR adds new "bring your own clang" build flags:
`--@rules_rust_bindgen//:clang` and `--@rules_rust_bindgen//:libclang`.
As the added test shows, you can point these at toolchains_llvm's
pre-compiled clang.

The fancy !!set and << merge key yaml magic is documented in
https://github.com/bazelbuild/continuous-integration/tree/master?tab=readme-ov-file#sharing-configuration-between-tasks

Let me know what you think about this. I'm also curious what's the
rationale for depending on llvm-project instead of toolchains_llvm in
the first place. Maybe instead of making this configurable (and thus
adding complexity) rules_rust_bindgen could just be switched over to
toolchains_llvm completely?

---------

Co-authored-by: UebelAndre <github@uebelandre.com>
11 files changed
tree: 01e0894d1f58fcbe28b2f046a3c4499691c61891
  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. .bazelversion
  18. .clang-format
  19. .clippy.toml
  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
  37. 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.