Skip to content

Commit 82dee55

Browse files
authored
Update Grpc to 1.10.1 (#212)
* Update grpc to 1.10.1 - Remove grpc_repository.bzl. This was previously used to eliminate grpc/grpc additional to submodules and c-ares issues, which is now improved in source repo. - Add grpc_archive.bzl. We still need to patch the generate_cc.bzl file (should probably just upstream this change there). - Remove previous references to @com_google_grpc. - Update boringssl. Fixes #187 * Update to grpc v1.10.1 * Update major deps in README * Preserve com_google_grpc alias to com_github_grpc_grpc The grpc repository continues to not compile correctly as an external repo (reflection++). Still need the grpc_archive construct that replaces out the generate_cc.bzl file * Use bazel instead of bzl-io/bzl tool * Try grpc tar.gz (for failing travis error)
1 parent ceb15c9 commit 82dee55

11 files changed

+239
-178
lines changed

DEPENDENCIES.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,18 @@ To update this list, `bazel build @org_pubref_rules_protobuf//:deps && cp bazel-
1010
| [bind](https://docs.bazel.build/versions/master/be/workspace.html#bind) | **`@protocol_compiler`** | `//external:protocol_compiler` (`@com_google_protobuf//:protoc`) |
1111
| [bind](https://docs.bazel.build/versions/master/be/workspace.html#bind) | **`@protobuf`** | `//external:protobuf` (`@com_google_protobuf//:protobuf`) |
1212
| [bind](https://docs.bazel.build/versions/master/be/workspace.html#bind) | **`@protobuf_clib`** | `//external:protobuf_clib` (`@com_google_protobuf//:protoc_lib`) |
13+
| [bind](https://docs.bazel.build/versions/master/be/workspace.html#bind) | **`@protobuf_headers`** | `//external:protobuf_headers` (`@com_google_protobuf//:protobuf_headers`) |
1314

1415
## C++
1516

1617
| Rule | Workspace | Detail |
1718
| ---: | :--- | :--- |
18-
| [http_archive](https://docs.bazel.build/versions/master/be/workspace.html#http_archive) | **`@com_google_grpc_base`** | [sha256:d3794ca4ff7b](https://github.com/grpc/grpc/archive/ca87867579580928ca4c9fdf97051fa25bf1d386.zip) |
19-
| grpc_repository | **`@com_google_grpc`** | |
20-
| [new_http_archive](https://docs.bazel.build/versions/master/be/workspace.html#new_http_archive) | **`@com_github_c_ares_c_ares`** | [sha256:ddce8def076a](https://github.com/c-ares/c-ares/archive/7691f773af79bf75a62d1863fd0f13ebf9dc51b1.zip) |
21-
| grpc_repository | **`@com_github_grpc_grpc`** | |
22-
| [http_archive](https://docs.bazel.build/versions/master/be/workspace.html#http_archive) | **`@boringssl`** | [(no hash provided)](https://boringssl.googlesource.com/boringssl/+archive/74ffd81aa7ec3d0aa3d3d820dbeda934958ca81a.tar.gz) |
19+
| grpc_archive | **`@com_google_grpc`** | |
20+
| [http_archive](https://docs.bazel.build/versions/master/be/workspace.html#http_archive) | **`@boringssl`** | [(no hash provided)](https://boringssl.googlesource.com/boringssl/+archive/886e7d75368e3f4fab3f4d0d3584e4abfc557755.tar.gz) |
2321
| [bind](https://docs.bazel.build/versions/master/be/workspace.html#bind) | **`@libssl`** | `//external:libssl` (`@boringssl//:ssl`) |
2422
| [new_http_archive](https://docs.bazel.build/versions/master/be/workspace.html#new_http_archive) | **`@com_github_madler_zlib`** | [sha256:1cce3828ec2b](https://github.com/madler/zlib/archive/cacf7f1d4e3d44d871b605da3b647f07d718623f.zip) |
25-
| [bind](https://docs.bazel.build/versions/master/be/workspace.html#bind) | **`@cares`** | `//external:cares` (`@com_google_grpc//third_party/cares:ares`) |
23+
| [new_http_archive](https://docs.bazel.build/versions/master/be/workspace.html#new_http_archive) | **`@com_github_cares_cares`** | [sha256:932bf7e593d4](https://github.com/c-ares/c-ares/archive/3be1924221e1326df520f8498d704a5c4c8d0cce.zip) |
24+
| [bind](https://docs.bazel.build/versions/master/be/workspace.html#bind) | **`@cares`** | `//external:cares` (`@com_github_cares_cares//:ares`) |
2625
| [bind](https://docs.bazel.build/versions/master/be/workspace.html#bind) | **`@zlib`** | `//external:zlib` (`@com_github_madler_zlib//:zlib`) |
2726
| [bind](https://docs.bazel.build/versions/master/be/workspace.html#bind) | **`@nanopb`** | `//external:nanopb` (`@com_google_grpc//third_party/nanopb`) |
2827
| [bind](https://docs.bazel.build/versions/master/be/workspace.html#bind) | **`@protoc_gen_grpc_cpp`** | `//external:protoc_gen_grpc_cpp` (`@com_google_grpc//:grpc_cpp_plugin`) |

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ the main bazel repository. This is a moving target. The main goals
2121
of this project are to:
2222

2323
1. Provide `protoc`, the protocol buffer compiler
24-
([v3.4.0](https://github.com/google/protobuf/commit/2807436cd828a526c5c38dd235c0d0d9cdc67b1f)).
24+
([v3.5.1](https://github.com/google/protobuf/commit/1f8b9b202e9a4e467ff0b0f25facb1642727cdf5e69092038f15b37c75b99e45)).
2525

2626
2. Provide the language-specific plugins.
2727

@@ -38,15 +38,15 @@ of this project are to:
3838

3939
| Language | Compile <sup>1</sup> | Build <sup>2</sup> | gRPC <sup>3</sup> |
4040
| ---------------------------: | -----------: | --------: | -------- |
41-
| [C++](cpp) | [cc_proto_compile](cpp#cc_proto_compile) | [cc_proto_library](cpp#cc_proto_library) [v3.4.0](https://github.com/grpc/grpc/releases/tag/v1.6.1) | [v1.6.1](https://github.com/grpc/grpc/releases/tag/v1.6.1) |
41+
| [C++](cpp) | [cc_proto_compile](cpp#cc_proto_compile) | [cc_proto_library](cpp#cc_proto_library) [v3.5.1](https://github.com/google/protobuf/releases/tag/v3.5.1) | [v1.10.1](https://github.com/grpc/grpc/releases/tag/v1.10.1) |
4242
| [C#](csharp) | [csharp_proto_compile](csharp#csharp_proto_compile) | [csharp_proto_library](csharp#csharp_proto_library) | [1.0.0](https://www.nuget.org/packages/Grpc/) |
4343
| [Closure](closure) | [closure_proto_compile](closure#closure_proto_compile) | [closure_proto_library](closure#closure_proto_library) | |
4444
| [Go](go) | [go_proto_compile](go#go_proto_compile) | [go_proto_library](go#go_proto_library) | [v1.6.0](https://github.com/grpc/grpc-go/releases/tag/v1.6.0) |
45-
| [Go (gogo)](gogo) | [gogo_proto_compile](gogo#gogo_proto_compile) | [gogo_proto_library](gogo#gogo_proto_library) | [fb8a35](https://github.com/gogo/protobuf/commit/fb8a359905af6e2b6517cccda0ba25915322ee88) |
45+
| [Go (gogo)](gogo) | [gogo_proto_compile](gogo#gogo_proto_compile) | [gogo_proto_library](gogo#gogo_proto_library) | [Nov 2017](https://github.com/gogo/protobuf/commit/616a82ed12d78d24d4839363e8f3c5d3f20627cf) |
4646
| [gRPC gateway](grpc_gateway) | [grpc_gateway_proto_compile](grpc_gateway#grpc_gateway_proto_compile)<br/>[grpc_gateway_swagger_compile](grpc_gateway#grpc_gateway_swagger_compile) | [grpc_gateway_proto_library](grpc_gateway#grpc_gateway_proto_library)<br/>[grpc_gateway_binary](grpc_gateway#grpc_gateway_binary) | [v1.2.2+ (f2862b)](https://github.com/grpc-ecosystem/grpc-gateway/commit/f2862b476edcef83412c7af8687c9cd8e4097c0f) |
47-
| [Java](java) | [java_proto_compile](java#java_proto_compile) | [java_proto_library](java#java_proto_library) | [v1.7.0](https://github.com/grpc/grpc-java/releases/tag/v1.7.0) |
48-
| [Node](node) | [node_proto_compile](node#node_proto_compile) | [node_proto_library](node#node_proto_library) | [1.6.0](https://www.npmjs.com/package/grpc) |
49-
| [Objective-C](objc) | [objc_proto_compile](objc#objc_proto_compile) | [objc_proto_library](objc#objc_proto_library) <sup>4</sup> | [v1.6.1](https://github.com/grpc/grpc/commit/f5600e99be0fdcada4b3039c0f656a305264884a) |
47+
| [Java](java) | [java_proto_compile](java#java_proto_compile) | [java_proto_library](java#java_proto_library) | [v1.9.0](https://github.com/grpc/grpc-java/releases/tag/v1.9.0) |
48+
| [Node](node) | [node_proto_compile](node#node_proto_compile) | [node_proto_library](node#node_proto_library) | [1.10.1](https://www.npmjs.com/package/grpc) |
49+
| [Objective-C](objc) | [objc_proto_compile](objc#objc_proto_compile) | [objc_proto_library](objc#objc_proto_library) <sup>4</sup> | [v1.10.1](https://github.com/grpc/grpc/releases/v1.10.1) |
5050
| [Python](python) | [py_proto_compile](python#py_proto_compile) | [py_proto_library](python#py_proto_library) | [v1.6.1](https://github.com/grpc/grpc/commit/f5600e99be0fdcada4b3039c0f656a305264884a) |
5151
| [Ruby](ruby) | [ruby_proto_compile](ruby#ruby_proto_compile) | | [v1.6.1](https://github.com/grpc/grpc/commit/f5600e99be0fdcada4b3039c0f656a305264884a) |
5252
| Custom [proto_language](protobuf#proto_language) | [proto_compile](protobuf#proto_compile) | | |

cpp/BUILD

+1
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ proto_language(
2323
],
2424
supports_grpc = True,
2525
)
26+

cpp/deps.bzl

+17-33
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,18 @@
1-
DEPS = {
1+
CARES_VERSION = "3be1924221e1326df520f8498d704a5c4c8d0cce" # Jun 16, 2017 (1.13.0)
22

3-
# Grpc repo is required by multiple languages but we put it here.
4-
# This is the source or "base" archive for the 'grpc_repository'
5-
# rule, were we'll reconstruct a new repo by symlinking resources
6-
# from here into 'com_google_grpc'.
7-
"com_google_grpc_base": {
8-
"rule": "http_archive",
9-
"url": "https://github.com/grpc/grpc/archive/ca87867579580928ca4c9fdf97051fa25bf1d386.zip", # Sep 19, 2017 (PR#12571)
10-
"sha256": "d3794ca4ff7b12635bd4972bb9478f1d11e478305490b96469eb3a47e50b1768",
11-
"strip_prefix": "grpc-ca87867579580928ca4c9fdf97051fa25bf1d386",
12-
},
3+
DEPS = {
134

145
"com_google_grpc": {
15-
"rule": "grpc_repository",
16-
"base_workspace": "@com_google_grpc_base//:WORKSPACE",
6+
"rule": "grpc_archive",
7+
"url": "https://github.com/grpc/grpc/archive/66b9770a8ad326c1ee0dbedc5a8f32a52a604567.tar.gz", # 1.10.1
8+
"sha256": "14c1d63217f829f3c23bf039a76c186d0886c5b5c64e7eced44764f0fc564e6a",
9+
"strip_prefix": "grpc-66b9770a8ad326c1ee0dbedc5a8f32a52a604567",
1710
},
1811

19-
"com_github_c_ares_c_ares": {
20-
"rule": "new_http_archive",
21-
"url": "https://github.com/c-ares/c-ares/archive/7691f773af79bf75a62d1863fd0f13ebf9dc51b1.zip",
22-
"sha256": "ddce8def076a0a8cfa3f56595e391cf9e13a39fd4a7882822ed98cafd4079862",
23-
"strip_prefix": "c-ares-7691f773af79bf75a62d1863fd0f13ebf9dc51b1",
24-
"build_file_content": "",
25-
},
26-
27-
"com_github_grpc_grpc": {
28-
"rule": "grpc_repository",
29-
},
30-
31-
# Hooray! The boringssl team provides "master-with-bazel" and
32-
# "chromium-stable-with-bazel" branches with the BUILD files ready
33-
# to go. To update, pick the newest-ish commit-id off that
34-
# branch.
3512
"boringssl": {
3613
"rule": "http_archive",
3714
# master-with-bazel Fri Sep 01 15:09:13 2017 +0000
38-
"url": "https://boringssl.googlesource.com/boringssl/+archive/74ffd81aa7ec3d0aa3d3d820dbeda934958ca81a.tar.gz",
39-
# Shockingly, tar.gz from googlesource has a different sha256 each time. WTF?
40-
#"sha256": "7deda1bac8f10be6dca78b54b8b2886a215f6c62270afdd2ed43bc10920925c7",
15+
"url": "https://boringssl.googlesource.com/boringssl/+archive/886e7d75368e3f4fab3f4d0d3584e4abfc557755.tar.gz",
4116
},
4217

4318
# libssl is required for c++ grpc where it is expected in
@@ -56,12 +31,21 @@ DEPS = {
5631
"build_file": str(Label("//protobuf:build_file/com_github_madler_zlib.BUILD")),
5732
},
5833

34+
"com_github_cares_cares": {
35+
"rule": "new_http_archive",
36+
"url": "https://github.com/c-ares/c-ares/archive/%s.zip" % CARES_VERSION,
37+
"sha256": "932bf7e593d4683fce44fd26920f27d4f0c229113338e4f6d351e35d4d7c7a39",
38+
"strip_prefix": "c-ares-" + CARES_VERSION,
39+
"build_file": str(Label("//protobuf:build_file/cares.BUILD")),
40+
},
41+
5942
# grpc++ expects //external:cares
6043
"cares": {
6144
"rule": "bind",
62-
"actual": "@com_google_grpc//third_party/cares:ares",
45+
"actual": "@com_github_cares_cares//:ares",
6346
},
6447

48+
6549
# grpc++ expects //external:zlib
6650
"zlib": {
6751
"rule": "bind",
File renamed without changes.

cpp/grpc_archive.bzl

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
def _execute(rtx, cmds, print_result = False, keep_going = True):
2+
result = rtx.execute(cmds)
3+
if result.return_code:
4+
if not keep_going:
5+
fail("$ %s failed (%s)" % (" ".join(cmds), result.stderr))
6+
if print_result:
7+
print("$ %r\n%s" % (cmds, result.stdout))
8+
return result
9+
10+
11+
# The grpc repository needs enough work that we need a custom repository
12+
# rule to set it up.
13+
def _grpc_archive_impl(rtx):
14+
15+
rtx.download_and_extract(
16+
rtx.attr.url,
17+
output = "",
18+
sha256 = rtx.attr.sha256,
19+
type = rtx.attr.type,
20+
stripPrefix = rtx.attr.strip_prefix,
21+
)
22+
23+
_execute(rtx, ["rm", "bazel/generate_cc.bzl"])
24+
25+
rtx.symlink(rtx.path(rtx.attr.generate_cc_bzl), "bazel/generate_cc.bzl")
26+
rtx.file("WORKSPACE", "workspace(name = 'com_google_grpc')")
27+
28+
# Http archive that patches the grpc repository so that the reflection++ targets compile
29+
# as an external workspace.
30+
#
31+
grpc_archive = repository_rule(
32+
implementation = _grpc_archive_impl,
33+
attrs = {
34+
"url": attr.string(),
35+
"sha256": attr.string(),
36+
"strip_prefix": attr.string(),
37+
"type": attr.string(),
38+
"generate_cc_bzl": attr.label(
39+
default = Label("@org_pubref_rules_protobuf//cpp:generate_cc.bzl", relative_to_caller_repository=True)
40+
),
41+
},
42+
)

cpp/grpc_repository.bzl

-123
This file was deleted.

cpp/rules.bzl

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
load("//protobuf:rules.bzl", "proto_compile", "proto_repositories")
22
load("//cpp:deps.bzl", "DEPS")
3-
load("//cpp:grpc_repository.bzl", "grpc_repository")
3+
load("//cpp:grpc_archive.bzl", "grpc_archive")
44

55
def cpp_proto_repositories(
66
lang_deps = DEPS,
77
lang_requires = [
8-
"cares",
9-
"com_google_googletest",
10-
"com_google_grpc_base",
118
"com_google_grpc",
12-
"com_github_c_ares_c_ares",
9+
"com_github_cares_cares",
10+
"com_google_googletest",
1311
"com_github_madler_zlib",
12+
"cares",
1413
"zlib",
1514
"nanopb",
1615
"boringssl",
@@ -24,8 +23,8 @@ def cpp_proto_repositories(
2423

2524
for dep in rem:
2625
rule = dep.pop("rule")
27-
if "grpc_repository" == rule:
28-
grpc_repository(**dep)
26+
if "grpc_archive" == rule:
27+
grpc_archive(**dep)
2928
else:
3029
fail("Unknown loading rule %s for %s" % (rule, dep))
3130

0 commit comments

Comments
 (0)