Commit e4dfc3b5 authored by kraynov's avatar kraynov Committed by Commit bot

Reorder protobuf compiler command line arguments.

Attempt to chase non-repoducible bug. CL crrev.com/2239383002 has
changed a command line for protoc and there are rare occasional
crashes on Win32. It could be because of some bug in protoc's parser.
This change restores a command line like before the suspecting CL
only for the most common case with only one proto file in a library.

BUG=644525

Review-Url: https://codereview.chromium.org/2324823002
Cr-Commit-Position: refs/heads/master@{#417544}
parent 3a8d44bd
...@@ -96,15 +96,15 @@ def main(argv): ...@@ -96,15 +96,15 @@ def main(argv):
options = parser.parse_args() options = parser.parse_args()
proto_dir = os.path.relpath(options.proto_in_dir) proto_dir = os.path.relpath(options.proto_in_dir)
protoc_cmd = [ protoc_cmd = [os.path.realpath(options.protoc)]
os.path.realpath(options.protoc),
"--proto_path", proto_dir
]
protos = options.protos protos = options.protos
headers = [] headers = []
VerifyProtoNames(protos) VerifyProtoNames(protos)
if options.py_out_dir:
protoc_cmd += ["--python_out", options.py_out_dir]
if options.cc_out_dir: if options.cc_out_dir:
cc_out_dir = options.cc_out_dir cc_out_dir = options.cc_out_dir
cc_options = FormatGeneratorOptions(options.cc_options) cc_options = FormatGeneratorOptions(options.cc_options)
...@@ -113,9 +113,6 @@ def main(argv): ...@@ -113,9 +113,6 @@ def main(argv):
stripped_name = StripProtoExtension(filename) stripped_name = StripProtoExtension(filename)
headers.append(os.path.join(cc_out_dir, stripped_name + ".pb.h")) headers.append(os.path.join(cc_out_dir, stripped_name + ".pb.h"))
if options.py_out_dir:
protoc_cmd += ["--python_out", options.py_out_dir]
if options.plugin_out_dir: if options.plugin_out_dir:
plugin_options = FormatGeneratorOptions(options.plugin_options) plugin_options = FormatGeneratorOptions(options.plugin_options)
protoc_cmd += [ protoc_cmd += [
...@@ -123,6 +120,7 @@ def main(argv): ...@@ -123,6 +120,7 @@ def main(argv):
"--plugin_out", plugin_options + options.plugin_out_dir "--plugin_out", plugin_options + options.plugin_out_dir
] ]
protoc_cmd += ["--proto_path", proto_dir]
protoc_cmd += [os.path.join(proto_dir, name) for name in protos] protoc_cmd += [os.path.join(proto_dir, name) for name in protos]
ret = subprocess.call(protoc_cmd) ret = subprocess.call(protoc_cmd)
if ret != 0: if ret != 0:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment