diff --git a/.bazelignore b/.bazelignore index b85dcc05452..033433445de 100644 --- a/.bazelignore +++ b/.bazelignore @@ -10,6 +10,7 @@ third_party/bloaty third_party/boringssl-with-bazel third_party/googleapis third_party/googletest +third_party/opencensus-proto third_party/protobuf third_party/protoc-gen-validate third_party/udpa diff --git a/.gitmodules b/.gitmodules index ef9756814fe..0c5e543585e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -46,3 +46,6 @@ [submodule "third_party/libuv"] path = third_party/libuv url = https://github.com/libuv/libuv.git +[submodule "third_party/opencensus-proto"] + path = third_party/opencensus-proto + url = https://github.com/census-instrumentation/opencensus-proto.git diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl index 060f885fd94..e9e9a38ce47 100644 --- a/bazel/grpc_deps.bzl +++ b/bazel/grpc_deps.bzl @@ -93,7 +93,7 @@ def grpc_deps(): native.bind( name = "re2", - actual = "@com_github_google_re2//:re2", + actual = "@com_googlesource_code_re2//:re2", ) native.bind( @@ -219,9 +219,9 @@ def grpc_deps(): ], ) - if "com_github_google_re2" not in native.existing_rules(): + if "com_googlesource_code_re2" not in native.existing_rules(): http_archive( - name = "com_github_google_re2", + name = "com_googlesource_code_re2", sha256 = "9f385e146410a8150b6f4cb1a57eab7ec806ced48d427554b1e754877ff26c3e", strip_prefix = "re2-aecba11114cf1fac5497aeb844b6966106de3eb6", urls = [ @@ -321,10 +321,10 @@ def grpc_deps(): if "io_bazel_rules_go" not in native.existing_rules(): http_archive( name = "io_bazel_rules_go", - sha256 = "a82a352bffae6bee4e95f68a8d80a70e87f42c4741e6a448bec11998fcc82329", + sha256 = "dbf5a9ef855684f84cac2e7ae7886c5a001d4f66ae23f6904da0faaaef0d61fc", urls = [ - "https://storage.googleapis.com/grpc-bazel-mirror/github.com/bazelbuild/rules_go/releases/download/0.18.5/rules_go-0.18.5.tar.gz", - "https://github.com/bazelbuild/rules_go/releases/download/0.18.5/rules_go-0.18.5.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.24.11/rules_go-v0.24.11.tar.gz", + "https://github.com/bazelbuild/rules_go/releases/download/v0.24.11/rules_go-v0.24.11.tar.gz", ], ) @@ -361,6 +361,42 @@ def grpc_deps(): ], ) + if "com_google_googleapis" not in native.existing_rules(): + http_archive( + name = "com_google_googleapis", + sha256 = "a45019af4d3290f02eaeb1ce10990166978c807cb33a9692141a076ba46d1405", + strip_prefix = "googleapis-82944da21578a53b74e547774cf62ed31a05b841", + urls = [ + "https://github.com/googleapis/googleapis/archive/82944da21578a53b74e547774cf62ed31a05b841.tar.gz", + ], + ) + + if "bazel_gazelle" not in native.existing_rules(): + http_archive( + name = "bazel_gazelle", + sha256 = "d987004a72697334a095bbaa18d615804a28280201a50ed6c234c40ccc41e493", + strip_prefix = "bazel-gazelle-0.19.1", + urls = [ + "https://github.com/bazelbuild/bazel-gazelle/archive/v0.19.1.tar.gz", + ], + ) + + if "opencensus_proto" not in native.existing_rules(): + http_archive( + name = "opencensus_proto", + sha256 = "b7e13f0b4259e80c3070b583c2f39e53153085a6918718b1c710caf7037572b0", + strip_prefix = "opencensus-proto-0.3.0/src", + urls = ["https://github.com/census-instrumentation/opencensus-proto/archive/v0.3.0.tar.gz"], + ) + + if "com_envoyproxy_protoc_gen_validate" not in native.existing_rules(): + http_archive( + name = "com_envoyproxy_protoc_gen_validate", + sha256 = "e368733c9fb7f8489591ffaf269170d7658cc0cd1ee322b601512b769446d3c8", + strip_prefix = "protoc-gen-validate-278964a8052f96a2f514add0298098f63fb7f47f", + urls = ["https://github.com/envoyproxy/protoc-gen-validate/archive/278964a8052f96a2f514add0298098f63fb7f47f.tar.gz"], + ) + grpc_python_deps() # TODO: move some dependencies from "grpc_deps" here? diff --git a/bazel/grpc_extra_deps.bzl b/bazel/grpc_extra_deps.bzl index 9c3038f4389..2338a14b0f5 100644 --- a/bazel/grpc_extra_deps.bzl +++ b/bazel/grpc_extra_deps.bzl @@ -6,6 +6,7 @@ load("@envoy_api//bazel:repositories.bzl", "api_dependencies") load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") load("@build_bazel_rules_apple//apple:repositories.bzl", "apple_rules_dependencies") load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependencies") +load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language") def grpc_extra_deps(ignore_version_differences = False): """Loads the extra dependencies. @@ -38,3 +39,11 @@ def grpc_extra_deps(ignore_version_differences = False): apple_rules_dependencies(ignore_version_differences = ignore_version_differences) apple_support_dependencies() + + # Initialize Google APIs with only C++ and Python targets + switched_rules_by_language( + name = "com_google_googleapis_imports", + cc = True, + grpc = True, + python = True, + ) diff --git a/third_party/opencensus-proto b/third_party/opencensus-proto new file mode 160000 index 00000000000..4aa53e15cbf --- /dev/null +++ b/third_party/opencensus-proto @@ -0,0 +1 @@ +Subproject commit 4aa53e15cbf1a47bc9087e6cfdca214c1eea4e89 diff --git a/tools/run_tests/sanity/check_bazel_workspace.py b/tools/run_tests/sanity/check_bazel_workspace.py index 4070e63b1f4..c87892ae222 100755 --- a/tools/run_tests/sanity/check_bazel_workspace.py +++ b/tools/run_tests/sanity/check_bazel_workspace.py @@ -41,30 +41,16 @@ _ZOPEFOUNDATION_ZOPE_INTERFACE_DEP_NAME = 'com_github_zopefoundation_zope_interf _TWISTED_CONSTANTLY_DEP_NAME = 'com_github_twisted_constantly' _GRPC_DEP_NAMES = [ - 'upb', - 'boringssl', - 'zlib', - 'com_google_protobuf', - 'com_google_googletest', - 'rules_cc', - 'com_github_google_benchmark', - 'com_github_cares_cares', - 'com_google_absl', - 'io_opencensus_cpp', - 'envoy_api', - _BAZEL_SKYLIB_DEP_NAME, - _BAZEL_TOOLCHAINS_DEP_NAME, - _BAZEL_COMPDB_DEP_NAME, - _TWISTED_TWISTED_DEP_NAME, - _YAML_PYYAML_DEP_NAME, - _TWISTED_INCREMENTAL_DEP_NAME, - _ZOPEFOUNDATION_ZOPE_INTERFACE_DEP_NAME, - _TWISTED_CONSTANTLY_DEP_NAME, - 'io_bazel_rules_go', - 'build_bazel_rules_apple', - 'build_bazel_apple_support', - 'libuv', - 'com_github_google_re2', + 'upb', 'boringssl', 'zlib', 'com_google_protobuf', 'com_google_googletest', + 'rules_cc', 'com_github_google_benchmark', 'com_github_cares_cares', + 'com_google_absl', 'io_opencensus_cpp', 'envoy_api', _BAZEL_SKYLIB_DEP_NAME, + _BAZEL_TOOLCHAINS_DEP_NAME, _BAZEL_COMPDB_DEP_NAME, + _TWISTED_TWISTED_DEP_NAME, _YAML_PYYAML_DEP_NAME, + _TWISTED_INCREMENTAL_DEP_NAME, _ZOPEFOUNDATION_ZOPE_INTERFACE_DEP_NAME, + _TWISTED_CONSTANTLY_DEP_NAME, 'io_bazel_rules_go', + 'build_bazel_rules_apple', 'build_bazel_apple_support', 'libuv', + 'com_googlesource_code_re2', 'bazel_gazelle', 'opencensus_proto', + 'com_envoyproxy_protoc_gen_validate', 'com_google_googleapis' ] _GRPC_BAZEL_ONLY_DEPS = [ @@ -83,6 +69,11 @@ _GRPC_BAZEL_ONLY_DEPS = [ 'io_bazel_rules_go', 'build_bazel_rules_apple', 'build_bazel_apple_support', + 'com_googlesource_code_re2', + 'bazel_gazelle', + 'opencensus_proto', + 'com_envoyproxy_protoc_gen_validate', + 'com_google_googleapis', ] diff --git a/tools/run_tests/sanity/check_submodules.sh b/tools/run_tests/sanity/check_submodules.sh index 41571f647c9..334267eb33d 100755 --- a/tools/run_tests/sanity/check_submodules.sh +++ b/tools/run_tests/sanity/check_submodules.sh @@ -35,6 +35,7 @@ cat << EOF | awk '{ print $1 }' | sort > "$want_submodules" 82944da21578a53b74e547774cf62ed31a05b841 third_party/googleapis (common-protos-1_3_1-915-g80ed4d0bb) c9ccac7cb7345901884aabf5d1a786cfa6e2f397 third_party/googletest (6e2f397) 15ae750151ac9341e5945eb38f8982d59fb99201 third_party/libuv (v1.34.0) + 4aa53e15cbf1a47bc9087e6cfdca214c1eea4e89 third_party/opencensus-proto (v0.3.0) d7e943b8d2bc444a8c770644e73d090b486f8b37 third_party/protobuf (v3.15.2) 872b28c457822ed9c2a5405da3c33f386ac0e86f third_party/protoc-gen-validate (v0.4.1) aecba11114cf1fac5497aeb844b6966106de3eb6 third_party/re2 (heads/master)