bazelbuild / bazelbuild/rules_rust
How to properly do one dependency with two sets of features?
- Dominant language
- Starlark
- Stars
- 843
- Forks
- 651
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 15
Description
We have a library, which has feature A.
One crate that depends on it does not need feature A, and so it is not enabled.
A second crate does need the feature on the library, and so it is enabled.
Our current solution in Bazel is:
- Define the bazel `rust_library` target twice, one has the feature enabled and one doesn't, naming the one that does `my_crate_feature`
- On the first crate, we add `//path/to/my_crate` to `deps`
- On the second crate, we add `//path/to/my_crate:my_crate_feature` to `deps`
- And also add `{ "//path/to/my_crate:my_crate_feature" : "my_crate" }` to `aliases`.
This works, but I have an inkling feeling that we are doing it wrong.
Is this the correct way? How else could we tackle this scenario?
Thanks for any advice,
Contributor guide
Assessment
This issue has not been assessed yet.