pw_protobuf_compiler: Decouple proto packaging from directory
- Allow specifying prefix and strip_prefix arguments for proto files.
The proto directory tree is built as specified in the out directory.
- Only invoke protoc from the default toolchain. This prevents duplicate
protoc invocations.
- Prevent duplicate pw_proto_library Python package definitions anywhere
in the build.
- Replace implicit handling of standalone external protos with a
python_package_as_module option.
Change-Id: Id37d8b4d83294f7d3142a389e74ceea96dd4d620
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/34640
Reviewed-by: Alexei Frolov <frolv@google.com>
diff --git a/pw_rpc/BUILD.gn b/pw_rpc/BUILD.gn
index 06ba545..0424f1e 100644
--- a/pw_rpc/BUILD.gn
+++ b/pw_rpc/BUILD.gn
@@ -134,17 +134,18 @@
pw_proto_library("protos") {
sources = [
- "pw_rpc_protos/echo.proto",
- "pw_rpc_protos/internal/packet.proto",
+ "echo.proto",
+ "internal/packet.proto",
]
- inputs = [ "pw_rpc_protos/echo.options" ]
+ inputs = [ "echo.options" ]
+ prefix = "pw_rpc_protos"
}
pw_doc_group("docs") {
sources = [ "docs.rst" ]
inputs = [
- "pw_rpc_protos/echo.proto",
- "pw_rpc_protos/internal/packet.proto",
+ "echo.proto",
+ "internal/packet.proto",
]
group_deps = [
"nanopb:docs",