| diff --git a/build/secondary/third_party/grpc/template/BUILD.fuchsia.gn.template b/build/secondary/third_party/grpc/template/BUILD.fuchsia.gn.template |
| index 2ff55896c87..f3f6615b1a0 100644 |
| --- a/build/secondary/third_party/grpc/template/BUILD.fuchsia.gn.template |
| +++ b/build/secondary/third_party/grpc/template/BUILD.fuchsia.gn.template |
| @@ -3,11 +3,15 @@ |
| <%doc> |
| Header piece |
| </%doc>\ |
| - # GRPC Chromium GN build file |
| - |
| - # This file has been automatically generated from a template file. |
| - # Please look at the templates directory instead. |
| - # See //third_party/grpc/README.chromium for more information. |
| + # Copyright 2021 The Fuchsia Authors. All rights reserved. |
| + # Use of this source code is governed by a BSD-style license that can be |
| + # found in the LICENSE file. |
| + # |
| + # GRPC Fuchsia GN build file |
| + # |
| + # DO NOT EDIT: This file has been automatically generated from a template. |
| + # |
| + # See README.md for more information. |
| |
| declare_args() { |
| # Compiles with ares. |
| @@ -23,6 +27,11 @@ |
| is_android || is_win || is_chromeos || is_mac || is_ios |
| } |
| |
| + if (defined(is_fuchsia_tree) && is_fuchsia_tree) { |
| + grpc_use_static_linking = true |
| + is_fuchsia = true |
| + } |
| + |
| if (is_android) { |
| import("//build/config/android/config.gni") |
| import("//build/config/android/rules.gni") |
| @@ -35,11 +44,13 @@ |
| include_dirs = [ |
| "./include", |
| ".", |
| - "./src/core/ext/upb-generated", |
| - "./src/core/ext/upbdefs-generated", |
| + "./src/core/ext/upb-gen", |
| + "./src/core/ext/upbdefs-gen", |
| + "./third_party/utf8_range", |
| "./third_party/cares", |
| "//third_party/cares/include", |
| "./third_party/upb", |
| + "./third_party/xxhash", |
| "//third_party/abseil-cpp", |
| ] |
| |
| @@ -89,13 +100,28 @@ |
| cflags = [ |
| "-Wno-c++98-compat-extra-semi", |
| "-Wno-deprecated-copy", |
| + "-Wno-enum-enum-conversion", |
| "-Wno-extra-semi", |
| + "-Wno-float-conversion", |
| "-Wno-implicit-fallthrough", |
| + "-Wno-implicit-float-conversion", |
| + "-Wno-implicit-int-conversion", |
| + "-Wno-implicit-int-float-conversion", |
| + "-Wno-newline-eof", |
| "-Wno-shadow", |
| + "-Wno-shorten-64-to-32", |
| "-Wno-sign-compare", |
| + "-Wno-strict-prototypes", |
| + "-Wno-sometimes-uninitialized", |
| + "-Wno-string-concatenation", |
| "-Wno-unreachable-code", |
| "-Wno-unreachable-code-break", |
| "-Wno-unreachable-code-return", |
| + "-Wno-unused-variable", |
| + "-Wno-unused-result", |
| + |
| + # TODO(https://fxbug.dev/42063413): Remove after integrating |
| + # https://github.com/grpc/grpc/pull/31306 |
| + "-Wno-thread-safety-analysis", |
| ] |
| |
| # TODO(b/260740023): Remove when gRPC has CFI checks enabled. |
| @@ -106,7 +132,7 @@ |
| |
| template("grpc_so") { |
| if (grpc_use_static_linking) { |
| - source_set(target_name) { |
| + static_library(target_name) { |
| forward_variables_from(invoker, "*") |
| } |
| } else { |
| @@ -223,10 +249,6 @@ |
| out_sources.append('# gRPC memcpy wrapping logic isn\'t useful here.') |
| out_sources.append('# See https://crbug.com/661171') |
| out_sources.append('# "{}",'.format(s)) |
| - elif s == './src/core/plugin_registry/grpc_plugin_registry.cc': |
| - out_sources.append('# Disabling some default plugins.') |
| - out_sources.append('# "{}",'.format(s)) |
| - out_sources.append('"plugin_registry/grpc_plugin_registry.cc",') |
| elif s == './src/core/lib/matchers/matchers.cc': |
| # matchers are disabled to reduce binary size |
| out_sources.append('# "{}",'.format(s)) |
| @@ -256,11 +278,23 @@ |
| deps.add("//third_party/zlib") |
| add_absl = False |
| add_boring_ssl = False |
| + add_zlib = False |
| + add_protoc = False |
| + add_protobuf = False |
| + add_re2 = False |
| for d in target_dict.get("deps", []): |
| if d.startswith('libssl'): |
| add_boring_ssl = True |
| elif d.startswith('absl'): |
| add_absl = True |
| + elif d == "z": |
| + add_zlib = True |
| + elif d == "protoc": |
| + add_protoc = True |
| + elif d == "protobuf": |
| + add_protobuf = True |
| + elif d == "re2": |
| + add_re2 = True |
| elif d.startswith(("//", ":")): |
| deps.add(d) |
| else: |
| @@ -269,6 +303,14 @@ |
| deps.add("//third_party/abseil-cpp:absl") |
| if add_boring_ssl: |
| deps.add("//third_party/boringssl",) |
| + if add_zlib: |
| + deps.add("//third_party/zlib") |
| + if add_protoc: |
| + deps.add("//third_party/protobuf:protoc_lib") |
| + if add_protobuf: |
| + deps.add("//third_party/protobuf:protobuf_lite") |
| + if add_re2: |
| + deps.add("//third_party/re2") |
| return list(deps) |
| |
| # Get dependencies for a list of sources. |
| @@ -304,16 +346,9 @@ |
| |
| |
| def strip_sources(sources): |
| - exceptions = [ |
| - "./src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h", |
| - "./src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc", |
| - "./src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc", |
| - ] |
| - |
| return [f for f in sources |
| if "ruby_generator" not in f |
| - and not (re.match("./src/core/ext/filters/client_channel/lb_policy/.*/.*",f) |
| - and not f in exceptions) |
| + and not re.match("./src/core/ext/filters/client_channel/lb_policy/xds/.*",f) |
| and not re.match("./src/core/ext/filters/client_channel/resolver/xds/.*",f) |
| and not re.match("./src/core/ext/xds/.*",f) |
| ] |
| @@ -332,7 +367,7 @@ |
| return lib.name in main_libs |
| |
| def wanted_lib(lib): |
| - wanted_libs = ("grpc_plugin_support", "address_sorting", "upb") |
| + wanted_libs = ("grpc_plugin_support", "address_sorting", "upb_base_lib", "upb_json_lib", "upb_mem_lib", "upb_message_lib", "upb_textformat_lib", "upb","upb_collections_lib", "utf8_range_lib") |
| return lib.build in ("all", "protoc") and lib.get("name", "") in wanted_libs |
| |
| def wanted_binary(tgt): |
| @@ -472,7 +507,7 @@ |
| (sources, repeated1, repeated2, repeated3, repeated4) = find_repeated(sources) |
| extra_configs = [':grpc_config_private'] |
| extra_stuff = [] |
| - target_type = 'source_set' |
| + target_type = 'static_library' |
| if not is_host: |
| extra_stuff = get_extra_stuff() |
| deps = get_deps_from_target(lib) |
| @@ -521,7 +556,7 @@ |
| sources = gn_sort(sources) |
| sources = get_commented_sources(sources) |
| %>\ |
| - ${indent}source_set("${name}") { |
| + ${indent}static_library("${name}") { |
| % if sources: |
| ${indent} sources = [ |
| % for src in sources: |
| @@ -539,6 +574,7 @@ |
| % endif |
| ${indent} public_configs = [ |
| ${indent} ":grpc_config", |
| + ${indent} "//build/config:suppress_iterator_warnings", |
| ${indent} ] |
| % if extra_configs: |
| ${indent} configs += [ |
| @@ -597,7 +633,7 @@ |
| ] |
| } |
| |
| - source_set("cares") { |
| + static_library("cares") { |
| sources = [ |
| "./third_party/cares/ares_build.h", |
| ] |