From 93ffc9d61dfd8f5b05029d8b1544014fbb5dc7ff Mon Sep 17 00:00:00 2001 From: Google APIs Date: Thu, 4 May 2023 15:41:55 -0700 Subject: [PATCH] chore: upgrading Bazel gRPC dependency to 1.54.1 PiperOrigin-RevId: 529534324 --- WORKSPACE | 155 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 81 insertions(+), 74 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index cd83a7028c..96fc9ecf84 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -77,6 +77,85 @@ load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies") rules_pkg_dependencies() +# This must be above the download of gRPC (in C++ section) and +# rules_gapic_repositories because both depend on rules_go and we need to manage +# our version of rules_go explicitly rather than depend on the version those +# bring in transitively. +_io_bazel_rules_go_version = "0.34.0" + +http_archive( + name = "io_bazel_rules_go", + sha256 = "16e9fca53ed6bd4ff4ad76facc9b7b651a89db1689a2877d6fd7b82aa824e366", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v{0}/rules_go-v{0}.zip".format(_io_bazel_rules_go_version), + "https://github.com/bazelbuild/rules_go/releases/download/v{0}/rules_go-v{0}.zip".format(_io_bazel_rules_go_version), + ], +) + +############################################################################## +# C++ +############################################################################## +# C++ must go before everything else, since the key dependencies (protobuf and gRPC) +# are C++ repositories and they have the highest chance to have the correct versions of the +# transitive dependencies (for those dependencies which are shared by many other repositories +# imported in this workspace). +# +# This comes before Protobuf's section, meaning we prioritize gRPC's dependencies +# (including upb and absl) over Protobuf's. Because the gRPC team prioritizes their +# own dependencies when they test gRPC and Protobuf compatibility, gRPC's dependencies have +# better chance to make it work. +# +# Note, even though protobuf and gRPC are mostly written in C++, they are used to generate stuff +# for most of the other languages as well, so they can be considered as the core cross-language +# dependencies. + +# Import boringssl explicitly to override what gRPC imports as its dependency. +# Boringssl build fails on gcc12 without this fix: +# https://github.com/google/boringssl/commit/8462a367bb57e9524c3d8eca9c62733c63a63cf4, +# which is present only in the newest version of boringssl, not the one imported +# by gRPC. Remove this import once gRPC depends on a newer version. +http_archive( + name = "boringssl", + sha256 = "b460f8673f3393e58ce506e9cdde7f2c3b2575b075f214cb819fb57d809f052b", + strip_prefix = "boringssl-bb41bc007079982da419c0ec3186e510cbcf09d0", + urls = [ + "https://github.com/google/boringssl/archive/bb41bc007079982da419c0ec3186e510cbcf09d0.zip", + ], +) + +_grpc_version = "1.54.1" + +_grpc_sha256 = "8f01dac5a32104acbb76db1e6b447dc5b3dc738cb9bceeee01843d9d01d1d788" + +http_archive( + name = "com_github_grpc_grpc", + sha256 = _grpc_sha256, + strip_prefix = "grpc-%s" % _grpc_version, + urls = ["https://github.com/grpc/grpc/archive/v%s.zip" % _grpc_version], +) + +load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps") + +# This declares com_google_protobuf repository +grpc_deps() + +# gRPC enforces a specific version of Go toolchain which conflicts with our build. +# All the relevant parts of grpc_extra_deps() are imported in this WORKSPACE file +# explicitly, that is why we do not call grpc_extra_deps() here and call +# apple_rules_dependencies and apple_support_dependencies macros explicitly. + +load("@build_bazel_rules_apple//apple:repositories.bzl", "apple_rules_dependencies") + +apple_rules_dependencies() + +load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependencies") + +apple_support_dependencies() + +# End of C++ section + +# Explicitly declaring Protobuf version, while Protobuf dependency is already +# instantiated in grpc_deps(). http_archive( name = "com_google_protobuf", sha256 = "930c2c3b5ecc6c9c12615cf5ad93f1cd6e12d0aba862b572e076259970ac3a53", @@ -84,8 +163,9 @@ http_archive( urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.21.12.tar.gz"], ) -load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps", "PROTOBUF_MAVEN_ARTIFACTS") +# This is actually already done within grpc_deps but calling this for Bazel convention. protobuf_deps() http_archive( @@ -122,21 +202,6 @@ http_archive( urls = ["https://github.com/googleapis/rules_gapic/archive/v%s.tar.gz" % _rules_gapic_version], ) -# This must be above the download of gRPC (in C++ section) and -# rules_gapic_repositories because both depend on rules_go and we need to manage -# our version of rules_go explicitly rather than depend on the version those -# bring in transitively. -_io_bazel_rules_go_version = "0.34.0" - -http_archive( - name = "io_bazel_rules_go", - sha256 = "16e9fca53ed6bd4ff4ad76facc9b7b651a89db1689a2877d6fd7b82aa824e366", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v{0}/rules_go-v{0}.zip".format(_io_bazel_rules_go_version), - "https://github.com/bazelbuild/rules_go/releases/download/v{0}/rules_go-v{0}.zip".format(_io_bazel_rules_go_version), - ], -) - # Gazelle dependency version should match gazelle dependency expected by gRPC _bazel_gazelle_version = "0.24.0" @@ -159,10 +224,6 @@ local_repository( path = ".", ) -# Until this project is migrated to consume the new subdirectory of generated -# types e.g. longrunningpb, we must define our own version of longrunning here. -load("@bazel_gazelle//:deps.bzl", "go_repository") - _gapic_generator_go_version = "0.35.7" http_archive( @@ -192,63 +253,9 @@ load("@rules_gapic//:repositories.bzl", "rules_gapic_repositories") rules_gapic_repositories() -############################################################################## -# C++ -############################################################################## -# C++ must go before everything else, since the key dependencies (protobuf and gRPC) -# are C++ repositories and they have the highest chance to have the correct versions of the -# transitive dependencies (for those dependencies which are shared by many other repositories -# imported in this workspace). -# -# Note, even though protobuf and gRPC are mostly written in C++, they are used to generate stuff -# for most of the other languages as well, so they can be considered as the core cross-language -# dependencies. - -# Import boringssl explicitly to override what gRPC imports as its dependency. -# Boringssl build fails on gcc12 without this fix: -# https://github.com/google/boringssl/commit/8462a367bb57e9524c3d8eca9c62733c63a63cf4, -# which is present only in the newest version of boringssl, not the one imported -# by gRPC. Remove this import once gRPC depends on a newer version. -http_archive( - name = "boringssl", - sha256 = "b460f8673f3393e58ce506e9cdde7f2c3b2575b075f214cb819fb57d809f052b", - strip_prefix = "boringssl-bb41bc007079982da419c0ec3186e510cbcf09d0", - urls = [ - "https://github.com/google/boringssl/archive/bb41bc007079982da419c0ec3186e510cbcf09d0.zip", - ], -) - -_grpc_version = "1.47.0" - -_grpc_sha256 = "edf25f4db6c841853b7a29d61b0980b516dc31a1b6cdc399bcf24c1446a4a249" - -http_archive( - name = "com_github_grpc_grpc", - sha256 = _grpc_sha256, - strip_prefix = "grpc-%s" % _grpc_version, - urls = ["https://github.com/grpc/grpc/archive/v%s.zip" % _grpc_version], -) - -load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps") - -grpc_deps() - -# gRPC enforces a specific version of Go toolchain which conflicts with our build. -# All the relevant parts of grpc_extra_deps() are imported in this WORKSPACE file -# explicitly, that is why we do not call grpc_extra_deps() here. - -load("@build_bazel_rules_apple//apple:repositories.bzl", "apple_rules_dependencies") - -apple_rules_dependencies() - -load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependencies") - -apple_support_dependencies() - ############################################################################## # Java ############################################################################## -load("@com_google_protobuf//:protobuf_deps.bzl", "PROTOBUF_MAVEN_ARTIFACTS") # Starting in protobuf 3.19, protobuf project started to provide # PROTOBUF_MAVEN_ARTIFACTS variable so that Bazel users can resolve their