commit | 0e4be00d1e2fb6a7fa18e283066bb463545c18d2 | [log] [tgz] |
---|---|---|
author | James Leitch <jleitch@consumingchaos.com> | Wed Dec 13 09:39:11 2023 -0800 |
committer | GitHub <noreply@github.com> | Wed Dec 13 17:39:11 2023 +0000 |
tree | 8713e83951f81c9ff1d3c9b1d8dd2d641dfe3eb0 | |
parent | c3581a5752ba60aca5ee4f057991210b789f13e0 [diff] |
Platform transition added to Rust binary rules. (#2310) Without much insight into core Bazel's plans for supporting "flagless" builds across platforms, this seems like the most direct way to select the platform for a given Rust binary target (all the terminal rules) that doesn't need additional work to forward providers. Currently I'm using `platform_transition_binary` (https://github.com/aspect-build/bazel-lib/blob/main/docs/transitions.md), but it doesn't work with Rust Analyzer/Clippy/etc. presumably due to not forwarding the providers. In the case of this particular rule, it also doesn't work for something like `rust_shared_library()` which is explicitly not an `executable = True` target. @illicitonion brought to my attention `with_cfg` (https://github.com/fmeum/with_cfg.bzl) which could be used as an alternative by consumers of `rules_rust` instead of this PR. That feels reasonable, though certainly more work for individual users and appears to rely on a lot of Bazel black magic. Along the same lines, this could wait on rule inheritance as presumably a more formally supported `with_cfg` approach, which would also be up to individual users and not `rules_rust`.
This repository provides rules for building Rust projects with Bazel.
General discussions and announcements take place in the GitHub Discussions, but there are additional places where community members gather to discuss rules_rust
.
Please refer to the full documentation.