Roll protobuf javalite runtime + fix gn package name

This rolls in the new version 3.11.4 of the protobuf javalite runtime.
The package name changed so this also fixes all references in gn files.
A similar internal commit exists at crrev.com/i/1676922

This also changes how protoc is called to ask for the java lite runtime.
The protoc javalite code gen plugin is no longer needed and will be
removed in a followup cl.

             but reduces them per generated proto.

Binary-Size: new runtime increases the number of methods in the runtime
Bug: 988512
Change-Id: I8dd2ba97badea0b7dbaa8282afeb1da40636aee5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1762684
Commit-Queue: Mohamed Heikal <mheikal@chromium.org>
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
Reviewed-by: Peter Wen <wnwen@chromium.org>
Reviewed-by: John Budorick <jbudorick@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#747540}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 0221b0c7ff5ad956c6a2ef1e247ed41625ee92b2
This commit is contained in:
Mohamed Heikal 2020-03-06 02:48:50 +00:00 коммит произвёл Commit Bot
Родитель 2681c0858d
Коммит e393474c8c
2 изменённых файлов: 8 добавлений и 26 удалений

Просмотреть файл

@ -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),
]
}
}

Просмотреть файл

@ -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)