| diff --git a/bazel/cc_grpc_library.bzl b/bazel/cc_grpc_library.bzl |
| index 55ea11cd53..8177bf864c 100644 |
| --- a/bazel/cc_grpc_library.bzl |
| +++ b/bazel/cc_grpc_library.bzl |
| @@ -102,7 +102,7 @@ def cc_grpc_library( |
| generate_cc( |
| name = codegen_grpc_target, |
| srcs = proto_targets, |
| - plugin = "@com_github_grpc_grpc//src/compiler:grpc_cpp_plugin", |
| + plugin = Label("//src/compiler:grpc_cpp_plugin"), |
| well_known_protos = well_known_protos, |
| generate_mocks = generate_mocks, |
| **kwargs |
| @@ -114,6 +114,6 @@ def cc_grpc_library( |
| hdrs = [":" + codegen_grpc_target], |
| deps = deps + |
| extra_deps + |
| - ["@com_github_grpc_grpc//:grpc++_codegen_proto"], |
| + [Label("//:grpc++_codegen_proto")], |
| **kwargs |
| ) |
| diff --git a/bazel/cython_library.bzl b/bazel/cython_library.bzl |
| index dc2ef7a890..93e99962db 100644 |
| --- a/bazel/cython_library.bzl |
| +++ b/bazel/cython_library.bzl |
| @@ -72,7 +72,10 @@ def pyx_library(name, deps = [], py_deps = [], srcs = [], **kwargs): |
| native.cc_binary( |
| name = shared_object_name, |
| srcs = [stem + ".cpp"], |
| - deps = deps + ["@local_config_python//:python_headers"], |
| + deps = deps + [ |
| + "@rules_python//python/cc:current_py_cc_headers", |
| + "@rules_python//python/cc:current_py_cc_libs", |
| + ], |
| defines = defines, |
| linkshared = 1, |
| ) |
| diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl |
| index b54f9cee77..8043301a06 100644 |
| --- a/bazel/grpc_deps.bzl |
| +++ b/bazel/grpc_deps.bzl |
| @@ -20,170 +20,6 @@ load("//bazel:grpc_python_deps.bzl", "grpc_python_deps") |
| def grpc_deps(): |
| """Loads dependencies need to compile and test the grpc library.""" |
| |
| - if "platforms" not in native.existing_rules(): |
| - http_archive( |
| - name = "platforms", |
| - sha256 = "218efe8ee736d26a3572663b374a253c012b716d8af0c07e842e82f238a0a7ee", |
| - urls = [ |
| - "https://storage.googleapis.com/grpc-bazel-mirror/github.com/bazelbuild/platforms/releases/download/0.0.10/platforms-0.0.10.tar.gz", |
| - "https://github.com/bazelbuild/platforms/releases/download/0.0.10/platforms-0.0.10.tar.gz", |
| - ], |
| - ) |
| - |
| - 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 = "c70d519e4ee709b7a74410a5e3a937428b8198d793a3d771be3dd2086ae167c8", |
| - strip_prefix = "boringssl-b8b3e6e11166719a8ebfa43c0cde9ad7d57a84f6", |
| - urls = [ |
| - "https://storage.googleapis.com/grpc-bazel-mirror/github.com/google/boringssl/archive/b8b3e6e11166719a8ebfa43c0cde9ad7d57a84f6.tar.gz", |
| - "https://github.com/google/boringssl/archive/b8b3e6e11166719a8ebfa43c0cde9ad7d57a84f6.tar.gz", |
| - ], |
| - ) |
| - |
| - if "zlib" not in native.existing_rules(): |
| - http_archive( |
| - name = "zlib", |
| - build_file = "@com_github_grpc_grpc//third_party:zlib.BUILD", |
| - sha256 = "18337cdb32562003c39d9f7322b9a166ad4abfb2b909566428e11f96d2385586", |
| - strip_prefix = "zlib-09155eaa2f9270dc4ed1fa13e2b4b2613e6e4851", |
| - urls = [ |
| - "https://storage.googleapis.com/grpc-bazel-mirror/github.com/madler/zlib/archive/09155eaa2f9270dc4ed1fa13e2b4b2613e6e4851.tar.gz", |
| - "https://github.com/madler/zlib/archive/09155eaa2f9270dc4ed1fa13e2b4b2613e6e4851.tar.gz", |
| - ], |
| - ) |
| - |
| - if "com_google_protobuf" not in native.existing_rules(): |
| - http_archive( |
| - name = "com_google_protobuf", |
| - sha256 = "8766fce06ef41d79cb6037d04be37df3d5c493d9da92517a7243640d6389f03c", |
| - strip_prefix = "protobuf-10ef3f77683f77fb3c059bf47725c27b3ff41e63", |
| - urls = [ |
| - # https://github.com/protocolbuffers/protobuf/commits/v28.1 |
| - "https://storage.googleapis.com/grpc-bazel-mirror/github.com/protocolbuffers/protobuf/archive/10ef3f77683f77fb3c059bf47725c27b3ff41e63.tar.gz", |
| - "https://github.com/protocolbuffers/protobuf/archive/10ef3f77683f77fb3c059bf47725c27b3ff41e63.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 = "31bf78bd91b96dd5e24fab3bb1d7f3f7453ccbaceec9afb86d6e4816a15ab109", |
| - strip_prefix = "googletest-2dd1c131950043a8ad5ab0d2dda0e0970596586a", |
| - urls = [ |
| - # 2023-10-09 |
| - "https://github.com/google/googletest/archive/2dd1c131950043a8ad5ab0d2dda0e0970596586a.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 |
| - http_archive( |
| - name = "com_google_fuzztest", |
| - sha256 = "cdf8d8cd3cdc77280a7c59b310edf234e489a96b6e727cb271e7dfbeb9bcca8d", |
| - strip_prefix = "fuzztest-4ecaeb5084a061a862af8f86789ee184cd3d3f18", |
| - urls = [ |
| - # 2023-05-16 |
| - "https://github.com/google/fuzztest/archive/4ecaeb5084a061a862af8f86789ee184cd3d3f18.tar.gz", |
| - ], |
| - ) |
| - |
| - if "rules_cc" not in native.existing_rules(): |
| - http_archive( |
| - name = "rules_cc", |
| - sha256 = "2037875b9a4456dce4a79d112a8ae885bbc4aad968e6587dca6e64f3a0900cdf", |
| - strip_prefix = "rules_cc-0.0.9", |
| - urls = [ |
| - "https://storage.googleapis.com/grpc-bazel-mirror/github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz", |
| - "https://github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz", |
| - ], |
| - ) |
| - |
| - if "com_github_google_benchmark" not in native.existing_rules(): |
| - http_archive( |
| - name = "com_github_google_benchmark", |
| - sha256 = "8e7b955f04bc6984e4f14074d0d191474f76a6c8e849e04a9dced49bc975f2d4", |
| - strip_prefix = "benchmark-344117638c8ff7e239044fd0fa7085839fc03021", |
| - urls = [ |
| - "https://storage.googleapis.com/grpc-bazel-mirror/github.com/google/benchmark/archive/344117638c8ff7e239044fd0fa7085839fc03021.tar.gz", |
| - "https://github.com/google/benchmark/archive/344117638c8ff7e239044fd0fa7085839fc03021.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 = "f50e5ac311a81382da7fa75b97310e4b9006474f9560ac46f54a9967f07d4ae3", |
| - strip_prefix = "abseil-cpp-20240722.0", |
| - urls = [ |
| - "https://storage.googleapis.com/grpc-bazel-mirror/github.com/abseil/abseil-cpp/archive/20240722.0.tar.gz", |
| - "https://github.com/abseil/abseil-cpp/archive/20240722.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( |
| - name = "bazel_toolchains", |
| - sha256 = "179ec02f809e86abf56356d8898c8bd74069f1bd7c56044050c2cd3d79d0e024", |
| - strip_prefix = "bazel-toolchains-4.1.0", |
| - urls = [ |
| - "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/releases/download/4.1.0/bazel-toolchains-4.1.0.tar.gz", |
| - "https://github.com/bazelbuild/bazel-toolchains/releases/download/4.1.0/bazel-toolchains-4.1.0.tar.gz", |
| - ], |
| - ) |
| - |
| - 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.7.1/bazel-skylib-1.7.1.tar.gz", |
| - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.7.1/bazel-skylib-1.7.1.tar.gz", |
| - ], |
| - sha256 = "bc283cdfcd526a52c3201279cda4bc298652efa898b10b4db0837dc51652756f", |
| - ) |
| - |
| - 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", |
| @@ -206,89 +42,6 @@ def grpc_deps(): |
| ], |
| ) |
| |
| - # TODO(roth): Need to override version of rules_proto, because |
| - # we're using a newer version of rules_go than the xDS protos are, |
| - # and that requires a newer version of rules_proto. In turn, the |
| - # newer version of rules_proto requires a newer version of |
| - # bazel_features. So these two entries can go away once the xDS |
| - # protos upgrade to the newer version of rules_go. |
| - if "bazel_features" not in native.existing_rules(): |
| - http_archive( |
| - name = "bazel_features", |
| - sha256 = "5ac743bf5f05d88e84962e978811f2524df09602b789c92cf7ae2111ecdeda94", |
| - strip_prefix = "bazel_features-1.14.0", |
| - urls = [ |
| - "https://storage.googleapis.com/grpc-bazel-mirror/github.com/bazel-contrib/bazel_features/releases/download/v1.14.0/bazel_features-v1.14.0.tar.gz", |
| - "https://github.com/bazel-contrib/bazel_features/releases/download/v1.14.0/bazel_features-v1.14.0.tar.gz", |
| - ], |
| - ) |
| - if "rules_proto" not in native.existing_rules(): |
| - http_archive( |
| - name = "rules_proto", |
| - sha256 = "6fb6767d1bef535310547e03247f7518b03487740c11b6c6adb7952033fe1295", |
| - strip_prefix = "rules_proto-6.0.2", |
| - urls = [ |
| - "https://storage.googleapis.com/grpc-bazel-mirror/github.com/bazelbuild/rules_proto/archive/refs/tags/6.0.2.tar.gz", |
| - "https://github.com/bazelbuild/rules_proto/archive/refs/tags/6.0.2.tar.gz", |
| - ], |
| - ) |
| - |
| - if "io_bazel_rules_go" not in native.existing_rules(): |
| - http_archive( |
| - name = "io_bazel_rules_go", |
| - sha256 = "d93ef02f1e72c82d8bb3d5169519b36167b33cf68c252525e3b9d3d5dd143de7", |
| - urls = [ |
| - "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.49.0/rules_go-v0.49.0.zip", |
| - "https://github.com/bazelbuild/rules_go/releases/download/v0.49.0/rules_go-v0.49.0.zip", |
| - ], |
| - patches = [ |
| - "@com_github_grpc_grpc//bazel:rules_go.patch", |
| - ], |
| - patch_args = ["-p1"], |
| - ) |
| - |
| - if "build_bazel_rules_apple" not in native.existing_rules(): |
| - http_archive( |
| - name = "build_bazel_rules_apple", |
| - sha256 = "34c41bfb59cdaea29ac2df5a2fa79e5add609c71bb303b2ebb10985f93fa20e7", |
| - urls = [ |
| - "https://storage.googleapis.com/grpc-bazel-mirror/github.com/bazelbuild/rules_apple/releases/download/3.1.1/rules_apple.3.1.1.tar.gz", |
| - "https://github.com/bazelbuild/rules_apple/releases/download/3.1.1/rules_apple.3.1.1.tar.gz", |
| - ], |
| - ) |
| - |
| - if "build_bazel_apple_support" not in native.existing_rules(): |
| - http_archive( |
| - name = "build_bazel_apple_support", |
| - sha256 = "cf4d63f39c7ba9059f70e995bf5fe1019267d3f77379c2028561a5d7645ef67c", |
| - urls = [ |
| - "https://storage.googleapis.com/grpc-bazel-mirror/github.com/bazelbuild/apple_support/releases/download/1.11.1/apple_support.1.11.1.tar.gz", |
| - "https://github.com/bazelbuild/apple_support/releases/download/1.11.1/apple_support.1.11.1.tar.gz", |
| - ], |
| - ) |
| - |
| - if "com_google_googleapis" not in native.existing_rules(): |
| - http_archive( |
| - name = "com_google_googleapis", |
| - sha256 = "0513f0f40af63bd05dc789cacc334ab6cec27cc89db596557cb2dfe8919463e4", |
| - strip_prefix = "googleapis-fe8ba054ad4f7eca946c2d14a63c3f07c0b586a0", |
| - build_file = Label("//bazel:googleapis.BUILD"), |
| - urls = [ |
| - "https://storage.googleapis.com/grpc-bazel-mirror/github.com/googleapis/googleapis/archive/fe8ba054ad4f7eca946c2d14a63c3f07c0b586a0.tar.gz", |
| - "https://github.com/googleapis/googleapis/archive/fe8ba054ad4f7eca946c2d14a63c3f07c0b586a0.tar.gz", |
| - ], |
| - ) |
| - |
| - if "bazel_gazelle" not in native.existing_rules(): |
| - http_archive( |
| - name = "bazel_gazelle", |
| - sha256 = "d76bf7a60fd8b050444090dfa2837a4eaf9829e1165618ee35dceca5cbdf58d5", |
| - urls = [ |
| - "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.37.0/bazel-gazelle-v0.37.0.tar.gz", |
| - "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.37.0/bazel-gazelle-v0.37.0.tar.gz", |
| - ], |
| - ) |
| - |
| if "opencensus_proto" not in native.existing_rules(): |
| http_archive( |
| name = "opencensus_proto", |
| @@ -308,46 +61,6 @@ def grpc_deps(): |
| urls = ["https://github.com/bufbuild/protoc-gen-validate/archive/refs/tags/v1.0.4.zip"], |
| ) |
| |
| - if "com_github_cncf_xds" not in native.existing_rules(): |
| - http_archive( |
| - name = "com_github_cncf_xds", |
| - sha256 = "dc305e20c9fa80822322271b50aa2ffa917bf4fd3973bcec52bfc28dc32c5927", |
| - strip_prefix = "xds-3a472e524827f72d1ad621c4983dd5af54c46776", |
| - urls = [ |
| - "https://storage.googleapis.com/grpc-bazel-mirror/github.com/cncf/xds/archive/3a472e524827f72d1ad621c4983dd5af54c46776.tar.gz", |
| - "https://github.com/cncf/xds/archive/3a472e524827f72d1ad621c4983dd5af54c46776.tar.gz", |
| - ], |
| - ) |
| - |
| - # TODO(stanleycheung): remove this when prometheus-cpp AND |
| - # opentelemetry-cpp cut a new release |
| - # This override is needed because this fix |
| - # https://github.com/jupp0r/prometheus-cpp/pull/626 |
| - # has not been included in the latest prometheus-cpp release yet. |
| - # We also need opentelemetry-cpp to update their dependency on |
| - # prometheus-cpp after that fix is released. |
| - # Without the fix, we cannot build the prometheus exporter with bazel 6 |
| - if "com_github_jupp0r_prometheus_cpp" not in native.existing_rules(): |
| - http_archive( |
| - name = "com_github_jupp0r_prometheus_cpp", |
| - sha256 = "cdf03ee63fcb1d9e113f7bd525e043c254729dddf19d80396489f5b92c83c18d", |
| - strip_prefix = "prometheus-cpp-b1234816facfdda29845c46696a02998a4af115a", |
| - urls = [ |
| - "https://github.com/jupp0r/prometheus-cpp/archive/b123481.zip", |
| - ], |
| - ) |
| - |
| - if "io_opentelemetry_cpp" not in native.existing_rules(): |
| - http_archive( |
| - name = "io_opentelemetry_cpp", |
| - sha256 = "ed681d20a684b7d485a49288e7cfb2d182bf882e5c112c5f2fa3f9e9da2278fc", |
| - strip_prefix = "opentelemetry-cpp-4bd64c9a336fd438d6c4c9dad2e6b61b0585311f", |
| - urls = [ |
| - "https://storage.googleapis.com/grpc-bazel-mirror/github.com/open-telemetry/opentelemetry-cpp/archive/4bd64c9a336fd438d6c4c9dad2e6b61b0585311f.tar.gz", |
| - "https://github.com/open-telemetry/opentelemetry-cpp/archive/4bd64c9a336fd438d6c4c9dad2e6b61b0585311f.tar.gz", |
| - ], |
| - ) |
| - |
| if "google_cloud_cpp" not in native.existing_rules(): |
| http_archive( |
| name = "google_cloud_cpp", |
| @@ -359,7 +72,6 @@ def grpc_deps(): |
| ], |
| ) |
| |
| - grpc_python_deps() |
| |
| # TODO: move some dependencies from "grpc_deps" here? |
| # buildifier: disable=unnamed-macro |
| @@ -440,3 +152,5 @@ def grpc_test_only_deps(): |
| strip_prefix = "libprotobuf-mutator-1f95f8083066f5b38fd2db172e7e7f9aa7c49d2d", |
| build_file = "@com_github_grpc_grpc//third_party:libprotobuf_mutator.BUILD", |
| ) |
| + |
| +grpc_repo_deps_ext = module_extension(implementation = lambda ctx: grpc_deps()) |
| diff --git a/bazel/grpc_python_deps.bzl b/bazel/grpc_python_deps.bzl |
| index 44eca11f67..ca1ebbc185 100644 |
| --- a/bazel/grpc_python_deps.bzl |
| +++ b/bazel/grpc_python_deps.bzl |
| @@ -16,6 +16,19 @@ |
| load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") |
| load("@com_github_grpc_grpc//third_party/py:python_configure.bzl", "python_configure") |
| |
| +# buildifier: disable=unnamed-macro |
| +def cython(): |
| + http_archive( |
| + name = "cython", |
| + build_file = "@com_github_grpc_grpc//third_party:cython.BUILD", |
| + sha256 = "a2da56cc22be823acf49741b9aa3aa116d4f07fa8e8b35a3cb08b8447b37c607", |
| + strip_prefix = "cython-0.29.35", |
| + urls = [ |
| + "https://github.com/cython/cython/archive/0.29.35.tar.gz", |
| + ], |
| + ) |
| + |
| + |
| # buildifier: disable=unnamed-macro |
| def grpc_python_deps(): |
| """Loads dependencies for gRPC Python.""" |
| @@ -35,12 +48,6 @@ def grpc_python_deps(): |
| ) |
| |
| if "cython" not in native.existing_rules(): |
| - http_archive( |
| - name = "cython", |
| - build_file = "@com_github_grpc_grpc//third_party:cython.BUILD", |
| - sha256 = "2ec7d66d23d6da2328fb24f5c1bec6c63a59ec2e91027766ab904f417e1078aa", |
| - strip_prefix = "cython-3.0.11", |
| - urls = [ |
| - "https://github.com/cython/cython/archive/3.0.11.tar.gz", |
| - ], |
| - ) |
| + cython() |
| + |
| +grpc_python_deps_ext = module_extension(implementation = lambda ctx: cython()) |
| diff --git a/bazel/python_rules.bzl b/bazel/python_rules.bzl |
| index e195d2790b..5924fd5b5e 100644 |
| --- a/bazel/python_rules.bzl |
| +++ b/bazel/python_rules.bzl |
| @@ -190,11 +190,7 @@ def _generate_pb2_grpc_src_impl(context): |
| arguments = [] |
| tools = [context.executable._protoc, context.executable._grpc_plugin] |
| out_dir = get_out_dir(protos, context) |
| - if out_dir.import_path: |
| - # is virtual imports |
| - out_path = out_dir.path |
| - else: |
| - out_path = context.genfiles_dir.path |
| + out_path = out_dir.path |
| arguments += get_plugin_args( |
| context.executable._grpc_plugin, |
| plugin_flags, |