diff options
Diffstat (limited to 'chromium/build/protoc_java.py')
-rwxr-xr-x | chromium/build/protoc_java.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/chromium/build/protoc_java.py b/chromium/build/protoc_java.py index 426d684a1fe..2addb8210fe 100755 --- a/chromium/build/protoc_java.py +++ b/chromium/build/protoc_java.py @@ -33,8 +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') + parser.add_option("--nano", + help="Use to generate nano protos.", action='store_true') options, args = parser.parse_args(argv) build_utils.CheckOptions(options, parser, ['protoc', 'proto_path']) @@ -43,22 +43,25 @@ def main(argv): return 1 with build_utils.TempDir() as temp_dir: - if options.lite: + if options.nano: + # Specify arguments to the generator. + generator_args = ['optional_field_style=reftypes', + 'store_unknown_fields=true'] + out_arg = '--javanano_out=' + ','.join(generator_args) + ':' + temp_dir + else: 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. + # TODO(jkrcal): Replace this check by '--java_lite_out=' for the out_arg + # above once this works on the master branch of the protobuf library, + # expected in version 4.0 (see https://crbug.com/800281). 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] |