commit | d0f65851566ff381a142a8d593ec84b586d32560 | [log] [tgz] |
---|---|---|
author | Paul Mathieu <paulmathieu@google.com> | Sun May 17 01:06:57 2020 -0700 |
committer | CQ Bot Account <commit-bot@chromium.org> | Mon May 18 21:02:24 2020 +0000 |
tree | ccff2a8106fe8e2dbc35dde668859bb3e8ddc5cf | |
parent | 95295efacc3999c1b5065c89d4ee5f7cca3b8b34 [diff] |
pw_protobuf_compiler: fix nanopb path to .options files nanopb was unable to find .options files that were alongside their .proto files. https://jpa.kapsi.fi/nanopb/docs/reference.html#defining-the-options-in-a-options-file `protoc` does not pass its include path to nanopb, so nanopb uses `--nanopb_out=-Ipath:output` for that. Passing the proper argument fixes that. Tested with a .proto and a .options files in the same folder, options are applied by nanopb. Change-Id: I6c1cedbc2cce994818ac483c0fb171b6b8cafaa1
diff --git a/pw_protobuf_compiler/py/pw_protobuf_compiler/generate_protos.py b/pw_protobuf_compiler/py/pw_protobuf_compiler/generate_protos.py index f8f4f6e..c42692c 100644 --- a/pw_protobuf_compiler/py/pw_protobuf_compiler/generate_protos.py +++ b/pw_protobuf_compiler/py/pw_protobuf_compiler/generate_protos.py
@@ -67,9 +67,10 @@ def protoc_nanopb_args(args: argparse.Namespace) -> List[str]: + # nanopb needs to know of the include path to parse *.options files return [ - '--plugin', f'protoc-gen-nanopb={args.custom_plugin}', '--nanopb_out', - args.out_dir + '--plugin', f'protoc-gen-nanopb={args.custom_plugin}', + f'--nanopb_out=-I{args.module_path}:{args.out_dir}' ]