diff options
author | Yihua Zhang <yihuaz@google.com> | 2018-03-15 11:06:25 -0700 |
---|---|---|
committer | Yihua Zhang <yihuaz@google.com> | 2018-03-15 11:06:25 -0700 |
commit | 5848893d65b8f6afd38fa8cbc3b5afcb933e698a (patch) | |
tree | b39fdd74dfc9135ba37baae26cc89acd4f5df8aa /bazel | |
parent | e5821cdad2a45072a0b023a8ea003cff4f03791f (diff) |
build nanopb one-off target
Diffstat (limited to 'bazel')
-rw-r--r-- | bazel/grpc_build_system.bzl | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index 9194f37a17..571b29cc09 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -37,7 +37,7 @@ def _get_external_deps(external_deps): ret = [] for dep in external_deps: if dep == "nanopb": - ret += ["//third_party/nanopb"] + ret += ["grpc_nanopb"] elif dep == "cares": ret += select({"//:grpc_no_ares": [], "//conditions:default": ["//external:cares"],}) @@ -57,12 +57,6 @@ def _maybe_update_cc_library_hdrs(hdrs): ret.append(h) return ret -def _maybe_update_cc_library_defines(name): - ret = [] - if name == "alts_proto": - ret += ["PB_FIELD_16BIT=1"] - return ret - def grpc_cc_library(name, srcs = [], public_hdrs = [], hdrs = [], external_deps = [], deps = [], standalone = False, language = "C++", testonly = False, visibility = None, @@ -70,11 +64,10 @@ def grpc_cc_library(name, srcs = [], public_hdrs = [], hdrs = [], copts = [] if language.upper() == "C": copts = if_not_windows(["-std=c99"]) - defines = _maybe_update_cc_library_defines(name) native.cc_library( name = name, srcs = srcs, - defines = defines + select({"//:grpc_no_ares": ["GRPC_ARES=0"], + defines = select({"//:grpc_no_ares": ["GRPC_ARES=0"], "//conditions:default": [],}) + select({"//:remote_execution": ["GRPC_PORT_ISOLATED_RUNTIME=1"], "//conditions:default": [],}) + @@ -162,7 +155,23 @@ def grpc_cc_binary(name, srcs = [], deps = [], external_deps = [], args = [], da ) def grpc_generate_one_off_targets(): - pass + native.cc_library( + name = "grpc_nanopb", + hdrs = [ + "//third_party/nanopb:pb.h", + "//third_party/nanopb:pb_common.h", + "//third_party/nanopb:pb_decode.h", + "//third_party/nanopb:pb_encode.h", + ], + srcs = [ + "//third_party/nanopb:pb_common.c", + "//third_party/nanopb:pb_decode.c", + "//third_party/nanopb:pb_encode.c", + ], + defines = [ + "PB_FIELD_16BIT=1", + ], + ) def grpc_sh_test(name, srcs, args = [], data = []): native.sh_test( |