mirror of https://github.com/bazelbuild/rules_rust
a6b0a7f398
* Add rust_crate_group rule for grouping dependencies together. This PR introduces a rule `rust_crate_group` which groups together multiple dependencies, but does not itself have any sources or provide a crate. In other words, it is an alias for a set of other rust_library targets. For example, the following two build files are equivalent: No `rust_crate_group`: ```py rust_library( name = "foobar", deps = [ ":crate1", ":crate2", ], ... ) ``` With `rust_crate_group`: ```py rust_crate_group( name = "crate_group", deps = [ ":crate1", ":crate2", ], ) rust_library( name = "foobar", deps = [":crate_group"], ... ) ``` In some situations, especially when heavy macros are involved, this is the only to achieve certain things. We have a number of use cases where this is necessary, but they are complicated. I can try to come up with a simple one if you are interested in more motivation. It is possible to create an "alias group" with the C++ and Python rules by just having a `cc_library` or `py_library` with no sources, only deps. But this is not possible with Rust since `rust_library` does not transparently re-export its dependencies. * add rust_crate_group test * add runfiles to rust_crate_group * add rust-analyzer support * rename rust_crate_group -> rust_library_group * add test verifying that rust_library_group can be consumed by rust_test * add coverage support to rust_library_group --------- Co-authored-by: UebelAndre <github@uebelandre.com> |
||
---|---|---|
.. | ||
BUILD.bazel | ||
dep1.rs | ||
dep2.rs | ||
lib.rs | ||
test.rs |