Commit graph

6 commits

Author SHA1 Message Date
Colin Cross
09364fd955 Fix python proto srczip argument order
-P has to come before -D to have an effect on the files read from the
directory.

Fixes: 130160833
Test: atest acloud_test
Change-Id: I62a998f1ad1e3b45f590babbf39330955d368373
2019-04-08 20:04:23 +00:00
Colin Cross
fe17f6f0e8 Add support for protoc plugins
Add a proto.plugin property to allow specifying a custom protoc
plugin to generate the code.

Fixes: 70706119
Test: m am StreamingProtoTest
Change-Id: I1ecdd346284b42bbcc8297019d98d2cd564eb94c
2019-04-02 16:38:55 +00:00
Colin Cross
19878da6a0 Move proto compilation to RuleBuilder
Using blueprint.Rule for protoc commands was causing code duplication
because there was no good way to run the same protoc for cc, java and
python but then run custom source packaging steps for java and python.
Move most of the code into a common function that returns a
RuleBuilder, and then let java and python add their own commands at
the end of the rule.

Bug: 70706119
Test: All Soong tests
Test: m checkbuild
Change-Id: Ic692136775d273bcc4f4de99620ab4878667c83a
2019-04-02 16:38:47 +00:00
Nan Zhang
f0c4e4339a Fix Protobuf importing issue for embedded Python
As I mentioned in b/79751992 #4, when launcher loads __main__ as entry point,
the module dict got set using absolute pkg path which
was runfiles.google.protobuf which caused the type checking failed
(expected: google.protobuf for type()). After then, starting with non entrypoint
python files, the importing module dict would be set with from...import...

So remove dir:runfiles/ from zip section so that during entrypoint Python file
importing the proto files using
from...import..., the type checking can be passed.

Bug: b/79751992
Test: m clean && m out/host/linux-x86/bin/perf_proto_stack;
And execute it:
usage: perf_proto_stack [-h] [--syms SYMS] [--json-out JSON_OUT]
                        [--print-samples] [--skip-kernel-syms]
                        [--print-pid-histogram] [--print-sym-histogram]
                        [--print-dso-histogram] [--parallel PARALLEL]
                        file [file ...]
perf_proto_stack: error: too few arguments

Change-Id: I95a4a9ee95ce7f90d893ea0529c384d7b944abe4
2018-05-23 03:33:36 +00:00
Dan Willemsen
4339853a20 Add a dependency fixer for proto deps
protoc dependency files, at least for C++ outputs, uses the form of:

  a/b.c \
  a/b.h: <dep1> <dep2>...

Ninja will fail the command when it parses a dep file and there's more
than one output file (even though it doesn't care what the output file
name is). So this tool will parse the original file, and output a
version with only a single output file.

Bug: 67329638
Test: NINJA_ARGS="-t deps ...pb.c" m
Test: NINJA_ARGS="-t deps ...srcjar" m
Test: NINJA_ARGS="-t deps ...srcszip" m
Test: Run dep_fixer across all of taimen's dep files, no failures.
Test: Run dep_fixer against the processed files, no changes.
Test: Run androidmk across all of our Android.mk files, inspect the diffs
Change-Id: I4263b7d5faea37285afa6b24dedf5964aa7d19dc
2018-05-07 16:21:59 -07:00
Nan Zhang
b8fa197878 Add Python protobuf support.
Python protobuf std libs will be wrapped in final binary/test par file.

Bug: b/70568913
Test: manually create real examples.
Change-Id: I7376ec9175f3e03d1adbd20858a7f74e826387ad
2018-03-22 15:56:51 -07:00