summaryrefslogtreecommitdiff
path: root/chromium/build/protoc_java.py
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-07-16 11:45:35 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-07-17 08:59:23 +0000
commit552906b0f222c5d5dd11b9fd73829d510980461a (patch)
tree3a11e6ed0538a81dd83b20cf3a4783e297f26d91 /chromium/build/protoc_java.py
parent1b05827804eaf047779b597718c03e7d38344261 (diff)
downloadqtwebengine-chromium-552906b0f222c5d5dd11b9fd73829d510980461a.tar.gz
BASELINE: Update Chromium to 83.0.4103.122
Change-Id: Ie3a82f5bb0076eec2a7c6a6162326b4301ee291e Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/build/protoc_java.py')
-rwxr-xr-xchromium/build/protoc_java.py27
1 files changed, 12 insertions, 15 deletions
diff --git a/chromium/build/protoc_java.py b/chromium/build/protoc_java.py
index 4eb8eaecbca..f5db3b83808 100755
--- a/chromium/build/protoc_java.py
+++ b/chromium/build/protoc_java.py
@@ -37,8 +37,8 @@ def main(argv):
parser.add_option("--stamp", help="File to touch on success.")
parser.add_option("--nano",
help="Use to generate nano protos.", action='store_true')
- parser.add_option("--protoc-javalite-plugin-dir",
- help="Path to protoc java lite plugin directory.")
+ parser.add_option("--import-dir", action="append", default=[],
+ help="Extra import directory for protos, can be repeated.")
options, args = parser.parse_args(argv)
build_utils.CheckOptions(options, parser, ['protoc', 'proto_path'])
@@ -46,9 +46,9 @@ def main(argv):
print('One of --java-out-dir or --srcjar must be specified.')
return 1
- if not options.nano and not options.protoc_javalite_plugin_dir:
- print('One of --nano or --protoc-javalite-plugin-dir must be specified.')
- return 1
+ proto_path_args = ['--proto_path', options.proto_path]
+ for path in options.import_dir:
+ proto_path_args += ["--proto_path", path]
with build_utils.TempDir() as temp_dir:
if options.nano:
@@ -57,19 +57,16 @@ def main(argv):
'store_unknown_fields=true']
out_arg = '--javanano_out=' + ','.join(generator_args) + ':' + temp_dir
else:
- out_arg = '--javalite_out=' + temp_dir
-
- custom_env = os.environ.copy()
- if options.protoc_javalite_plugin_dir:
- # if we are generating lite protos, then the lite plugin needs to be in the path when protoc
- # is called. See https://github.com/protocolbuffers/protobuf/blob/master/java/lite.md
- custom_env['PATH'] = '{}:{}'.format(
- os.path.abspath(options.protoc_javalite_plugin_dir), custom_env['PATH'])
+ out_arg = '--java_out=lite:' + temp_dir
# Generate Java files using protoc.
build_utils.CheckOutput(
- [options.protoc, '--proto_path', options.proto_path, out_arg]
- + args, env=custom_env)
+ [options.protoc] + proto_path_args + [out_arg] + args,
+ # protoc generates superfluous warnings about LITE_RUNTIME deprecation
+ # even though we are using the new non-deprecated method.
+ stderr_filter=lambda output:
+ build_utils.FilterLines(output,
+ '|'.join([r'optimize_for = LITE_RUNTIME', r'java/lite\.md'])))
if options.java_out_dir:
build_utils.DeleteDirectory(options.java_out_dir)