diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-01-29 16:35:13 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-02-01 15:33:35 +0000 |
commit | c8c2d1901aec01e934adf561a9fdf0cc776cdef8 (patch) | |
tree | 9157c3d9815e5870799e070b113813bec53e0535 /chromium/build/protoc_java.py | |
parent | abefd5095b41dac94ca451d784ab6e27372e981a (diff) | |
download | qtwebengine-chromium-c8c2d1901aec01e934adf561a9fdf0cc776cdef8.tar.gz |
BASELINE: Update Chromium to 64.0.3282.139
Change-Id: I1cae68fe9c94ff7608b26b8382fc19862cdb293a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/build/protoc_java.py')
-rwxr-xr-x | chromium/build/protoc_java.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/chromium/build/protoc_java.py b/chromium/build/protoc_java.py index 46fa8200ebd..426d684a1fe 100755 --- a/chromium/build/protoc_java.py +++ b/chromium/build/protoc_java.py @@ -33,6 +33,8 @@ def main(argv): help="Path to output directory for java files.") parser.add_option("--srcjar", help="Path to output srcjar.") parser.add_option("--stamp", help="File to touch on success.") + parser.add_option("--lite", + help="Use to generate lite protos.", action='store_true') options, args = parser.parse_args(argv) build_utils.CheckOptions(options, parser, ['protoc', 'proto_path']) @@ -41,10 +43,22 @@ def main(argv): return 1 with build_utils.TempDir() as temp_dir: - # Specify arguments to the generator. - generator_args = ['optional_field_style=reftypes', - 'store_unknown_fields=true'] - out_arg = '--javanano_out=' + ','.join(generator_args) + ':' + temp_dir + if options.lite: + out_arg = '--java_out=' + temp_dir + + # Check if all proto files (which are listed in the args) are opting to + # use the lite runtime, otherwise we'd have to include the much heavier + # regular proto runtime in Chrome. + for proto_file in args: + if not 'LITE_RUNTIME' in open(proto_file).read(): + raise Exception( + 'Chrome only supports lite protos. Please add "optimize_for = ' + 'LITE_RUNTIME" to your proto file to enable the lite runtime.') + else: + # Specify arguments to the generator. + generator_args = ['optional_field_style=reftypes', + 'store_unknown_fields=true'] + out_arg = '--javanano_out=' + ','.join(generator_args) + ':' + temp_dir # Generate Java files using protoc. build_utils.CheckOutput( [options.protoc, '--proto_path', options.proto_path, out_arg] |