diff options
author | Alexander Polcyn <apolcyn@google.com> | 2017-11-29 17:06:16 -0800 |
---|---|---|
committer | Alexander Polcyn <apolcyn@google.com> | 2017-12-14 18:11:25 -0800 |
commit | 54a70409c0c4059c19c14ec759633637fd0656d8 (patch) | |
tree | 316ecff46d56cec2dcaa901f2143ff654ad7d30b /bazel/grpc_build_system.bzl | |
parent | 00a7d47e5b04fa508c1dc8edf52084f5736f7c3d (diff) |
Move more special cases in bazel build to the .bzl files
Diffstat (limited to 'bazel/grpc_build_system.bzl')
-rw-r--r-- | bazel/grpc_build_system.bzl | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index 234d129aa3..d146ca9c2c 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -26,6 +26,27 @@ # The set of pollers to test against if a test exercises polling POLLERS = ['epollex', 'epollsig', 'epoll1', 'poll', 'poll-cv'] +def _get_external_deps(external_deps): + ret = [] + for dep in external_deps: + if dep == "nanopb": + ret.append("//third_party/nanopb") + else: + ret.append("//external:" + dep) + return ret + +def _maybe_update_cc_library_hdrs(hdrs): + ret = [] + hdrs_to_update = { + "third_party/objective_c/Cronet/bidirectional_stream_c.h": "//third_party:objective_c/Cronet/bidirectional_stream_c.h", + } + for h in hdrs: + if h in hdrs_to_update.keys(): + ret.append(hdrs_to_update[h]) + else: + ret.append(h) + return ret + def grpc_cc_library(name, srcs = [], public_hdrs = [], hdrs = [], external_deps = [], deps = [], standalone = False, language = "C++", testonly = False, visibility = None, @@ -40,8 +61,8 @@ def grpc_cc_library(name, srcs = [], public_hdrs = [], hdrs = [], "//conditions:default": [],}) + select({"//:remote_execution": ["GRPC_PORT_ISOLATED_RUNTIME=1"], "//conditions:default": [],}), - hdrs = hdrs + public_hdrs, - deps = deps + ["//external:" + dep for dep in external_deps], + hdrs = _maybe_update_cc_library_hdrs(hdrs + public_hdrs), + deps = deps + _get_external_deps(external_deps), copts = copts, visibility = visibility, testonly = testonly, @@ -82,7 +103,7 @@ def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data 'srcs': srcs, 'args': args, 'data': data, - 'deps': deps + ["//external:" + dep for dep in external_deps], + 'deps': deps + _get_external_deps(external_deps), 'copts': copts, 'linkopts': ["-pthread"], } @@ -114,7 +135,7 @@ def grpc_cc_binary(name, srcs = [], deps = [], external_deps = [], args = [], da data = data, testonly = testonly, linkshared = linkshared, - deps = deps + ["//external:" + dep for dep in external_deps], + deps = deps + _get_external_deps(external_deps), copts = copts, linkopts = ["-pthread"] + linkopts, ) |