diff options
Diffstat (limited to 'bazel')
-rw-r--r-- | bazel/cc_grpc_library.bzl | 17 | ||||
-rw-r--r-- | bazel/grpc_build_system.bzl | 29 | ||||
-rw-r--r-- | bazel/grpc_deps.bzl | 26 |
3 files changed, 29 insertions, 43 deletions
diff --git a/bazel/cc_grpc_library.bzl b/bazel/cc_grpc_library.bzl index 5216a7a44b..3288565714 100644 --- a/bazel/cc_grpc_library.bzl +++ b/bazel/cc_grpc_library.bzl @@ -43,12 +43,7 @@ def cc_grpc_library(name, srcs, deps, proto_only, well_known_protos, generate_mo ) if not proto_only: - if use_external: - # when this file is used by non-grpc projects - plugin = "//external:grpc_cpp_plugin" - else: - plugin = "//:grpc_cpp_plugin" - + plugin = "@com_github_grpc_grpc//:grpc_cpp_plugin" generate_cc( name = codegen_grpc_target, srcs = [proto_target], @@ -57,14 +52,8 @@ def cc_grpc_library(name, srcs, deps, proto_only, well_known_protos, generate_mo generate_mocks = generate_mocks, **kwargs ) - - if use_external: - # when this file is used by non-grpc projects - grpc_deps = ["//external:grpc++_codegen_proto", - "//external:protobuf"] - else: - grpc_deps = ["//:grpc++_codegen_proto", "//external:protobuf"] - + grpc_deps = ["@com_github_grpc_grpc//:grpc++_codegen_proto", + "//external:protobuf"] native.cc_library( name = name, srcs = [":" + codegen_grpc_target, ":" + codegen_target], diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index 095b1596c8..73147bf3ac 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -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": [], @@ -62,7 +60,7 @@ def _maybe_update_cc_library_hdrs(hdrs): def grpc_cc_library(name, srcs = [], public_hdrs = [], hdrs = [], external_deps = [], deps = [], standalone = False, language = "C++", testonly = False, visibility = None, - alwayslink = 0): + alwayslink = 0, data = []): copts = [] if language.upper() == "C": copts = if_not_windows(["-std=c99"]) @@ -87,6 +85,7 @@ def grpc_cc_library(name, srcs = [], public_hdrs = [], hdrs = [], "include" ], alwayslink = alwayslink, + data = data, ) def grpc_proto_plugin(name, srcs = [], deps = []): @@ -110,7 +109,7 @@ def grpc_proto_library(name, srcs = [], deps = [], well_known_protos = False, generate_mocks = generate_mocks, ) -def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data = [], uses_polling = True, language = "C++", size = "medium", timeout = "moderate"): +def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data = [], uses_polling = True, language = "C++", size = "medium", timeout = "moderate", tags = []): copts = [] if language.upper() == "C": copts = if_not_windows(["-std=c99"]) @@ -140,6 +139,7 @@ def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data poller, '$(location %s)' % name, ] + args['args'], + tags = tags, ) else: native.cc_test(**args) @@ -160,24 +160,7 @@ 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_generate_one_off_targets(): pass def grpc_sh_test(name, srcs, args = [], data = []): native.sh_test( diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl index 1e3d83d06a..f7e62f1219 100644 --- a/bazel/grpc_deps.bzl +++ b/bazel/grpc_deps.bzl @@ -2,6 +2,12 @@ def grpc_deps(): """Loads dependencies need to compile and test the grpc library.""" + + native.bind( + name = "nanopb", + actual = "@com_github_nanopb_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(): @@ -87,6 +93,14 @@ def grpc_deps(): name = "com_google_protobuf", strip_prefix = "protobuf-b5fbb742af122b565925987e65c08957739976a7", url = "https://github.com/google/protobuf/archive/b5fbb742af122b565925987e65c08957739976a7.tar.gz", + ) + + if "com_github_nanopb_nanopb" not in native.existing_rules(): + native.new_http_archive( + name = "com_github_nanopb_nanopb", + build_file = "@com_github_grpc_grpc//third_party:nanopb.BUILD", + strip_prefix = "nanopb-f8ac463766281625ad710900479130c7fcb4d63b", + url = "https://github.com/nanopb/nanopb/archive/f8ac463766281625ad710900479130c7fcb4d63b.tar.gz", ) if "com_github_google_googletest" not in native.existing_rules(): @@ -130,12 +144,12 @@ def grpc_deps(): if "com_github_bazelbuild_bazeltoolchains" not in native.existing_rules(): native.http_archive( name = "com_github_bazelbuild_bazeltoolchains", - strip_prefix = "bazel-toolchains-44200e0c026d86c53470d107b3697a3e46469c43", + strip_prefix = "bazel-toolchains-4653c01284d8a4a536f8f9bb47b7d10f94c549e7", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/44200e0c026d86c53470d107b3697a3e46469c43.tar.gz", - "https://github.com/bazelbuild/bazel-toolchains/archive/44200e0c026d86c53470d107b3697a3e46469c43.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/4653c01284d8a4a536f8f9bb47b7d10f94c549e7.tar.gz", + "https://github.com/bazelbuild/bazel-toolchains/archive/4653c01284d8a4a536f8f9bb47b7d10f94c549e7.tar.gz", ], - sha256 = "699b55a6916c687f4b7dc092dbbf5f64672cde0dc965f79717735ec4e5416556", + sha256 = "1c4a532b396c698e6467a1548554571cb85fa091e472b05e398ebc836c315d77", ) # TODO: move some dependencies from "grpc_deps" here? |