feat: add an attr to rust_binary for customization of the binary name (#2970)

It's often desirable to set the name of the resulting binary to
something else other than the target name (`attr.name`), perhaps when
the `rust_binary` target is wrapped in a macro, and not considered the
"main" target of that macro.

This diff adds a new `binary_name` attribute to `rust_binary`, which
when set will be used as the resulting binaries prefix instead of the
targets name. The default is to still use the target name.
5 files changed
tree: 141ff181d223c019a8c08bb6d316d0c0ba63ca67
  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. .bazelversion
  20. .clang-format
  21. .clippy.toml
  22. .envrc
  23. .gitattributes
  24. .gitignore
  25. .prettierrc.toml
  26. .rustfmt.toml
  27. ARCHITECTURE.md
  28. AUTHORS
  29. BUILD.bazel
  30. buildifier
  31. CODEOWNERS
  32. COMPATIBILITY.md
  33. CONTRIBUTING.md
  34. CONTRIBUTORS
  35. LICENSE.txt
  36. MODULE.bazel
  37. README.md
  38. version.bzl
  39. 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.