Treat nanopb as a regular external dep

pull/15595/head
David Garcia Quintas 7 years ago
parent 2a0d447d27
commit 483b4b7bde
  1. 3
      BUILD
  2. 23
      bazel/grpc_build_system.bzl
  3. 10
      bazel/grpc_deps.bzl
  4. 29
      third_party/nanopb/BUILD

@ -30,7 +30,6 @@ load(
"//bazel:grpc_build_system.bzl",
"grpc_cc_library",
"grpc_proto_plugin",
"grpc_generate_one_off_targets",
)
config_setting(
@ -1969,5 +1968,3 @@ grpc_cc_library(
"//src/proto/grpc/core:stats_proto",
],
)
grpc_generate_one_off_targets()

@ -36,9 +36,7 @@ def if_not_windows(a):
def _get_external_deps(external_deps):
ret = []
for dep in external_deps:
if dep == "nanopb":
ret += ["grpc_nanopb"]
elif dep == "address_sorting":
if dep == "address_sorting":
ret += ["//third_party/address_sorting"]
elif dep == "cares":
ret += select({"//:grpc_no_ares": [],
@ -160,25 +158,6 @@ def grpc_cc_binary(name, srcs = [], deps = [], external_deps = [], args = [], da
linkopts = if_not_windows(["-pthread"]) + linkopts,
)
def grpc_generate_one_off_targets():
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(
name = name,

@ -2,6 +2,12 @@
def grpc_deps():
"""Loads dependencies need to compile and test the grpc library."""
native.bind(
name = "nanopb",
actual = "@com_github_grpc_grpc//third_party/nanopb:nanopb",
)
native.bind(
name = "libssl",
actual = "@boringssl//:ssl",
@ -59,12 +65,12 @@ def grpc_deps():
native.bind(
name = "grpc_cpp_plugin",
actual = "@com_github_grpc_grpc//:grpc_cpp_plugin"
actual = "@com_github_grpc_grpc//:grpc_cpp_plugin",
)
native.bind(
name = "grpc++_codegen_proto",
actual = "@com_github_grpc_grpc//:grpc++_codegen_proto"
actual = "@com_github_grpc_grpc//:grpc++_codegen_proto",
)
if "boringssl" not in native.existing_rules():

@ -5,17 +5,20 @@ exports_files(["LICENSE.txt"])
package(default_visibility = ["//visibility:public"])
cc_library(
name = "nanopb",
visibility = ["//visibility:public"],
hdrs = [
"pb.h",
"pb_common.h",
"pb_decode.h",
"pb_encode.h",
],
srcs = [
"pb_common.c",
"pb_decode.c",
"pb_encode.c",
],
name = "nanopb",
srcs = [
"pb_common.c",
"pb_decode.c",
"pb_encode.c",
],
hdrs = [
"pb.h",
"pb_common.h",
"pb_decode.h",
"pb_encode.h",
],
defines = [
"PB_FIELD_32BIT=1",
],
visibility = ["//visibility:public"],
)

Loading…
Cancel
Save