diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-12 14:27:29 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-13 09:35:20 +0000 |
commit | c30a6232df03e1efbd9f3b226777b07e087a1122 (patch) | |
tree | e992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/third_party/protobuf | |
parent | 7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff) | |
download | qtwebengine-chromium-85-based.tar.gz |
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/third_party/protobuf')
-rw-r--r-- | chromium/third_party/protobuf/BUILD.gn | 58 | ||||
-rw-r--r-- | chromium/third_party/protobuf/proto_library.gni | 54 |
2 files changed, 110 insertions, 2 deletions
diff --git a/chromium/third_party/protobuf/BUILD.gn b/chromium/third_party/protobuf/BUILD.gn index e6b0031eb0f..695c0a35fcc 100644 --- a/chromium/third_party/protobuf/BUILD.gn +++ b/chromium/third_party/protobuf/BUILD.gn @@ -2,6 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import("//build/config/sanitizers/sanitizers.gni") +import("//third_party/closure_compiler/compile_js.gni") config("protobuf_config") { include_dirs = [ "src" ] @@ -676,3 +677,60 @@ group("py_proto_runtime") { data += get_target_outputs(":copy_google_protobuf") data += get_target_outputs(":copy_google_protobuf_internal") } + +# JS protobuf library. +js_library("js_proto") { + sources = [ + "//third_party/google-closure-library/closure/goog/array/array.js", + "//third_party/google-closure-library/closure/goog/asserts/asserts.js", + "//third_party/google-closure-library/closure/goog/base.js", + "//third_party/google-closure-library/closure/goog/crypt/base64.js", + "//third_party/google-closure-library/closure/goog/crypt/crypt.js", + "//third_party/google-closure-library/closure/goog/debug/error.js", + "//third_party/google-closure-library/closure/goog/dom/asserts.js", + "//third_party/google-closure-library/closure/goog/dom/browserfeature.js", + "//third_party/google-closure-library/closure/goog/dom/dom.js", + "//third_party/google-closure-library/closure/goog/dom/htmlelement.js", + "//third_party/google-closure-library/closure/goog/dom/nodetype.js", + "//third_party/google-closure-library/closure/goog/dom/safe.js", + "//third_party/google-closure-library/closure/goog/dom/tagname.js", + "//third_party/google-closure-library/closure/goog/dom/tags.js", + "//third_party/google-closure-library/closure/goog/fs/url.js", + "//third_party/google-closure-library/closure/goog/functions/functions.js", + "//third_party/google-closure-library/closure/goog/goog.js", + "//third_party/google-closure-library/closure/goog/html/safehtml.js", + "//third_party/google-closure-library/closure/goog/html/safescript.js", + "//third_party/google-closure-library/closure/goog/html/safestyle.js", + "//third_party/google-closure-library/closure/goog/html/safestylesheet.js", + "//third_party/google-closure-library/closure/goog/html/safeurl.js", + "//third_party/google-closure-library/closure/goog/html/trustedresourceurl.js", + "//third_party/google-closure-library/closure/goog/html/trustedtypes.js", + "//third_party/google-closure-library/closure/goog/html/uncheckedconversions.js", + "//third_party/google-closure-library/closure/goog/i18n/bidi.js", + "//third_party/google-closure-library/closure/goog/labs/useragent/browser.js", + "//third_party/google-closure-library/closure/goog/labs/useragent/engine.js", + "//third_party/google-closure-library/closure/goog/labs/useragent/platform.js", + "//third_party/google-closure-library/closure/goog/labs/useragent/util.js", + "//third_party/google-closure-library/closure/goog/math/coordinate.js", + "//third_party/google-closure-library/closure/goog/math/math.js", + "//third_party/google-closure-library/closure/goog/math/size.js", + "//third_party/google-closure-library/closure/goog/memoize/memoize.js", + "//third_party/google-closure-library/closure/goog/object/object.js", + "//third_party/google-closure-library/closure/goog/reflect/reflect.js", + "//third_party/google-closure-library/closure/goog/string/const.js", + "//third_party/google-closure-library/closure/goog/string/internal.js", + "//third_party/google-closure-library/closure/goog/string/string.js", + "//third_party/google-closure-library/closure/goog/string/typedstring.js", + "//third_party/google-closure-library/closure/goog/useragent/product.js", + "//third_party/google-closure-library/closure/goog/useragent/useragent.js", + "js/binary/arith.js", + "js/binary/constants.js", + "js/binary/decoder.js", + "js/binary/encoder.js", + "js/binary/reader.js", + "js/binary/utils.js", + "js/binary/writer.js", + "js/map.js", + "js/message.js", + ] +} diff --git a/chromium/third_party/protobuf/proto_library.gni b/chromium/third_party/protobuf/proto_library.gni index 44c7fefa25d..71b264c11b0 100644 --- a/chromium/third_party/protobuf/proto_library.gni +++ b/chromium/third_party/protobuf/proto_library.gni @@ -25,6 +25,9 @@ # generate_cc (optional, default true) # Generate C++ protobuf stubs. # +# generate_javascript (optional, default false) +# Generate Javascript protobuf stubs. +# # cc_generator_options (optional) # List of extra flags passed to the protocol compiler. If you need to # add an EXPORT macro to a protobuf's C++ header, set the @@ -117,6 +120,7 @@ import("//build/config/sanitizers/sanitizers.gni") import("//build/toolchain/kythe.gni") +import("//third_party/closure_compiler/compile_js.gni") if (host_os == "win") { _host_executable_suffix = ".exe" @@ -150,6 +154,12 @@ template("proto_library") { generate_python = true } + if (defined(invoker.generate_javascript)) { + generate_javascript = invoker.generate_javascript + } else { + generate_javascript = false + } + if (defined(invoker.generator_plugin_label)) { # Straightforward way to get the name of executable doesn't work because # |root_out_dir| and |root_build_dir| may differ in cross-compilation and @@ -221,10 +231,15 @@ template("proto_library") { py_out_dir = "$root_out_dir/pyproto/" + proto_out_dir rel_py_out_dir = rebase_path(py_out_dir, root_build_dir) } + if (generate_javascript) { + js_out_dir = "$root_out_dir/jsproto/" + proto_out_dir + rel_js_out_dir = rebase_path(js_out_dir, root_build_dir) + } protos = rebase_path(invoker.sources, proto_in_dir) protogens = [] protogens_cc = [] + protogens_js = [] # List output files. foreach(proto, protos) { @@ -246,17 +261,24 @@ template("proto_library") { protogens_cc += [ "$cc_out_dir/${proto_path}${suffix}" ] } } + if (generate_javascript) { + protogens_js += [ "$js_out_dir/${proto_path}.js" ] + } } action_name = "${target_name}_gen" source_set_name = target_name + javascript_name = "${target_name}_js" # Generate protobuf stubs. action(action_name) { - visibility = [ ":$source_set_name" ] + visibility = [ + ":$source_set_name", + ":$javascript_name", + ] script = "//tools/protoc_wrapper/protoc_wrapper.py" sources = proto_sources - outputs = get_path_info(protogens + protogens_cc, "abspath") + outputs = get_path_info(protogens + protogens_cc + protogens_js, "abspath") args = protos if (defined(invoker.testonly)) { @@ -302,6 +324,13 @@ template("proto_library") { ] } + if (generate_javascript) { + args += [ + "--js-out-dir", + rel_js_out_dir, + ] + } + if (generate_with_plugin) { args += [ "--plugin", @@ -373,6 +402,23 @@ template("proto_library") { } } + # Build generated javascript stubs. + if (generate_javascript) { + js_library(javascript_name) { + forward_variables_from(invoker, + [ + "testonly", + "visibility", + ]) + + sources = protogens_js + + deps = [ "//third_party/protobuf:js_proto" ] + + extra_deps = [ ":$action_name" ] + } + } + # Build generated protobuf stubs as libary or source set. target(link_target_type, target_name) { forward_variables_from(invoker, @@ -509,6 +555,10 @@ template("protoc_convert") { deps += invoker.deps } + if (defined(invoker.testonly)) { + testonly = invoker.testonly + } + outputs = [ invoker.output_pattern ] args = [ |