mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-16 01:07:29 +00:00
[grpc] Support latest version of grpc PoC (#6338)
* use grpcpp rather than deprecated grpc++ * grpcpp Deserialize take ByteBuffer instead of grpc_byte_buffer * grpc 1.36.0 * Fix to use grpc 1.36.0 * Fix CMakeLists to refer gRPC * add find_package(Threads) * Update bazel deps * Apply workaround about boringssl build error * Install latest cmake for osx on travis-ci Co-authored-by: Yeom Gyusun <omniavinco@gmail.com>
This commit is contained in:
@@ -1,155 +0,0 @@
|
||||
diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl
|
||||
index 4096720569..ea411b577d 100644
|
||||
--- a/bazel/grpc_deps.bzl
|
||||
+++ b/bazel/grpc_deps.bzl
|
||||
@@ -1,5 +1,10 @@
|
||||
"""Load dependencies needed to compile and test the grpc library as a 3rd-party consumer."""
|
||||
|
||||
+# native.http_archive has been deprecated in newer bazel version. In order to work with
|
||||
+# grpc 1.15.1, the version flatbuffers is currently replying on. We need to apply this patch
|
||||
+# when importing the grpc dependency.
|
||||
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
+
|
||||
def grpc_deps():
|
||||
"""Loads dependencies need to compile and test the grpc library."""
|
||||
|
||||
@@ -99,14 +104,14 @@ def grpc_deps():
|
||||
)
|
||||
|
||||
if "boringssl" not in native.existing_rules():
|
||||
- native.http_archive(
|
||||
+ http_archive(
|
||||
name = "boringssl",
|
||||
# on the chromium-stable-with-bazel branch
|
||||
url = "https://boringssl.googlesource.com/boringssl/+archive/dcd3e6e6ecddf059adb48fca45bc7346a108bdd9.tar.gz",
|
||||
)
|
||||
|
||||
if "com_github_madler_zlib" not in native.existing_rules():
|
||||
- native.new_http_archive(
|
||||
+ http_archive(
|
||||
name = "com_github_madler_zlib",
|
||||
build_file = "@com_github_grpc_grpc//third_party:zlib.BUILD",
|
||||
strip_prefix = "zlib-cacf7f1d4e3d44d871b605da3b647f07d718623f",
|
||||
@@ -114,14 +119,14 @@ def grpc_deps():
|
||||
)
|
||||
|
||||
if "com_google_protobuf" not in native.existing_rules():
|
||||
- native.http_archive(
|
||||
+ http_archive(
|
||||
name = "com_google_protobuf",
|
||||
strip_prefix = "protobuf-48cb18e5c419ddd23d9badcfe4e9df7bde1979b2",
|
||||
url = "https://github.com/google/protobuf/archive/48cb18e5c419ddd23d9badcfe4e9df7bde1979b2.tar.gz",
|
||||
)
|
||||
|
||||
if "com_github_nanopb_nanopb" not in native.existing_rules():
|
||||
- native.new_http_archive(
|
||||
+ http_archive(
|
||||
name = "com_github_nanopb_nanopb",
|
||||
build_file = "@com_github_grpc_grpc//third_party:nanopb.BUILD",
|
||||
strip_prefix = "nanopb-f8ac463766281625ad710900479130c7fcb4d63b",
|
||||
@@ -129,7 +134,7 @@ def grpc_deps():
|
||||
)
|
||||
|
||||
if "com_github_google_googletest" not in native.existing_rules():
|
||||
- native.new_http_archive(
|
||||
+ http_archive(
|
||||
name = "com_github_google_googletest",
|
||||
build_file = "@com_github_grpc_grpc//third_party:gtest.BUILD",
|
||||
strip_prefix = "googletest-ec44c6c1675c25b9827aacd08c02433cccde7780",
|
||||
@@ -137,14 +142,14 @@ def grpc_deps():
|
||||
)
|
||||
|
||||
if "com_github_gflags_gflags" not in native.existing_rules():
|
||||
- native.http_archive(
|
||||
+ http_archive(
|
||||
name = "com_github_gflags_gflags",
|
||||
strip_prefix = "gflags-30dbc81fb5ffdc98ea9b14b1918bfe4e8779b26e",
|
||||
url = "https://github.com/gflags/gflags/archive/30dbc81fb5ffdc98ea9b14b1918bfe4e8779b26e.tar.gz",
|
||||
)
|
||||
|
||||
if "com_github_google_benchmark" not in native.existing_rules():
|
||||
- native.new_http_archive(
|
||||
+ http_archive(
|
||||
name = "com_github_google_benchmark",
|
||||
build_file = "@com_github_grpc_grpc//third_party:benchmark.BUILD",
|
||||
strip_prefix = "benchmark-9913418d323e64a0111ca0da81388260c2bbe1e9",
|
||||
@@ -152,7 +157,7 @@ def grpc_deps():
|
||||
)
|
||||
|
||||
if "com_github_cares_cares" not in native.existing_rules():
|
||||
- native.new_http_archive(
|
||||
+ http_archive(
|
||||
name = "com_github_cares_cares",
|
||||
build_file = "@com_github_grpc_grpc//third_party:cares/cares.BUILD",
|
||||
strip_prefix = "c-ares-3be1924221e1326df520f8498d704a5c4c8d0cce",
|
||||
@@ -160,14 +165,14 @@ def grpc_deps():
|
||||
)
|
||||
|
||||
if "com_google_absl" not in native.existing_rules():
|
||||
- native.http_archive(
|
||||
+ http_archive(
|
||||
name = "com_google_absl",
|
||||
strip_prefix = "abseil-cpp-cd95e71df6eaf8f2a282b1da556c2cf1c9b09207",
|
||||
url = "https://github.com/abseil/abseil-cpp/archive/cd95e71df6eaf8f2a282b1da556c2cf1c9b09207.tar.gz",
|
||||
)
|
||||
|
||||
if "com_github_bazelbuild_bazeltoolchains" not in native.existing_rules():
|
||||
- native.http_archive(
|
||||
+ http_archive(
|
||||
name = "com_github_bazelbuild_bazeltoolchains",
|
||||
strip_prefix = "bazel-toolchains-cdea5b8675914d0a354d89f108de5d28e54e0edc",
|
||||
urls = [
|
||||
@@ -178,7 +183,7 @@ def grpc_deps():
|
||||
)
|
||||
|
||||
if "io_opencensus_cpp" not in native.existing_rules():
|
||||
- native.http_archive(
|
||||
+ http_archive(
|
||||
name = "io_opencensus_cpp",
|
||||
strip_prefix = "opencensus-cpp-fdf0f308b1631bb4a942e32ba5d22536a6170274",
|
||||
url = "https://github.com/census-instrumentation/opencensus-cpp/archive/fdf0f308b1631bb4a942e32ba5d22536a6170274.tar.gz",
|
||||
@@ -200,7 +205,7 @@ def grpc_test_only_deps():
|
||||
)
|
||||
|
||||
if "com_github_twisted_twisted" not in native.existing_rules():
|
||||
- native.new_http_archive(
|
||||
+ http_archive(
|
||||
name = "com_github_twisted_twisted",
|
||||
strip_prefix = "twisted-twisted-17.5.0",
|
||||
url = "https://github.com/twisted/twisted/archive/twisted-17.5.0.zip",
|
||||
@@ -208,7 +213,7 @@ def grpc_test_only_deps():
|
||||
)
|
||||
|
||||
if "com_github_yaml_pyyaml" not in native.existing_rules():
|
||||
- native.new_http_archive(
|
||||
+ http_archive(
|
||||
name = "com_github_yaml_pyyaml",
|
||||
strip_prefix = "pyyaml-3.12",
|
||||
url = "https://github.com/yaml/pyyaml/archive/3.12.zip",
|
||||
@@ -216,7 +221,7 @@ def grpc_test_only_deps():
|
||||
)
|
||||
|
||||
if "com_github_twisted_incremental" not in native.existing_rules():
|
||||
- native.new_http_archive(
|
||||
+ http_archive(
|
||||
name = "com_github_twisted_incremental",
|
||||
strip_prefix = "incremental-incremental-17.5.0",
|
||||
url = "https://github.com/twisted/incremental/archive/incremental-17.5.0.zip",
|
||||
@@ -224,7 +229,7 @@ def grpc_test_only_deps():
|
||||
)
|
||||
|
||||
if "com_github_zopefoundation_zope_interface" not in native.existing_rules():
|
||||
- native.new_http_archive(
|
||||
+ http_archive(
|
||||
name = "com_github_zopefoundation_zope_interface",
|
||||
strip_prefix = "zope.interface-4.4.3",
|
||||
url = "https://github.com/zopefoundation/zope.interface/archive/4.4.3.zip",
|
||||
@@ -232,7 +237,7 @@ def grpc_test_only_deps():
|
||||
)
|
||||
|
||||
if "com_github_twisted_constantly" not in native.existing_rules():
|
||||
- native.new_http_archive(
|
||||
+ http_archive(
|
||||
name = "com_github_twisted_constantly",
|
||||
strip_prefix = "constantly-15.1.0",
|
||||
url = "https://github.com/twisted/constantly/archive/15.1.0.zip",
|
||||
@@ -1,48 +0,0 @@
|
||||
diff --git a/bazel/cc_grpc_library.bzl b/bazel/cc_grpc_library.bzl
|
||||
index 3288565714..6bfcd653f5 100644
|
||||
--- a/bazel/cc_grpc_library.bzl
|
||||
+++ b/bazel/cc_grpc_library.bzl
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Generates and compiles C++ grpc stubs from proto_library rules."""
|
||||
|
||||
-load("//:bazel/generate_cc.bzl", "generate_cc")
|
||||
+load("//bazel:generate_cc.bzl", "generate_cc")
|
||||
|
||||
def cc_grpc_library(name, srcs, deps, proto_only, well_known_protos, generate_mocks = False, use_external = False, **kwargs):
|
||||
"""Generates C++ grpc classes from a .proto file.
|
||||
diff --git a/bazel/generate_cc.bzl b/bazel/generate_cc.bzl
|
||||
index ae747aa42c..2f14071f92 100644
|
||||
--- a/bazel/generate_cc.bzl
|
||||
+++ b/bazel/generate_cc.bzl
|
||||
@@ -83,7 +83,7 @@ _generate_cc = rule(
|
||||
attrs = {
|
||||
"srcs": attr.label_list(
|
||||
mandatory = True,
|
||||
- non_empty = True,
|
||||
+ allow_empty = False,
|
||||
providers = ["proto"],
|
||||
),
|
||||
"plugin": attr.label(
|
||||
diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl
|
||||
index 73147bf3ac..e8c392aa93 100644
|
||||
--- a/bazel/grpc_build_system.bzl
|
||||
+++ b/bazel/grpc_build_system.bzl
|
||||
@@ -24,6 +24,9 @@
|
||||
#
|
||||
|
||||
# The set of pollers to test against if a test exercises polling
|
||||
+
|
||||
+load("//bazel:cc_grpc_library.bzl", "cc_grpc_library")
|
||||
+
|
||||
POLLERS = ['epollex', 'epollsig', 'epoll1', 'poll', 'poll-cv']
|
||||
|
||||
def if_not_windows(a):
|
||||
@@ -95,8 +98,6 @@ def grpc_proto_plugin(name, srcs = [], deps = []):
|
||||
deps = deps,
|
||||
)
|
||||
|
||||
-load("//:bazel/cc_grpc_library.bzl", "cc_grpc_library")
|
||||
-
|
||||
def grpc_proto_library(name, srcs = [], deps = [], well_known_protos = False,
|
||||
has_services = True, use_external = False, generate_mocks = False):
|
||||
cc_grpc_library(
|
||||
@@ -1,24 +0,0 @@
|
||||
diff --git a/protobuf.bzl b/protobuf.bzl
|
||||
index 78f19c621..3b6d183b9 100644
|
||||
--- a/protobuf.bzl
|
||||
+++ b/protobuf.bzl
|
||||
@@ -130,7 +130,7 @@ proto_gen = rule(
|
||||
"protoc": attr.label(
|
||||
cfg = "host",
|
||||
executable = True,
|
||||
- single_file = True,
|
||||
+ allow_single_file = True,
|
||||
mandatory = True,
|
||||
),
|
||||
"plugin": attr.label(
|
||||
@@ -266,8 +266,8 @@ def internal_gen_well_known_protos_java(srcs):
|
||||
Args:
|
||||
srcs: the well known protos
|
||||
"""
|
||||
- root = Label("%s//protobuf_java" % (REPOSITORY_NAME)).workspace_root
|
||||
- pkg = PACKAGE_NAME + "/" if PACKAGE_NAME else ""
|
||||
+ root = Label("%s//protobuf_java" % (native.repository_name())).workspace_root
|
||||
+ pkg = native.package_name() + "/" if native.package_name() else ""
|
||||
if root == "":
|
||||
include = " -I%ssrc " % pkg
|
||||
else:
|
||||
Reference in New Issue
Block a user