Option added to protobuf build for import directories

Protobuf library GNI does not let BUILD.gn define directories outside the base directory of the source files to be used for importing proto files in source proto files. This is resolved by adding an extra optional parameter that specifies the directories from which proto files are imported.

BUG=683143

Review-Url: https://codereview.chromium.org/2646123002
Cr-Original-Commit-Position: refs/heads/master@{#450309}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 0c4b1788e3e0010560d6a064433f4f99afae5fda
diff --git a/protoc_wrapper.py b/protoc_wrapper.py
index 8eac884..6a25de0 100755
--- a/protoc_wrapper.py
+++ b/protoc_wrapper.py
@@ -89,7 +89,9 @@
                       help="Standard C++ generator options.")
   parser.add_argument("--include",
                       help="Name of include to insert into generated headers.")
-
+  parser.add_argument("--import-dir", action="append", default=[],
+                      help="Extra import directory for protos, can be repeated."
+  )
   parser.add_argument("protos", nargs="+",
                       help="Input protobuf definition file(s).")
 
@@ -121,7 +123,11 @@
     ]
 
   protoc_cmd += ["--proto_path", proto_dir]
+  for path in options.import_dir:
+    protoc_cmd += ["--proto_path", path]
+
   protoc_cmd += [os.path.join(proto_dir, name) for name in protos]
+
   ret = subprocess.call(protoc_cmd)
   if ret != 0:
     raise RuntimeError("Protoc has returned non-zero status: "