diff --git a/config/android/rules.gni b/config/android/rules.gni index 1069a42c1..3c644b68d 100644 --- a/config/android/rules.gni +++ b/config/android/rules.gni @@ -4005,9 +4005,7 @@ if (enable_java_templates) { } else { # Use the regular proto library to generate lite protos. _protoc_bin = "//third_party/android_protoc/protoc" - _proto_runtime = - "//third_party/android_deps:com_google_protobuf_protobuf_lite_java" - _protoc_javalite_plugin_dir = "//third_party/protoc_javalite/" + _proto_runtime = "//third_party/android_deps:com_google_protobuf_protobuf_javalite_java" } _proto_path = invoker.proto_path _template_name = target_name @@ -4049,11 +4047,6 @@ if (enable_java_templates) { if (_generate_nano) { args += [ "--nano" ] - } else { - args += [ - "--protoc-javalite-plugin-dir", - rebase_path(_protoc_javalite_plugin_dir, root_build_dir), - ] } } diff --git a/protoc_java.py b/protoc_java.py index a56128dc6..f5db3b838 100755 --- a/protoc_java.py +++ b/protoc_java.py @@ -37,8 +37,6 @@ 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) @@ -48,10 +46,6 @@ 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] @@ -63,21 +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_args + [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)