Handle .proto files that end up in a different package
Bazel poses a strict requirement that .proto files and proto_library must be in the same package. This CL handles this automatically by creating the proto_library in a separate dir/package if necessary Implementation details - Partition the `srcs` by package. `srcs` has been computed using `transformSubpackagePath`, so the information about packages is available at this point - Create a proto_library in each package by using `CommonAttributes.Dir`. Collect all these additional libraries and put them in `info.Proto_libraries` so that they get added as deps of (cc|python|...)_proto_library - Add an import_prefix to the proto_library in subpackages relative to the current directory. This relies on the assumption that every src is beneath the current directory (Soong will complain if a path in Android.bp contains ../) filegroup module type uses a separate code-path to create proto_library. This will be handled in the next CL in stack. Test: bp2build unit tests Test: TH Test: Built the failing internal module mentioned in b/292583584#comment1 Bug: 292583584 Change-Id: I437fc89092321b26c5f0511387cde9e84084d6f9
Loading
Please register or sign in to comment