Skip to content

Commit

Permalink
upgrade grpc
Browse files Browse the repository at this point in the history
  • Loading branch information
fishbone committed Feb 22, 2023
1 parent a7098c4 commit 213e8d7
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 45 deletions.
31 changes: 11 additions & 20 deletions bazel/ray_deps_setup.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,14 @@ def ray_deps_setup():
# https://github.com/ray-project/ray/issues/14117
http_archive(
name = "com_google_protobuf",
strip_prefix = "protobuf-3.19.4",
urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.19.4.tar.gz"],
sha256 = "3bd7828aa5af4b13b99c191e8b1e884ebfa9ad371b0ce264605d347f135d2568",
sha256 = "63c5539a8506dc6bccd352a857cea106e0a389ce047a3ff0a78fe3f8fede410d",
strip_prefix = "protobuf-24487dd1045c7f3d64a21f38a3f0c06cc4cf2edb",
urls = [
"https://storage.googleapis.com/grpc-bazel-mirror/github.com/protocolbuffers/protobuf/archive/24487dd1045c7f3d64a21f38a3f0c06cc4cf2edb.tar.gz",
"https://github.com/protocolbuffers/protobuf/archive/24487dd1045c7f3d64a21f38a3f0c06cc4cf2edb.tar.gz",
],
patches = ["@com_github_grpc_grpc//third_party:protobuf.patch"],
patch_args = ["-p1"],
)

# NOTE(lingxuan.zlx): 3rd party dependencies could be accessed, so it suggests
Expand Down Expand Up @@ -238,12 +243,12 @@ def ray_deps_setup():
auto_http_archive(
name = "com_github_grpc_grpc",
# NOTE: If you update this, also update @boringssl's hash.
url = "https://github.com/grpc/grpc/archive/refs/tags/v1.46.6.tar.gz",
sha256 = "6514b3e6eab9e9c7017304512d4420387a47b1a9c5caa986643692977ed44e8a",
url = "https://github.com/grpc/grpc/archive/refs/tags/v1.51.3.tar.gz",
sha256 = "feaeeb315133ea5e3b046c2c0231f5b86ef9d297e536a14b73e0393335f8b157",
patches = [
"@com_github_ray_project_ray//thirdparty/patches:grpc-cython-copts.patch",
"@com_github_ray_project_ray//thirdparty/patches:grpc-python.patch",
],
patch_args = ["-p1"],
)

http_archive(
Expand Down Expand Up @@ -276,20 +281,6 @@ def ray_deps_setup():
url = "https://github.com/bazelbuild/rules_foreign_cc/archive/refs/tags/0.9.0.tar.gz",
)

http_archive(
# This rule is used by @com_github_grpc_grpc, and using a GitHub mirror
# provides a deterministic archive hash for caching. Explanation here:
# https://github.com/grpc/grpc/blob/1ff1feaa83e071d87c07827b0a317ffac673794f/bazel/grpc_deps.bzl#L189
# Ensure this rule matches the rule used by grpc's bazel/grpc_deps.bzl
name = "boringssl",
sha256 = "534fa658bd845fd974b50b10f444d392dfd0d93768c4a51b61263fd37d851c40",
strip_prefix = "boringssl-b9232f9e27e5668bc0414879dcdedb2a59ea75f2",
urls = [
"https://storage.googleapis.com/grpc-bazel-mirror/github.com/google/boringssl/archive/b9232f9e27e5668bc0414879dcdedb2a59ea75f2.tar.gz",
"https://github.com/google/boringssl/archive/b9232f9e27e5668bc0414879dcdedb2a59ea75f2.tar.gz",
],
)

auto_http_archive(
name = "rules_proto_grpc",
url = "https://github.com/rules-proto-grpc/rules_proto_grpc/archive/a74fef39c5fe636580083545f76d1eab74f6450d.tar.gz",
Expand Down
34 changes: 21 additions & 13 deletions thirdparty/patches/grpc-cython-copts.patch
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
diff --git bazel/cython_library.bzl bazel/cython_library.bzl
--- bazel/cython_library.bzl
+++ bazel/cython_library.bzl
@@ -10,15 +10,16 @@
diff --git a/bazel/cython_library.bzl b/bazel/cython_library.bzl
index 8e003c2..41bed38 100644
--- a/bazel/cython_library.bzl
+++ b/bazel/cython_library.bzl
@@ -19,18 +19,19 @@
# been written at cython/cython and tensorflow/tensorflow. We branch from
# Tensorflow's version as it is more actively maintained and works for gRPC
# Python's needs.
-def pyx_library(name, deps = [], py_deps = [], srcs = [], **kwargs):
+def pyx_library(name, deps = [], cc_kwargs = {}, py_deps = [], srcs = [], **kwargs):
"""Compiles a group of .pyx / .pxd / .py files.

First runs Cython to create .cpp files for each input .pyx or .py + .pxd
- pair. Then builds a shared object for each, passing "deps" to each cc_binary
- rule (includes Python headers by default). Finally, creates a py_library rule
Expand All @@ -15,23 +19,27 @@ diff --git bazel/cython_library.bzl bazel/cython_library.bzl
+ to each cc_binary rule (includes Python headers by default). Finally, creates
+ a py_library rule with the shared objects and any pure Python "srcs", with py_deps
+ as its dependencies; the shared objects can be imported like normal Python files.

Args:
name: Name for the rule.
deps: C/C++ dependencies of the Cython (e.g. Numpy headers).
+ cc_kwargs: cc_binary extra arguments such as copts, linkstatic, linkopts, features
@@ -57,7 +59,8 @@ def pyx_library(name, deps = [], py_deps = [], srcs = [], **kwargs):
- shared_object_name = stem + ".so"
+ shared_object_name = stem + ".so"
py_deps: Pure Python dependencies of the final library.
srcs: .py, .pyx, or .pxd files to either compile or pass through.
**kwargs: Extra keyword arguments passed to the py_library.
@@ -69,10 +70,11 @@ def pyx_library(name, deps = [], py_deps = [], srcs = [], **kwargs):
stem = src.split(".")[0]
shared_object_name = stem + ".so"
native.cc_binary(
- name = shared_object_name,
+ name = cc_kwargs.pop("name", shared_object_name),
- srcs = [stem + ".cpp"],
+ srcs = [stem + ".cpp"] + cc_kwargs.pop("srcs", []),
- deps = deps + ["@local_config_python//:python_headers"],
+ deps = deps + ["@local_config_python//:python_headers"] + cc_kwargs.pop("deps", []),
- linkshared = 1,
+ name = cc_kwargs.pop("name", shared_object_name),
+ srcs = [stem + ".cpp"] + cc_kwargs.pop("srcs", []),
+ deps = deps + ["@local_config_python//:python_headers"] + cc_kwargs.pop("deps", []),
+ linkshared = cc_kwargs.pop("linkshared", 1),
+ **cc_kwargs
)
--
shared_objects.append(shared_object_name)

12 changes: 0 additions & 12 deletions thirdparty/patches/grpc-python.patch

This file was deleted.

0 comments on commit 213e8d7

Please sign in to comment.