pw_protobuf_compiler: Ensure nanopb_pb2.py is generated
Import the Nanopb Python package to ensure that nanopb_pb2.py is
generated prior generating any Nanopb protos. This prevents race
conditions in clean builds.
Change-Id: I4b07ceb5665c49d0bd73a35759af18ec275094ed
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/43741
Commit-Queue: Wyatt Hepler <hepler@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
diff --git a/pw_protobuf_compiler/proto.gni b/pw_protobuf_compiler/proto.gni
index c6348c9..51d443f 100644
--- a/pw_protobuf_compiler/proto.gni
+++ b/pw_protobuf_compiler/proto.gni
@@ -69,6 +69,10 @@
deps += [ get_label_info(dep, "label_no_toolchain") + "._gen" ]
}
+ if (defined(invoker.other_deps)) {
+ deps += invoker.other_deps
+ }
+
args = [
"--language",
invoker.language,
@@ -192,6 +196,7 @@
forward_variables_from(invoker, "*", _forwarded_vars)
language = "nanopb"
plugin = "$dir_pw_third_party_nanopb/generator/protoc-gen-nanopb"
+ other_deps = [ "$dir_pw_third_party/nanopb:generate_nanopb_proto.action" ]
}
# Create a library with the generated source files.