diff options
author | Wyatt Hepler <hepler@google.com> | 2021-04-07 09:50:23 -0700 |
---|---|---|
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2021-04-07 19:51:02 +0000 |
commit | 2c6c0ba11589feda9e0c1a6215d227e8177f3840 (patch) | |
tree | 140e9729083c22d7d88b39f0a7657507f35e5ddc | |
parent | b90d9b29d82eccf5703f7f2119220eea3f0bf961 (diff) | |
download | pigweed-2c6c0ba11589feda9e0c1a6215d227e8177f3840.tar.gz |
pw_protobuf_compiler: Use Python group for proto alias
This allows referring to pw_proto_library Python packages by
abbreviated labels (e.g. //foo:foo.python as //foo:python).
Change-Id: I5cb35054e42593f994228a1bfa5b9d198742f611
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/40140
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Reviewed-by: Alexei Frolov <frolv@google.com>
-rw-r--r-- | pw_protobuf_compiler/docs.rst | 7 | ||||
-rw-r--r-- | pw_protobuf_compiler/proto.gni | 8 |
2 files changed, 13 insertions, 2 deletions
diff --git a/pw_protobuf_compiler/docs.rst b/pw_protobuf_compiler/docs.rst index c22885032..eeb1620e8 100644 --- a/pw_protobuf_compiler/docs.rst +++ b/pw_protobuf_compiler/docs.rst @@ -65,6 +65,13 @@ is the same. For example, these two labels are equivalent: //path/to/my_protos:my_protos.pwpb //path/to/my_protos:pwpb +``pw_python_package`` subtargets are also available on the ``python`` subtarget: + +.. code-block:: + + //path/to/my_protos:my_protos.python.lint + //path/to/my_protos:python.lint + **Arguments** * ``sources``: List of input .proto files. diff --git a/pw_protobuf_compiler/proto.gni b/pw_protobuf_compiler/proto.gni index 2195b3bf0..a6ec15e03 100644 --- a/pw_protobuf_compiler/proto.gni +++ b/pw_protobuf_compiler/proto.gni @@ -612,11 +612,15 @@ template("pw_proto_library") { # directory (e.g. //foo:nanopb is an alias for //foo:foo.nanopb). if (get_label_info(":$target_name", "name") == get_path_info(get_label_info(":$target_name", "dir"), "name")) { - foreach(_generator, _protobuf_generators) { - group("$_generator") { + foreach(_generator, _protobuf_generators - [ "python" ]) { + group(_generator) { public_deps = [ ":${invoker.target_name}.$_generator" ] } } + + pw_python_group("python") { + python_deps = [ ":${invoker.target_name}.python" ] + } } # If the user attempts to use the target directly instead of one of the |