[Build] Prepared for Bazel 7 (#35374)

This is a prerequisite change to start supporting Bazel 7. Changes are

- Disabled bzlmod which Bazel 7 begins to enable by default. This eventually needs to be done to support bzlmod but not now.
- Upgraded some bazel rule dependencies which are required to support Bazel 7.
- Using Python 3 explcitly as Bazel 7 begins to reject Python 2.

Note that this isn't enough to enable Bazel 7 by default and another PR will follow for that.

Closes #35374

PiperOrigin-RevId: 592931675
pull/35362/head
Esun Kim 11 months ago committed by Copybara-Service
parent f2e0ffc765
commit 594d370819
  1. 3
      .gitignore
  2. 7
      WORKSPACE
  3. 38
      bazel/grpc_deps.bzl
  4. 1
      test/cpp/naming/BUILD
  5. 2
      third_party/benchmark
  6. 4
      tools/bazel.rc
  7. 2
      tools/run_tests/sanity/check_bazel_workspace.py
  8. 2
      tools/run_tests/sanity/check_submodules.sh

3
.gitignore vendored

@ -181,3 +181,6 @@ iwyu_build/
# fuzzer logs
fuzz-*.log
# bazel module files (MODULE.bazel will need to be removed here)
MODULE.bazel
MODULE.bazel.lock

@ -89,6 +89,13 @@ http_archive(
url = "https://github.com/bazelbuild/rules_swift/releases/download/1.7.1/rules_swift.1.7.1.tar.gz",
)
load(
"@build_bazel_apple_support//lib:repositories.bzl",
"apple_support_dependencies",
)
apple_support_dependencies()
load(
"@build_bazel_rules_swift//swift:repositories.bzl",
"swift_rules_dependencies",

@ -230,6 +230,16 @@ def grpc_deps():
actual = "@com_google_googleapis//google/logging/v2:logging_cc_proto",
)
if "platforms" not in native.existing_rules():
http_archive(
name = "platforms",
sha256 = "8150406605389ececb6da07cbcb509d5637a3ab9a24bc69b1101531367d89d74",
urls = [
"https://storage.googleapis.com/grpc-bazel-mirror/github.com/bazelbuild/platforms/releases/download/0.0.8/platforms-0.0.8.tar.gz",
"https://github.com/bazelbuild/platforms/releases/download/0.0.8/platforms-0.0.8.tar.gz",
],
)
if "boringssl" not in native.existing_rules():
http_archive(
name = "boringssl",
@ -298,22 +308,22 @@ 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",
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.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",
"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 = "4e47ca279d5ae967c506c136bd8afb42eedcaf010aebb48a0e87790cae4b488a",
strip_prefix = "benchmark-015d1a091af6937488242b70121858bce8fd40e9",
sha256 = "8e7b955f04bc6984e4f14074d0d191474f76a6c8e849e04a9dced49bc975f2d4",
strip_prefix = "benchmark-344117638c8ff7e239044fd0fa7085839fc03021",
urls = [
# v1.8.2
"https://github.com/google/benchmark/archive/015d1a091af6937488242b70121858bce8fd40e9.tar.gz",
"https://storage.googleapis.com/grpc-bazel-mirror/github.com/google/benchmark/archive/344117638c8ff7e239044fd0fa7085839fc03021.tar.gz",
"https://github.com/google/benchmark/archive/344117638c8ff7e239044fd0fa7085839fc03021.tar.gz",
],
)
@ -419,20 +429,20 @@ def grpc_deps():
if "build_bazel_rules_apple" not in native.existing_rules():
http_archive(
name = "build_bazel_rules_apple",
sha256 = "f94e6dddf74739ef5cb30f000e13a2a613f6ebfa5e63588305a71fce8a8a9911",
sha256 = "34c41bfb59cdaea29ac2df5a2fa79e5add609c71bb303b2ebb10985f93fa20e7",
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",
"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 = "f4fdf5c9b42b92ea12f229b265d74bb8cedb8208ca7a445b383c9f866cf53392",
sha256 = "cf4d63f39c7ba9059f70e995bf5fe1019267d3f77379c2028561a5d7645ef67c",
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",
"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",
],
)

@ -32,6 +32,7 @@ grpc_py_binary(
srcs = [
"resolver_component_tests_runner.py",
],
python_version = "PY3",
)
grpc_cc_test(

@ -1 +1 @@
Subproject commit 015d1a091af6937488242b70121858bce8fd40e9
Subproject commit 344117638c8ff7e239044fd0fa7085839fc03021

@ -1,5 +1,9 @@
# bazelrc file
# Bazel 7 begins to enable module by default which breaks gRPC build.
# Therefore, this option is disabled until gRPC works with bzlmod.
common --enable_bzlmod=false
# for platform-appropriate cxxopts
common --enable_platform_specific_config

@ -47,6 +47,7 @@ _ZOPEFOUNDATION_ZOPE_INTERFACE_DEP_NAME = (
_TWISTED_CONSTANTLY_DEP_NAME = "com_github_twisted_constantly"
_GRPC_DEP_NAMES = [
"platforms",
"boringssl",
"zlib",
"com_google_protobuf",
@ -83,6 +84,7 @@ _GRPC_DEP_NAMES = [
]
_GRPC_BAZEL_ONLY_DEPS = [
"platforms",
"rules_cc",
"com_google_absl",
"com_google_fuzztest",

@ -26,7 +26,7 @@ want_submodules=$(mktemp /tmp/submXXXXXX)
git submodule | sed 's/+//g' | awk '{ print $2 " " $1 }' | sort >"$submodules"
cat <<EOF | sort >"$want_submodules"
third_party/abseil-cpp 29bf8085f3bf17b84d30e34b3d7ff8248fda404e
third_party/benchmark 015d1a091af6937488242b70121858bce8fd40e9
third_party/benchmark 344117638c8ff7e239044fd0fa7085839fc03021
third_party/bloaty 60209eb1ccc34d5deefb002d1b7f37545204f7f2
third_party/boringssl-with-bazel 2ff4b968a7e0cfee66d9f151cb95635b43dc1d5b
third_party/cares/cares 6360e96b5cf8e5980c887ce58ef727e53d77243a

Loading…
Cancel
Save