Modify template to sort list of source files alphabetically.

This is another step on the way to
https://fuchsia-review.googlesource.com/#/c/33945/.

I want to make it clear which source files have been
added or deleted to the automatically generated
BUILD.gn file in my manual edit. In this CL I modify the
template in order to make cosmetic-only changes to BUILD.gn.
That way in the following CL it will be easier to see the
substantive changes.
(1) Sort the list of source files in each source_set
(2) Delete some unneeded source_sets.
(3) Delete some Chromium-specific configs.

Change-Id: Id48ef59b327a1b777646f499d8030f7980c92147
This commit is contained in:
Mitch Rudominer 2017-06-13 19:30:35 -07:00 committed by Mitch Rudominer
parent 6ecc402af1
commit ea513a313a
2 changed files with 558 additions and 1624 deletions

2126
BUILD.gn

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,14 @@
%YAML 1.2
--- |
# GRPC Chromium BUILD.gn file.
# This file has been automatically generated from a template file.
# Please look at the templates directory instead.
# This file can be regenerated from the template by running
# tools/buildgen/generate_projects.sh
# Copyright 2017 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.
# This file was created in two steps:
# First we ran tools/buildgen/generate_projects.sh which generates a BUILD.gn
# file based on the template in templates/BUILD.gn.template. Then we
# hand-edited the resulting file for Fuchsia.
config("grpc_config") {
include_dirs = [
".",
@ -12,12 +16,6 @@
]
defines = [
"GRPC_USE_PROTO_LITE",
# TODO(xyzzyz): the <condition_variable> header in libstdc++-4.6 we're using
# in Chromium has a bug, which causes a compilation error on Clang.
# Therefore, we need to make gRPC not use standard library threading
# support.
# https://crbug.com/593874
"GRPC_CXX0X_NO_THREAD",
]
}
<%!
@ -30,7 +28,7 @@
if target_dict.get("build", None) == "protoc":
deps.append("//third_party/protobuf:protoc_lib")
name = target_dict.get("name", None)
if name in ("grpc++_unsecure", "grpc++", "grpc++_codegen_lib"):
if name in ("grpc++", "grpc++_codegen_lib"):
deps.append("//third_party/protobuf:protobuf_lite")
elif name in ("grpc", "grpc_unsecure"):
deps.append("//third_party/zlib")
@ -58,8 +56,7 @@
or f.endswith("load_balancer_api.h")
or f.endswith("load_balancer_api.c"))
def wanted_lib(lib):
wanted_libs = ("gpr", "grpc", "grpc_unsecure", "grpc++", "grpc++_unsecure",
"grpc_cronet", "grpc_plugin_support")
wanted_libs = ("gpr", "grpc", "grpc++", "grpc_plugin_support")
return lib.build in ("all", "protoc") and lib.get("name", "") in wanted_libs
def wanted_binary(tgt):
wanted_binaries = ("grpc_cpp_plugin",)
@ -93,19 +90,16 @@
% endfor
<%def name="cc_library(lib)">
<%
lib_hdrs = lib.get("headers", [])
hdrs = [h for h in lib_hdrs if not uses_nanopb_or_protofull(h)]
srcs = [s for s in lib.src if not uses_nanopb_or_protofull(s)]
lib_hdrs = [h for h in lib.get("headers", [])
if not uses_nanopb_or_protofull(h)]
lib_srcs = [s for s in lib.src if not uses_nanopb_or_protofull(s)]
lib_pub = lib.get("public_headers", [])
sources = lib_pub + lib_hdrs + lib_srcs
sources.sort()
%>
source_set("${lib.name}") {
sources = [
% for hdr in lib.get("public_headers", []):
"${hdr}",
% endfor
% for hdr in hdrs:
"${hdr}",
% endfor
% for src in srcs:
% for src in sources:
"${src}",
% endfor
]
@ -114,13 +108,14 @@
"${dep}",
% endfor
]
configs -= [ "//build/config/compiler:chromium_code" ]
<% extra_configs = get_extra_configs(lib) %>
% if extra_configs:
configs += [
"//build/config/compiler:no_chromium_code",
% for config in get_extra_configs(lib):
% for config in extra_configs:
"${config}",
% endfor
]
% endif
public_configs = [
":grpc_config",
]
@ -138,13 +133,14 @@
"${dep}",
% endfor
]
configs -= [ "//build/config/compiler:chromium_code" ]
<% extra_configs = get_extra_configs(tgt) %>
% if extra_configs:
configs += [
"//build/config/compiler:no_chromium_code",
% for config in get_extra_configs(tgt):
% for config in extra_configs:
"${config}",
% endfor
]
% endif
public_configs = [ ":grpc_config" ]
}
</%def>