Skip to content

Commit 5655204

Browse files
authored
[xDS Proto] Update Bazel dependencies (grpc#25511)
* [xDS Proto] Update Bazel dependencies * Include transitive deps required by xDS proto libraries * The Golang deps come from protoc-gen-validate project * Adding a new submodule: opencensus-proto * Add the new submodule to .bazelignore * Update WORKSPACE file to initialize googleapis * Remove WORKSPACE override * Adopt reviewer's advice
1 parent c2ed1c7 commit 5655204

File tree

7 files changed

+72
-30
lines changed

7 files changed

+72
-30
lines changed

.bazelignore

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ third_party/bloaty
1010
third_party/boringssl-with-bazel
1111
third_party/googleapis
1212
third_party/googletest
13+
third_party/opencensus-proto
1314
third_party/protobuf
1415
third_party/protoc-gen-validate
1516
third_party/udpa

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,6 @@
4646
[submodule "third_party/libuv"]
4747
path = third_party/libuv
4848
url = https://github.com/libuv/libuv.git
49+
[submodule "third_party/opencensus-proto"]
50+
path = third_party/opencensus-proto
51+
url = https://github.com/census-instrumentation/opencensus-proto.git

bazel/grpc_deps.bzl

+42-6
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def grpc_deps():
9393

9494
native.bind(
9595
name = "re2",
96-
actual = "@com_github_google_re2//:re2",
96+
actual = "@com_googlesource_code_re2//:re2",
9797
)
9898

9999
native.bind(
@@ -219,9 +219,9 @@ def grpc_deps():
219219
],
220220
)
221221

222-
if "com_github_google_re2" not in native.existing_rules():
222+
if "com_googlesource_code_re2" not in native.existing_rules():
223223
http_archive(
224-
name = "com_github_google_re2",
224+
name = "com_googlesource_code_re2",
225225
sha256 = "9f385e146410a8150b6f4cb1a57eab7ec806ced48d427554b1e754877ff26c3e",
226226
strip_prefix = "re2-aecba11114cf1fac5497aeb844b6966106de3eb6",
227227
urls = [
@@ -321,10 +321,10 @@ def grpc_deps():
321321
if "io_bazel_rules_go" not in native.existing_rules():
322322
http_archive(
323323
name = "io_bazel_rules_go",
324-
sha256 = "a82a352bffae6bee4e95f68a8d80a70e87f42c4741e6a448bec11998fcc82329",
324+
sha256 = "dbf5a9ef855684f84cac2e7ae7886c5a001d4f66ae23f6904da0faaaef0d61fc",
325325
urls = [
326-
"https://storage.googleapis.com/grpc-bazel-mirror/github.com/bazelbuild/rules_go/releases/download/0.18.5/rules_go-0.18.5.tar.gz",
327-
"https://github.com/bazelbuild/rules_go/releases/download/0.18.5/rules_go-0.18.5.tar.gz",
326+
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.24.11/rules_go-v0.24.11.tar.gz",
327+
"https://github.com/bazelbuild/rules_go/releases/download/v0.24.11/rules_go-v0.24.11.tar.gz",
328328
],
329329
)
330330

@@ -361,6 +361,42 @@ def grpc_deps():
361361
],
362362
)
363363

364+
if "com_google_googleapis" not in native.existing_rules():
365+
http_archive(
366+
name = "com_google_googleapis",
367+
sha256 = "a45019af4d3290f02eaeb1ce10990166978c807cb33a9692141a076ba46d1405",
368+
strip_prefix = "googleapis-82944da21578a53b74e547774cf62ed31a05b841",
369+
urls = [
370+
"https://github.com/googleapis/googleapis/archive/82944da21578a53b74e547774cf62ed31a05b841.tar.gz",
371+
],
372+
)
373+
374+
if "bazel_gazelle" not in native.existing_rules():
375+
http_archive(
376+
name = "bazel_gazelle",
377+
sha256 = "d987004a72697334a095bbaa18d615804a28280201a50ed6c234c40ccc41e493",
378+
strip_prefix = "bazel-gazelle-0.19.1",
379+
urls = [
380+
"https://github.com/bazelbuild/bazel-gazelle/archive/v0.19.1.tar.gz",
381+
],
382+
)
383+
384+
if "opencensus_proto" not in native.existing_rules():
385+
http_archive(
386+
name = "opencensus_proto",
387+
sha256 = "b7e13f0b4259e80c3070b583c2f39e53153085a6918718b1c710caf7037572b0",
388+
strip_prefix = "opencensus-proto-0.3.0/src",
389+
urls = ["https://github.com/census-instrumentation/opencensus-proto/archive/v0.3.0.tar.gz"],
390+
)
391+
392+
if "com_envoyproxy_protoc_gen_validate" not in native.existing_rules():
393+
http_archive(
394+
name = "com_envoyproxy_protoc_gen_validate",
395+
sha256 = "e368733c9fb7f8489591ffaf269170d7658cc0cd1ee322b601512b769446d3c8",
396+
strip_prefix = "protoc-gen-validate-278964a8052f96a2f514add0298098f63fb7f47f",
397+
urls = ["https://github.com/envoyproxy/protoc-gen-validate/archive/278964a8052f96a2f514add0298098f63fb7f47f.tar.gz"],
398+
)
399+
364400
grpc_python_deps()
365401

366402
# TODO: move some dependencies from "grpc_deps" here?

bazel/grpc_extra_deps.bzl

+9
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ load("@envoy_api//bazel:repositories.bzl", "api_dependencies")
66
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
77
load("@build_bazel_rules_apple//apple:repositories.bzl", "apple_rules_dependencies")
88
load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependencies")
9+
load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language")
910

1011
def grpc_extra_deps(ignore_version_differences = False):
1112
"""Loads the extra dependencies.
@@ -38,3 +39,11 @@ def grpc_extra_deps(ignore_version_differences = False):
3839
apple_rules_dependencies(ignore_version_differences = ignore_version_differences)
3940

4041
apple_support_dependencies()
42+
43+
# Initialize Google APIs with only C++ and Python targets
44+
switched_rules_by_language(
45+
name = "com_google_googleapis_imports",
46+
cc = True,
47+
grpc = True,
48+
python = True,
49+
)

third_party/opencensus-proto

Submodule opencensus-proto added at 4aa53e1

tools/run_tests/sanity/check_bazel_workspace.py

+15-24
Original file line numberDiff line numberDiff line change
@@ -41,30 +41,16 @@
4141
_TWISTED_CONSTANTLY_DEP_NAME = 'com_github_twisted_constantly'
4242

4343
_GRPC_DEP_NAMES = [
44-
'upb',
45-
'boringssl',
46-
'zlib',
47-
'com_google_protobuf',
48-
'com_google_googletest',
49-
'rules_cc',
50-
'com_github_google_benchmark',
51-
'com_github_cares_cares',
52-
'com_google_absl',
53-
'io_opencensus_cpp',
54-
'envoy_api',
55-
_BAZEL_SKYLIB_DEP_NAME,
56-
_BAZEL_TOOLCHAINS_DEP_NAME,
57-
_BAZEL_COMPDB_DEP_NAME,
58-
_TWISTED_TWISTED_DEP_NAME,
59-
_YAML_PYYAML_DEP_NAME,
60-
_TWISTED_INCREMENTAL_DEP_NAME,
61-
_ZOPEFOUNDATION_ZOPE_INTERFACE_DEP_NAME,
62-
_TWISTED_CONSTANTLY_DEP_NAME,
63-
'io_bazel_rules_go',
64-
'build_bazel_rules_apple',
65-
'build_bazel_apple_support',
66-
'libuv',
67-
'com_github_google_re2',
44+
'upb', 'boringssl', 'zlib', 'com_google_protobuf', 'com_google_googletest',
45+
'rules_cc', 'com_github_google_benchmark', 'com_github_cares_cares',
46+
'com_google_absl', 'io_opencensus_cpp', 'envoy_api', _BAZEL_SKYLIB_DEP_NAME,
47+
_BAZEL_TOOLCHAINS_DEP_NAME, _BAZEL_COMPDB_DEP_NAME,
48+
_TWISTED_TWISTED_DEP_NAME, _YAML_PYYAML_DEP_NAME,
49+
_TWISTED_INCREMENTAL_DEP_NAME, _ZOPEFOUNDATION_ZOPE_INTERFACE_DEP_NAME,
50+
_TWISTED_CONSTANTLY_DEP_NAME, 'io_bazel_rules_go',
51+
'build_bazel_rules_apple', 'build_bazel_apple_support', 'libuv',
52+
'com_googlesource_code_re2', 'bazel_gazelle', 'opencensus_proto',
53+
'com_envoyproxy_protoc_gen_validate', 'com_google_googleapis'
6854
]
6955

7056
_GRPC_BAZEL_ONLY_DEPS = [
@@ -83,6 +69,11 @@
8369
'io_bazel_rules_go',
8470
'build_bazel_rules_apple',
8571
'build_bazel_apple_support',
72+
'com_googlesource_code_re2',
73+
'bazel_gazelle',
74+
'opencensus_proto',
75+
'com_envoyproxy_protoc_gen_validate',
76+
'com_google_googleapis',
8677
]
8778

8879

tools/run_tests/sanity/check_submodules.sh

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ cat << EOF | awk '{ print $1 }' | sort > "$want_submodules"
3535
82944da21578a53b74e547774cf62ed31a05b841 third_party/googleapis (common-protos-1_3_1-915-g80ed4d0bb)
3636
c9ccac7cb7345901884aabf5d1a786cfa6e2f397 third_party/googletest (6e2f397)
3737
15ae750151ac9341e5945eb38f8982d59fb99201 third_party/libuv (v1.34.0)
38+
4aa53e15cbf1a47bc9087e6cfdca214c1eea4e89 third_party/opencensus-proto (v0.3.0)
3839
d7e943b8d2bc444a8c770644e73d090b486f8b37 third_party/protobuf (v3.15.2)
3940
872b28c457822ed9c2a5405da3c33f386ac0e86f third_party/protoc-gen-validate (v0.4.1)
4041
aecba11114cf1fac5497aeb844b6966106de3eb6 third_party/re2 (heads/master)

0 commit comments

Comments
 (0)