Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3/3] Bump grpc from 1.26.0 to 1.31.1 #12237

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 61 additions & 40 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,15 @@ distdir_tar(
# protocolbuffers/protobuf
"v3.13.0.tar.gz",
# grpc/grpc
"v1.26.0.tar.gz",
"v1.31.1.tar.gz",
# c-ares/c-ares
"e982924acee7f7313b4baa4ee5ec000c5e373c30.tar.gz",
# protocolbuffers/upb
"9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz",
"92e63da73328d01b417cf26c2de7b0a27a0f83af.tar.gz",
# google/re2
"aecba11114cf1fac5497aeb844b6966106de3eb6.tar.gz",
# abseil/abseil-cpp
"df3ea785d8c30a9503321a3d35ee7d35808f190d.tar.gz",
],
dirname = "derived/distdir",
sha256 = {
Expand Down Expand Up @@ -211,11 +215,15 @@ distdir_tar(
# protocolbuffers/protobuf
"v3.13.0.tar.gz": "9b4ee22c250fe31b16f1a24d61467e40780a3fbb9b91c3b65be2a376ed913a1a",
# grpc/grpc
"v1.26.0.tar.gz": "2fcb7f1ab160d6fd3aaade64520be3e5446fc4c6fa7ba6581afdc4e26094bd81",
"v1.31.1.tar.gz": "f20f92a09f7245e2c437fbd729849ffe3b2dd39a46c9378d201f8f95cc9f12ea",
# c-ares/c-ares
"e982924acee7f7313b4baa4ee5ec000c5e373c30.tar.gz": "e8c2751ddc70fed9dc6f999acd92e232d5846f009ee1674f8aee81f19b2b915a",
# protocolbuffers/upb
"9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz": "61d0417abd60e65ed589c9deee7c124fe76a4106831f6ad39464e1525cef1454",
"92e63da73328d01b417cf26c2de7b0a27a0f83af.tar.gz": "79f7de61203c4ee5e4fcb2f17c5f3338119d6eb94aca8bce05332d2c1cfee108",
# google/re2
"aecba11114cf1fac5497aeb844b6966106de3eb6.tar.gz": "9f385e146410a8150b6f4cb1a57eab7ec806ced48d427554b1e754877ff26c3e",
# abseil/abseil-cpp
"df3ea785d8c30a9503321a3d35ee7d35808f190d.tar.gz": "f368a8476f4e2e0eccf8a7318b98dafbe30b2600f4e3cf52636e5eb145aba06a",
},
urls = {
"e0b0291b2c51fbe5a7cfa14473a1ae850f94f021.zip": [
Expand Down Expand Up @@ -290,19 +298,29 @@ distdir_tar(
"https://github.com/protocolbuffers/protobuf/archive/v3.13.0.tar.gz",
],
# grpc/grpc
"v1.26.0.tar.gz": [
"https://mirror.bazel.build/github.com/grpc/grpc/archive/v1.26.0.tar.gz",
"https://github.com/grpc/grpc/archive/v1.26.0.tar.gz",
"v1.31.1.tar.gz": [
"https://mirror.bazel.build/github.com/grpc/grpc/archive/v1.31.1.tar.gz",
"https://github.com/grpc/grpc/archive/v1.31.1.tar.gz",
],
# c-ares/c-ares
"e982924acee7f7313b4baa4ee5ec000c5e373c30.tar.gz": [
"https://mirror.bazel.build/github.com/c-ares/c-ares/archive/e982924acee7f7313b4baa4ee5ec000c5e373c30.tar.gz",
"https://github.com/c-ares/c-ares/archive/e982924acee7f7313b4baa4ee5ec000c5e373c30.tar.gz",
],
# protocolbuffers/upb
"9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz": [
"https://mirror.bazel.build/github.com/protocolbuffers/upb/archive/9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz",
"https://github.com/protocolbuffers/upb/archive/9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz",
"92e63da73328d01b417cf26c2de7b0a27a0f83af.tar.gz": [
"https://mirror.bazel.build/github.com/protocolbuffers/upb/archive/92e63da73328d01b417cf26c2de7b0a27a0f83af.tar.gz",
"https://github.com/protocolbuffers/upb/archive/92e63da73328d01b417cf26c2de7b0a27a0f83af.tar.gz",
],
# google/re2
"aecba11114cf1fac5497aeb844b6966106de3eb6.tar.gz": [
"https://mirror.bazel.build/github.com/google/re2/archive/aecba11114cf1fac5497aeb844b6966106de3eb6.tar.gz",
"https://github.com/google/re2/archive/aecba11114cf1fac5497aeb844b6966106de3eb6.tar.gz",
],
# abseil/abseil-cpp
"df3ea785d8c30a9503321a3d35ee7d35808f190d.tar.gz": [
"https://mirror.bazel.build/github.com/abseil/abseil-cpp/archive/df3ea785d8c30a9503321a3d35ee7d35808f190d.tar.gz",
"https://github.com/abseil/abseil-cpp/archive/df3ea785d8c30a9503321a3d35ee7d35808f190d.tar.gz",
],
},
)
Expand Down Expand Up @@ -549,11 +567,15 @@ distdir_tar(
# protocolbuffers/protobuf
"v3.13.0.tar.gz",
# grpc/grpc
"v1.26.0.tar.gz",
"v1.31.1.tar.gz",
# c-ares/c-ares
"e982924acee7f7313b4baa4ee5ec000c5e373c30.tar.gz",
# protocolbuffers/upb
"9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz",
"92e63da73328d01b417cf26c2de7b0a27a0f83af.tar.gz",
# google/re2
"aecba11114cf1fac5497aeb844b6966106de3eb6.tar.gz",
# abseil/abseil-cpp
"df3ea785d8c30a9503321a3d35ee7d35808f190d.tar.gz",
],
dirname = "test_WORKSPACE/distdir",
sha256 = {
Expand All @@ -579,11 +601,15 @@ distdir_tar(
# protocolbuffers/protobuf
"v3.13.0.tar.gz": "9b4ee22c250fe31b16f1a24d61467e40780a3fbb9b91c3b65be2a376ed913a1a",
# grpc/grpc
"v1.26.0.tar.gz": "2fcb7f1ab160d6fd3aaade64520be3e5446fc4c6fa7ba6581afdc4e26094bd81",
"v1.31.1.tar.gz": "f20f92a09f7245e2c437fbd729849ffe3b2dd39a46c9378d201f8f95cc9f12ea",
# c-ares/c-ares
"e982924acee7f7313b4baa4ee5ec000c5e373c30.tar.gz": "e8c2751ddc70fed9dc6f999acd92e232d5846f009ee1674f8aee81f19b2b915a",
# protocolbuffers/upb
"9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz": "61d0417abd60e65ed589c9deee7c124fe76a4106831f6ad39464e1525cef1454",
"92e63da73328d01b417cf26c2de7b0a27a0f83af.tar.gz": "79f7de61203c4ee5e4fcb2f17c5f3338119d6eb94aca8bce05332d2c1cfee108",
# google/re2
"aecba11114cf1fac5497aeb844b6966106de3eb6.tar.gz": "9f385e146410a8150b6f4cb1a57eab7ec806ced48d427554b1e754877ff26c3e",
# abseil/abseil-cpp
"df3ea785d8c30a9503321a3d35ee7d35808f190d.tar.gz": "f368a8476f4e2e0eccf8a7318b98dafbe30b2600f4e3cf52636e5eb145aba06a",
},
urls = {
"java_tools_javac11_linux-v10.0.zip": ["https://mirror.bazel.build/bazel_java_tools/releases/javac11/v10.0/java_tools_javac11_linux-v10.0.zip"],
Expand Down Expand Up @@ -628,19 +654,29 @@ distdir_tar(
"https://github.com/protocolbuffers/protobuf/archive/v3.13.0.tar.gz",
],
# grpc/grpc
"v1.26.0.tar.gz": [
"https://mirror.bazel.build/github.com/grpc/grpc/archive/v1.26.0.tar.gz",
"https://github.com/grpc/grpc/archive/v1.26.0.tar.gz",
"v1.31.1.tar.gz": [
"https://mirror.bazel.build/github.com/grpc/grpc/archive/v1.31.1.tar.gz",
"https://github.com/grpc/grpc/archive/v1.31.1.tar.gz",
],
# c-ares/c-ares
"e982924acee7f7313b4baa4ee5ec000c5e373c30.tar.gz": [
"https://mirror.bazel.build/github.com/c-ares/c-ares/archive/e982924acee7f7313b4baa4ee5ec000c5e373c30.tar.gz",
"https://github.com/c-ares/c-ares/archive/e982924acee7f7313b4baa4ee5ec000c5e373c30.tar.gz",
],
# protocolbuffers/upb
"9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz": [
"https://mirror.bazel.build/github.com/protocolbuffers/upb/archive/9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz",
"https://github.com/protocolbuffers/upb/archive/9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz",
"92e63da73328d01b417cf26c2de7b0a27a0f83af.tar.gz": [
"https://mirror.bazel.build/github.com/protocolbuffers/upb/archive/92e63da73328d01b417cf26c2de7b0a27a0f83af.tar.gz",
"https://github.com/protocolbuffers/upb/archive/92e63da73328d01b417cf26c2de7b0a27a0f83af.tar.gz",
],
# google/re2
"aecba11114cf1fac5497aeb844b6966106de3eb6.tar.gz": [
"https://mirror.bazel.build/github.com/google/re2/archive/aecba11114cf1fac5497aeb844b6966106de3eb6.tar.gz",
"https://github.com/google/re2/archive/aecba11114cf1fac5497aeb844b6966106de3eb6.tar.gz",
],
# abseil/abseil-cpp
"df3ea785d8c30a9503321a3d35ee7d35808f190d.tar.gz": [
"https://mirror.bazel.build/github.com/abseil/abseil-cpp/archive/df3ea785d8c30a9503321a3d35ee7d35808f190d.tar.gz",
"https://github.com/abseil/abseil-cpp/archive/df3ea785d8c30a9503321a3d35ee7d35808f190d.tar.gz",
],
},
)
Expand Down Expand Up @@ -1022,30 +1058,15 @@ register_local_rc_exe_toolchains()

register_toolchains("//src/main/res:empty_rc_toolchain")

# Patch upb for grpc due to https://github.com/bazelbuild/bazel/issues/12056
# TODO: Remove the following after upgrading grpc to a newer version that's not
# affected by this issue.
http_archive(
name = "upb",
patch_args = ["-p1"],
patches = ["//third_party/grpc:upb_gcc10_fix.patch"],
sha256 = "61d0417abd60e65ed589c9deee7c124fe76a4106831f6ad39464e1525cef1454",
strip_prefix = "upb-9effcbcb27f0a665f9f345030188c0b291e32482",
urls = [
"https://mirror.bazel.build/github.com/protocolbuffers/upb/archive/9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz",
"https://github.com/protocolbuffers/upb/archive/9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz",
],
)

http_archive(
name = "com_github_grpc_grpc",
patch_args = ["-p1"],
patches = ["//third_party/grpc:grpc_1.26.0.patch"],
sha256 = "2fcb7f1ab160d6fd3aaade64520be3e5446fc4c6fa7ba6581afdc4e26094bd81",
strip_prefix = "grpc-1.26.0",
patches = ["//third_party/grpc:grpc_1.31.1.patch"],
sha256 = "f20f92a09f7245e2c437fbd729849ffe3b2dd39a46c9378d201f8f95cc9f12ea",
strip_prefix = "grpc-1.31.1",
urls = [
"https://mirror.bazel.build/github.com/grpc/grpc/archive/v1.26.0.tar.gz",
"https://github.com/grpc/grpc/archive/v1.26.0.tar.gz",
"https://mirror.bazel.build/github.com/grpc/grpc/archive/v1.31.1.tar.gz",
"https://github.com/grpc/grpc/archive/v1.31.1.tar.gz",
],
)

Expand Down
2 changes: 1 addition & 1 deletion third_party/grpc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ load("//tools/distributions:distribution_rules.bzl", "distrib_java_import", "dis

licenses(["notice"]) # Apache v2

exports_files(["grpc_1.26.0.patch", "upb_gcc10_fix.patch"])
exports_files(["grpc_1.31.1.patch"])

package(default_visibility = ["//visibility:public"])

Expand Down
6 changes: 3 additions & 3 deletions third_party/grpc/README.bazel.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# How to update the C++ sources of gRPC:

1. Update the gRPC definitions in WORKSPACE file, currently we use
https://github.com/grpc/grpc/archive/v1.26.0.tar.gz
https://github.com/grpc/grpc/archive/v1.31.1.tar.gz
2. Update the gRPC patch file if necessary, it mostly helps avoid unnecessary dependencies.
3. Update third_party/grpc/BUILD to redirect targets to @com_github_grpc_grpc if necessary.

# How to update the BUILD/bzl sources of gRPC:

1. `git clone http://github.com/grpc/grpc.git` in a convenient directory
2. `git checkout <tag>` (current is `v1.26.0`, commithash `de893acb`)
2. `git checkout <tag>` (current is `v1.31.1`, commithash `7d7e456762`)
3. `mkdir -p third_party/grpc/bazel`
4. `cp <gRPC git tree>/bazel/{BUILD,cc_grpc_library.bzl,generate_cc.bzl,protobuf.bzl} third_party/grpc/bazel`
5. In the `third_party/grpc` directory, apply local patches:
`patch -p3 < bazel.patch`
`patch -p3 < bazel_1.31.1.patch`

# How to update the Java plugin:

Expand Down
1 change: 1 addition & 0 deletions third_party/grpc/bazel/generate_cc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ This is an internal rule used by cc_grpc_library, and shouldn't be used
directly.
"""

load("@rules_proto//proto:defs.bzl", "ProtoInfo")
load(
":protobuf.bzl",
"get_include_directory",
Expand Down
2 changes: 2 additions & 0 deletions third_party/grpc/bazel/protobuf.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Utility functions for generating protobuf code."""

load("@rules_proto//proto:defs.bzl", "ProtoInfo")

_PROTO_EXTENSION = ".proto"
_VIRTUAL_IMPORTS = "/_virtual_imports/"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ diff --git a/third_party/grpc/bazel/BUILD b/third_party/grpc/bazel/BUILD
index c3c82c9c0c..6f451a6f24 100644
--- a/third_party/grpc/bazel/BUILD
+++ b/third_party/grpc/bazel/BUILD
@@ -17,3 +17,8 @@ licenses(["notice"]) # Apache v2
@@ -17,3 +17,18 @@ licenses(["notice"]) # Apache v2
package(default_visibility = ["//:__subpackages__"])

load(":cc_grpc_library.bzl", "cc_grpc_library")
Expand All @@ -40,13 +40,24 @@ index c3c82c9c0c..6f451a6f24 100644
+ name = "srcs",
+ srcs = glob(["**"]),
+)
+
+filegroup(
+ name = "embedded_tools_srcs",
+ srcs = [
+ "BUILD.tools",
+ "cc_grpc_library.bzl",
+ "generate_cc.bzl",
+ "protobuf.bzl",
+ ],
+)
diff --git a/third_party/grpc/bazel/cc_grpc_library.bzl b/third_party/grpc/bazel/cc_grpc_library.bzl
index dea493eaf2..0470a294fc 100644
--- a/third_party/grpc/bazel/cc_grpc_library.bzl
+++ b/third_party/grpc/bazel/cc_grpc_library.bzl
@@ -1,105 +1,58 @@
"""Generates and compiles C++ grpc stubs from proto_library rules."""

-load("@rules_proto//proto:defs.bzl", "proto_library")
-load("//bazel:generate_cc.bzl", "generate_cc")
-load("//bazel:protobuf.bzl", "well_known_proto_libs")
+load(":generate_cc.bzl", "generate_cc")
Expand Down Expand Up @@ -127,8 +138,7 @@ index dea493eaf2..0470a294fc 100644
- proto_deps += [dep.split(":")[0] + ":" + "_" + dep.split(":")[1] + "_only" for dep in deps if dep.find(":") != -1]
- if well_known_protos:
- proto_deps += well_known_proto_libs()
-
- native.proto_library(
- proto_library(
- name = proto_target,
- srcs = srcs,
- deps = proto_deps,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ index 7bb6b8bdb9..7644107b70 100644
+ # deps = ios_test_deps,
+ # )

def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data = [], uses_polling = True, language = "C++", size = "medium", timeout = None, tags = [], exec_compatible_with = [], exec_properties = {}, shard_count = None):
def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data = [], uses_polling = True, language = "C++", size = "medium", timeout = None, tags = [], exec_compatible_with = [], exec_properties = {}, shard_count = None, flaky = None):
copts = if_mac(["-DGRPC_CFSTREAM"])
diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl
index 09fcad95a2..9b737e5deb 100644
Expand All @@ -56,30 +56,6 @@ index 09fcad95a2..9b737e5deb 100644
)

native.bind(
@@ -164,7 +164,10 @@ def grpc_deps():
build_file = "@com_github_grpc_grpc//third_party:cares/cares.BUILD",
sha256 = "e8c2751ddc70fed9dc6f999acd92e232d5846f009ee1674f8aee81f19b2b915a",
strip_prefix = "c-ares-e982924acee7f7313b4baa4ee5ec000c5e373c30",
- url = "https://github.com/c-ares/c-ares/archive/e982924acee7f7313b4baa4ee5ec000c5e373c30.tar.gz",
+ urls = [
+ "https://mirror.bazel.build/github.com/c-ares/c-ares/archive/e982924acee7f7313b4baa4ee5ec000c5e373c30.tar.gz",
+ "https://github.com/c-ares/c-ares/archive/e982924acee7f7313b4baa4ee5ec000c5e373c30.tar.gz",
+ ],
)

if "com_google_absl" not in native.existing_rules():
@@ -209,7 +212,10 @@ def grpc_deps():
name = "upb",
sha256 = "61d0417abd60e65ed589c9deee7c124fe76a4106831f6ad39464e1525cef1454",
strip_prefix = "upb-9effcbcb27f0a665f9f345030188c0b291e32482",
- url = "https://github.com/protocolbuffers/upb/archive/9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz",
+ urls = [
+ "https://mirror.bazel.build/github.com/protocolbuffers/upb/archive/9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz",
+ "https://github.com/protocolbuffers/upb/archive/9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz",
+ ],
)
if "envoy_api" not in native.existing_rules():
http_archive(
diff --git a/bazel/grpc_extra_deps.bzl b/bazel/grpc_extra_deps.bzl
index 4c1dfad2e8..f63c54ddef 100644
--- a/bazel/grpc_extra_deps.bzl
Expand Down
51 changes: 0 additions & 51 deletions third_party/grpc/upb_gcc10_fix.patch

This file was deleted.