protobuf: include imports when generating descriptor and add depfile

This CL adds the include_imports flag to protoc when generating
descriptors. This flag is necessary to support any sort of imports in
proto files as GN does not have support for transitively listing all
the source files in a target and its deps.

Since now include_imports silently looks at other source files other
than the ones listed in the target, this means we need a depfile to
allow ninja to pick up if changes are made in transitive dep source
files. Unfortunately, protoc's depfile generation is broken out of the
box and does not work with ninja.

Add support in the wrapper script to correct this mirror what we do in
Perfetto to achieve the same thing (see [1])

[1] https://cs.android.com/android/platform/superproject/+/master:external/perfetto/tools/protoc_helper.py

Change-Id: Ib330520232280b3a8a9eb80a397fac2f3cd1e076
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2440887
Reviewed-by: Eric Seckler <eseckler@chromium.org>
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Commit-Queue: Lalit Maganti <lalitm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#813161}
GitOrigin-RevId: c2a68d05aec4ff703654c3ac1ab0183d3c18fab2
1 file changed
tree: 3f46cb4f9569f8c9cd42d15fa65d9da3389da9bc
  1. protoc_convert.py
  2. protoc_wrapper.py
  3. protoc_wrapper_test.py