construct_arguments: Always use correct attributes in an aspect context. (#668)

`construct_arguments` was already using the `rule_attrs` helper function
in some places to access `ctx.rule.attr` instead of `ctx.attr`, but it
wasn't doing this consistently.

I've chosen to eliminate the boolean `aspect` parameter of
`construct_arguments` and pass in the correct attributes directly
instead. This also eliminates the need for the `rule_attrs` helper
function. Since this function was only being used here, I have
eliminated it entirely.

Finally, I have changed `_get_rustc_env` to take only the attributes
instead of the entire context.

All tests continue to pass. I haven't added any tests that would break
without this change, but in an upcoming PR, I will change
`_get_rustc_env` to respect the `crate_name` attribute, and this would
break without the changes in this PR.
3 files changed
tree: 50661d300ee69913c1a72ba9ca77cd8a5866f4ed
  1. .bazelci/
  2. bindgen/
  3. cargo/
  4. crate_universe/
  5. docs/
  6. examples/
  7. proto/
  8. rust/
  9. test/
  10. tools/
  11. util/
  12. wasm_bindgen/
  13. .bazelignore
  14. .gitignore
  15. ARCHITECTURE.md
  16. AUTHORS
  17. BUILD.bazel
  18. CODEOWNERS
  19. CONTRIBUTING.md
  20. CONTRIBUTORS
  21. LICENSE.txt
  22. README.md
  23. WORKSPACE.bazel
  24. workspace.bzl
README.md

Rust Rules

  • Postsubmit Build status
  • Postsubmit + Current Bazel Incompatible Flags Build status

Overview

This repository provides rules for building Rust projects with Bazel.

Community

Please refer to the full documentation.