pw_build: Make GN Python installation more robust
- Since protobuf Python packages are generated and installed from the
build directory now, add dependencies on package installs in the
build. This ensures packages are properly installed before tests or
linting.
- Instantiate all Python actions in the default toolchain. This prevents
duplicate instantiations of Python actions for each toolchain, which
causes flakiness as packages are reinstalled for each toolchain.
- Add python_deps to pw_python_action that Python actions can depend on
Python package installations.
- Add various missing dependencies between Python packages.
Change-Id: I4ec34f06c04014b3552cc1b60aa506ac9a89b329
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/30000
Commit-Queue: Wyatt Hepler <hepler@google.com>
Reviewed-by: Alexei Frolov <frolv@google.com>
Reviewed-by: Rob Mohr <mohrr@google.com>
diff --git a/pw_protobuf_compiler/proto.gni b/pw_protobuf_compiler/proto.gni
index 527e25b..94d0c6c 100644
--- a/pw_protobuf_compiler/proto.gni
+++ b/pw_protobuf_compiler/proto.gni
@@ -41,6 +41,11 @@
script =
"$dir_pw_protobuf_compiler/py/pw_protobuf_compiler/generate_protos.py"
+ python_deps = [ "$dir_pw_protobuf_compiler/py" ]
+ if (defined(invoker.python_deps)) {
+ python_deps += invoker.python_deps
+ }
+
deps = [
":${invoker.base_target}._metadata",
":${invoker.base_target}._inputs",
@@ -96,7 +101,7 @@
forward_variables_from(invoker, "*", _forwarded_vars)
language = "pwpb"
plugin = "$dir_pw_protobuf/py/pw_protobuf/plugin.py"
- deps += [ "$dir_pw_protobuf/py" ]
+ python_deps = [ "$dir_pw_protobuf/py" ]
output_extensions = [ ".pwpb.h" ]
}
@@ -121,7 +126,7 @@
forward_variables_from(invoker, "*", _forwarded_vars)
language = "nanopb_rpc"
plugin = "$dir_pw_rpc/py/pw_rpc/plugin_nanopb.py"
- deps += [ "$dir_pw_rpc/py" ]
+ python_deps = [ "$dir_pw_rpc/py" ]
include_paths = [ "$dir_pw_third_party_nanopb/generator/proto" ]
output_extensions = [ ".rpc.pb.h" ]
}
@@ -179,7 +184,7 @@
forward_variables_from(invoker, "*", _forwarded_vars)
language = "raw_rpc"
plugin = "$dir_pw_rpc/py/pw_rpc/plugin_raw.py"
- deps += [ "$dir_pw_rpc/py" ]
+ python_deps = [ "$dir_pw_rpc/py" ]
output_extensions = [ ".raw_rpc.pb.h" ]
}