There is an old convention that a `proto_library` target with empty `srcs` should re-export its dependencies. This is sometimes useful as a way of creating something like an alias target, except that it can point to multiple dependencies rather than just one. The `rust_proto_library` aspect currently cannot handle this pattern and will raise an error if it encounters a `proto_library` without `srcs`. This CL fixes that problem by updating the `RustProtoInfo` provider generated by the aspect to include a list of `DepVariantInfo` instead of just one. In the typical case the provider will have just one `DepVariantInfo`, but this gives us the ability to return more than one in the case where we're exporting all the dependencies of a `src`-less `proto_library`. One thing this CL specifically does not attempt to do is add support for a `rust_proto_library` directly wrapping a `proto_library` without `srcs`. The reason for that is that it appears difficult to do in a way that would respect the layering check. It's also not obvious that we would want to encourage this pattern anyway. It's still valuable to support `src`-less `proto_library` targets when they're somewhere else in the transitive dependencies. This way you can freely create a `rust_proto_library` without having to fix up all your transitive deps first. PiperOrigin-RevId: 687344284pull/18901/head
parent
dcc1c08ef7
commit
9256d0705c
3 changed files with 36 additions and 23 deletions
Loading…
Reference in new issue