mongo/src/third_party/grpc/patches/grpc.patch
Jaya Kasa 9d57d4febb SERVER-101911: moving deps to bzlmod (#32753)
GitOrigin-RevId: 385e68b309da50a49a0417d3b2f53eeaae49a418
2025-04-10 01:33:10 +00:00

465 lines
17 KiB
Diff

diff --git a/MODULE.bazel b/MODULE.bazel
new file mode 100644
index 0000000000..e22e20d227
--- /dev/null
+++ b/MODULE.bazel
@@ -0,0 +1,18 @@
+module(
+ name = "grpc",
+)
+
+bazel_dep(name = "rules_proto", version = "4.0.0")
+bazel_dep(name = "protobuf", version = "26.0.bcr.1", repo_name = "com_google_protobuf")
+
+grpc_repo_deps_ext = use_extension("//bazel:grpc_deps.bzl", "grpc_repo_deps_ext")
+use_repo(
+ grpc_repo_deps_ext,
+ "com_envoyproxy_protoc_gen_validate",
+ "com_github_cncf_udpa",
+ "com_github_cncf_xds",
+ "envoy_api",
+ "google_cloud_cpp",
+ "io_opencensus_cpp",
+)
+
diff --git a/bazel/generate_cc.bzl b/bazel/generate_cc.bzl
index 82257e4378..c5e3c4f1c5 100644
--- a/bazel/generate_cc.bzl
+++ b/bazel/generate_cc.bzl
@@ -196,7 +196,7 @@ _generate_cc = rule(
),
"disable_sandbox": attr.bool(default = False, mandatory = False),
"_protoc": attr.label(
- default = Label("//external:protocol_compiler"),
+ default = Label("@com_google_protobuf//:protoc"),
executable = True,
cfg = "host",
),
diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl
index 35fc4fe175..76510d66bc 100644
--- a/bazel/grpc_deps.bzl
+++ b/bazel/grpc_deps.bzl
@@ -20,253 +20,6 @@ load("@com_github_grpc_grpc//bazel:grpc_python_deps.bzl", "grpc_python_deps")
def grpc_deps():
"""Loads dependencies need to compile and test the grpc library."""
- native.bind(
- name = "upb_lib",
- actual = "@upb//:upb",
- )
-
- native.bind(
- name = "upb_collections_lib",
- actual = "@upb//:collections",
- )
-
- native.bind(
- name = "upb_reflection",
- actual = "@upb//:reflection",
- )
-
- native.bind(
- name = "upb_lib_descriptor",
- actual = "@upb//:descriptor_upb_proto",
- )
-
- native.bind(
- name = "upb_lib_descriptor_reflection",
- actual = "@upb//:descriptor_upb_proto_reflection",
- )
-
- native.bind(
- name = "upb_textformat_lib",
- actual = "@upb//:textformat",
- )
-
- native.bind(
- name = "upb_json_lib",
- actual = "@upb//:json",
- )
-
- native.bind(
- name = "upb_generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me",
- actual = "@upb//:generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me",
- )
-
- native.bind(
- name = "libssl",
- actual = "@boringssl//:ssl",
- )
-
- native.bind(
- name = "libcrypto",
- actual = "@boringssl//:crypto",
- )
-
- native.bind(
- name = "madler_zlib",
- actual = "@zlib//:zlib",
- )
-
- native.bind(
- name = "protobuf",
- actual = "@com_google_protobuf//:protobuf",
- )
-
- native.bind(
- name = "protobuf_clib",
- actual = "@com_google_protobuf//:protoc_lib",
- )
-
- native.bind(
- name = "protobuf_headers",
- actual = "@com_google_protobuf//:protobuf_headers",
- )
-
- native.bind(
- name = "protocol_compiler",
- actual = "@com_google_protobuf//:protoc",
- )
-
- native.bind(
- name = "cares",
- actual = "@com_github_cares_cares//:ares",
- )
-
- native.bind(
- name = "gtest",
- actual = "@com_google_googletest//:gtest",
- )
-
- native.bind(
- name = "fuzztest",
- actual = "@com_google_fuzztest//fuzztest",
- )
-
- native.bind(
- name = "fuzztest_main",
- actual = "@com_google_fuzztest//fuzztest:fuzztest_gtest_main",
- )
-
- native.bind(
- name = "benchmark",
- actual = "@com_github_google_benchmark//:benchmark",
- )
-
- native.bind(
- name = "re2",
- actual = "@com_googlesource_code_re2//:re2",
- )
-
- native.bind(
- name = "grpc_cpp_plugin",
- actual = "@com_github_grpc_grpc//src/compiler:grpc_cpp_plugin",
- )
-
- native.bind(
- name = "grpc++_codegen_proto",
- actual = "@com_github_grpc_grpc//:grpc++_codegen_proto",
- )
-
- native.bind(
- name = "opencensus-context",
- actual = "@io_opencensus_cpp//opencensus/context:context",
- )
-
- native.bind(
- name = "opencensus-trace",
- actual = "@io_opencensus_cpp//opencensus/trace:trace",
- )
-
- native.bind(
- name = "opencensus-trace-context_util",
- actual = "@io_opencensus_cpp//opencensus/trace:context_util",
- )
-
- native.bind(
- name = "opencensus-trace-propagation",
- actual = "@io_opencensus_cpp//opencensus/trace:grpc_trace_bin",
- )
-
- native.bind(
- name = "opencensus-trace-span_context",
- actual = "@io_opencensus_cpp//opencensus/trace:span_context",
- )
-
- native.bind(
- name = "opencensus-stats",
- actual = "@io_opencensus_cpp//opencensus/stats:stats",
- )
-
- native.bind(
- name = "opencensus-stats-test",
- actual = "@io_opencensus_cpp//opencensus/stats:test_utils",
- )
-
- native.bind(
- name = "opencensus-with-tag-map",
- actual = "@io_opencensus_cpp//opencensus/tags:with_tag_map",
- )
-
- native.bind(
- name = "opencensus-tags",
- actual = "@io_opencensus_cpp//opencensus/tags:tags",
- )
-
- native.bind(
- name = "opencensus-tags-context_util",
- actual = "@io_opencensus_cpp//opencensus/tags:context_util",
- )
-
- native.bind(
- name = "opencensus-trace-stackdriver_exporter",
- actual = "@io_opencensus_cpp//opencensus/exporters/trace/stackdriver:stackdriver_exporter",
- )
-
- native.bind(
- name = "opencensus-stats-stackdriver_exporter",
- actual = "@io_opencensus_cpp//opencensus/exporters/stats/stackdriver:stackdriver_exporter",
- )
-
- native.bind(
- name = "googleapis_trace_grpc_service",
- actual = "@com_google_googleapis//google/devtools/cloudtrace/v2:cloudtrace_cc_grpc",
- )
-
- native.bind(
- name = "googleapis_monitoring_grpc_service",
- actual = "@com_google_googleapis//google/monitoring/v3:monitoring_cc_grpc",
- )
-
- native.bind(
- name = "googleapis_logging_grpc_service",
- actual = "@com_google_googleapis//google/logging/v2:logging_cc_grpc",
- )
-
- native.bind(
- name = "googleapis_logging_cc_proto",
- actual = "@com_google_googleapis//google/logging/v2:logging_cc_proto",
- )
-
- if "boringssl" not in native.existing_rules():
- http_archive(
- name = "boringssl",
- # Use github mirror instead of https://boringssl.googlesource.com/boringssl
- # to obtain a boringssl archive with consistent sha256
- sha256 = "b21994a857a7aa6d5256ffe355c735ad4c286de44c6c81dfc04edc41a8feaeef",
- strip_prefix = "boringssl-2ff4b968a7e0cfee66d9f151cb95635b43dc1d5b",
- urls = [
- "https://storage.googleapis.com/grpc-bazel-mirror/github.com/google/boringssl/archive/2ff4b968a7e0cfee66d9f151cb95635b43dc1d5b.tar.gz",
- "https://github.com/google/boringssl/archive/2ff4b968a7e0cfee66d9f151cb95635b43dc1d5b.tar.gz",
- ],
- )
-
- if "zlib" not in native.existing_rules():
- http_archive(
- name = "zlib",
- build_file = "@com_github_grpc_grpc//third_party:zlib.BUILD",
- sha256 = "90f43a9c998740e8a0db24b0af0147033db2aaaa99423129abbd76640757cac9",
- strip_prefix = "zlib-04f42ceca40f73e2978b50e93806c2a18c1281fc",
- urls = [
- "https://storage.googleapis.com/grpc-bazel-mirror/github.com/madler/zlib/archive/04f42ceca40f73e2978b50e93806c2a18c1281fc.tar.gz",
- "https://github.com/madler/zlib/archive/04f42ceca40f73e2978b50e93806c2a18c1281fc.tar.gz",
- ],
- )
-
- if "com_google_protobuf" not in native.existing_rules():
- http_archive(
- name = "com_google_protobuf",
- sha256 = "660ce016f987550bc1ccec4a6ee4199afb871799b696227098e3641476a7d566",
- strip_prefix = "protobuf-b2b7a51158418f41cff0520894836c15b1738721",
- urls = [
- # https://github.com/protocolbuffers/protobuf/commits/v24.3
- "https://storage.googleapis.com/grpc-bazel-mirror/github.com/protocolbuffers/protobuf/archive/b2b7a51158418f41cff0520894836c15b1738721.tar.gz",
- "https://github.com/protocolbuffers/protobuf/archive/b2b7a51158418f41cff0520894836c15b1738721.tar.gz",
- ],
- patches = [
- "@com_github_grpc_grpc//third_party:protobuf.patch",
- ],
- patch_args = ["-p1"],
- )
-
- if "com_google_googletest" not in native.existing_rules():
- http_archive(
- name = "com_google_googletest",
- sha256 = "c8de6c60e12ad014a28225c5247ee735861d85cf906df617f6a29954ca05f547",
- strip_prefix = "googletest-0e402173c97aea7a00749e825b194bfede4f2e45",
- urls = [
- # 2022-02-09
- "https://github.com/google/googletest/archive/0e402173c97aea7a00749e825b194bfede4f2e45.tar.gz",
- ],
- )
-
if "com_google_fuzztest" not in native.existing_rules():
# when updating this remember to run:
# bazel run @com_google_fuzztest//bazel:setup_configs > tools/fuzztest.bazelrc
@@ -280,62 +33,6 @@ def grpc_deps():
],
)
- if "rules_cc" not in native.existing_rules():
- http_archive(
- name = "rules_cc",
- sha256 = "3d9e271e2876ba42e114c9b9bc51454e379cbf0ec9ef9d40e2ae4cec61a31b40",
- strip_prefix = "rules_cc-0.0.6",
- urls = [
- "https://storage.googleapis.com/grpc-bazel-mirror/github.com/bazelbuild/rules_cc/releases/download/0.0.6/rules_cc-0.0.6.tar.gz",
- "https://github.com/bazelbuild/rules_cc/releases/download/0.0.6/rules_cc-0.0.6.tar.gz",
- ],
- )
-
- if "com_github_google_benchmark" not in native.existing_rules():
- http_archive(
- name = "com_github_google_benchmark",
- sha256 = "4e47ca279d5ae967c506c136bd8afb42eedcaf010aebb48a0e87790cae4b488a",
- strip_prefix = "benchmark-015d1a091af6937488242b70121858bce8fd40e9",
- urls = [
- # v1.8.2
- "https://github.com/google/benchmark/archive/015d1a091af6937488242b70121858bce8fd40e9.tar.gz",
- ],
- )
-
- if "com_googlesource_code_re2" not in native.existing_rules():
- http_archive(
- name = "com_googlesource_code_re2",
- sha256 = "1ae8ccfdb1066a731bba6ee0881baad5efd2cd661acd9569b689f2586e1a50e9",
- strip_prefix = "re2-2022-04-01",
- urls = [
- "https://storage.googleapis.com/grpc-bazel-mirror/github.com/google/re2/archive/2022-04-01.tar.gz",
- "https://github.com/google/re2/archive/2022-04-01.tar.gz",
- ],
- )
-
- if "com_github_cares_cares" not in native.existing_rules():
- http_archive(
- name = "com_github_cares_cares",
- build_file = "@com_github_grpc_grpc//third_party:cares/cares.BUILD",
- sha256 = "bf26e5b25e259911914a85ae847b6d723488adb5af4f8bdeb9d0871a318476e3",
- strip_prefix = "c-ares-6360e96b5cf8e5980c887ce58ef727e53d77243a",
- urls = [
- "https://storage.googleapis.com/grpc-bazel-mirror/github.com/c-ares/c-ares/archive/6360e96b5cf8e5980c887ce58ef727e53d77243a.tar.gz",
- "https://github.com/c-ares/c-ares/archive/6360e96b5cf8e5980c887ce58ef727e53d77243a.tar.gz",
- ],
- )
-
- if "com_google_absl" not in native.existing_rules():
- http_archive(
- name = "com_google_absl",
- sha256 = "59d2976af9d6ecf001a81a35749a6e551a335b949d34918cfade07737b9d93c5",
- strip_prefix = "abseil-cpp-20230802.0",
- urls = [
- "https://storage.googleapis.com/grpc-bazel-mirror/github.com/abseil/abseil-cpp/archive/20230802.0.tar.gz",
- "https://github.com/abseil/abseil-cpp/archive/20230802.0.tar.gz",
- ],
- )
-
if "bazel_toolchains" not in native.existing_rules():
# list of releases is at https://github.com/bazelbuild/bazel-toolchains/releases
http_archive(
@@ -348,27 +45,6 @@ def grpc_deps():
],
)
- if "bazel_skylib" not in native.existing_rules():
- http_archive(
- name = "bazel_skylib",
- urls = [
- "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz",
- "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz",
- ],
- sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c",
- )
-
- if "bazel_compdb" not in native.existing_rules():
- http_archive(
- name = "bazel_compdb",
- sha256 = "bcecfd622c4ef272fd4ba42726a52e140b961c4eac23025f18b346c968a8cfb4",
- strip_prefix = "bazel-compilation-database-0.4.5",
- urls = [
- "https://storage.googleapis.com/grpc-bazel-mirror/github.com/grailbio/bazel-compilation-database/archive/0.4.5.tar.gz",
- "https://github.com/grailbio/bazel-compilation-database/archive/0.4.5.tar.gz",
- ],
- )
-
if "io_opencensus_cpp" not in native.existing_rules():
http_archive(
name = "io_opencensus_cpp",
@@ -403,36 +79,6 @@ def grpc_deps():
],
)
- if "io_bazel_rules_go" not in native.existing_rules():
- http_archive(
- name = "io_bazel_rules_go",
- sha256 = "69de5c704a05ff37862f7e0f5534d4f479418afc21806c887db544a316f3cb6b",
- urls = [
- "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.27.0/rules_go-v0.27.0.tar.gz",
- "https://github.com/bazelbuild/rules_go/releases/download/v0.27.0/rules_go-v0.27.0.tar.gz",
- ],
- )
-
- if "build_bazel_rules_apple" not in native.existing_rules():
- http_archive(
- name = "build_bazel_rules_apple",
- sha256 = "f94e6dddf74739ef5cb30f000e13a2a613f6ebfa5e63588305a71fce8a8a9911",
- urls = [
- "https://storage.googleapis.com/grpc-bazel-mirror/github.com/bazelbuild/rules_apple/releases/download/1.1.3/rules_apple.1.1.3.tar.gz",
- "https://github.com/bazelbuild/rules_apple/releases/download/1.1.3/rules_apple.1.1.3.tar.gz",
- ],
- )
-
- if "build_bazel_apple_support" not in native.existing_rules():
- http_archive(
- name = "build_bazel_apple_support",
- sha256 = "f4fdf5c9b42b92ea12f229b265d74bb8cedb8208ca7a445b383c9f866cf53392",
- urls = [
- "https://storage.googleapis.com/grpc-bazel-mirror/github.com/bazelbuild/apple_support/releases/download/1.3.1/apple_support.1.3.1.tar.gz",
- "https://github.com/bazelbuild/apple_support/releases/download/1.3.1/apple_support.1.3.1.tar.gz",
- ],
- )
-
if "com_google_googleapis" not in native.existing_rules():
http_archive(
name = "com_google_googleapis",
@@ -506,17 +152,6 @@ def grpc_deps():
],
)
- if "io_opentelemetry_cpp" not in native.existing_rules():
- http_archive(
- name = "io_opentelemetry_cpp",
- sha256 = "f30cd88bf898a5726d245eba882b8e81012021eb00df34109f4dfb203f005cea",
- strip_prefix = "opentelemetry-cpp-1.11.0",
- urls = [
- "https://storage.googleapis.com/grpc-bazel-mirror/github.com/open-telemetry/opentelemetry-cpp/archive/refs/tags/v1.11.0.tar.gz",
- "https://github.com/open-telemetry/opentelemetry-cpp/archive/refs/tags/v1.11.0.tar.gz",
- ],
- )
-
if "google_cloud_cpp" not in native.existing_rules():
http_archive(
name = "google_cloud_cpp",
@@ -528,7 +163,15 @@ def grpc_deps():
],
)
- grpc_python_deps()
+ http_archive(
+ name = "com_github_cncf_udpa",
+ sha256 = "0d33b83f8c6368954e72e7785539f0d272a8aba2f6e2e336ed15fd1514bc9899",
+ strip_prefix = "xds-e9ce68804cb4e64cab5a52e3c8baf840d4ff87b7",
+ urls = [
+ "https://storage.googleapis.com/grpc-bazel-mirror/github.com/cncf/xds/archive/e9ce68804cb4e64cab5a52e3c8baf840d4ff87b7.tar.gz",
+ "https://github.com/cncf/xds/archive/e9ce68804cb4e64cab5a52e3c8baf840d4ff87b7.tar.gz",
+ ],
+ )
# TODO: move some dependencies from "grpc_deps" here?
# buildifier: disable=unnamed-macro
@@ -618,3 +261,5 @@ def grpc_test_only_deps():
strip_prefix = "libprotobuf-mutator-c390388561be36f94a559a4aed7e2fe60470f60b",
build_file = "@com_github_grpc_grpc//third_party:libprotobuf_mutator.BUILD",
)
+
+grpc_repo_deps_ext = module_extension(implementation = lambda ctx: grpc_deps())