From 3fe06af9a305ff6df97e9b936a9a94fc4350526c Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Fri, 12 Apr 2024 13:57:15 -0700 Subject: [PATCH] [Build] No bind for upb (#36349) To simplify the build process, let's remove unnecessary Bazel bindings. These bindings were originally used to manage differences between OSS and our internal build environment. However, bindings are now deprecated and introduce unnecessary complexity. Removing them will make the build process more straightforward and easier to maintain. Closes #36349 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36349 from veblush:upb-link 3eda0c6f920fe7fd3c402ac460bad2b5cc1f908b PiperOrigin-RevId: 624284314 --- BUILD | 56 ++++++++++++++++++------------------- bazel/grpc_build_system.bzl | 4 ++- bazel/grpc_deps.bzl | 30 -------------------- src/core/BUILD | 40 +++++++++++++------------- src/cpp/ext/csm/BUILD | 4 +-- 5 files changed, 53 insertions(+), 81 deletions(-) diff --git a/BUILD b/BUILD index a00c15228a0..0298f22bc82 100644 --- a/BUILD +++ b/BUILD @@ -1054,9 +1054,9 @@ grpc_cc_library( "absl/strings", "absl/types:optional", "absl/types:span", - "upb_base_lib", - "upb_mem_lib", - "upb_message_lib", + "@com_google_protobuf//upb:base", + "@com_google_protobuf//upb:mem", + "@com_google_protobuf//upb:message", ], language = "c++", deps = [ @@ -1277,9 +1277,9 @@ grpc_cc_library( "include/grpcpp/security/alts_util.h", ], external_deps = [ - "upb_base_lib", - "upb_mem_lib", - "upb_message_lib", + "@com_google_protobuf//upb:base", + "@com_google_protobuf//upb:mem", + "@com_google_protobuf//upb:message", ], language = "c++", standalone = True, @@ -2347,8 +2347,8 @@ grpc_cc_library( "//src/core:tsi/alts/handshaker/transport_security_common_api.h", ], external_deps = [ - "upb_base_lib", - "upb_mem_lib", + "@com_google_protobuf//upb:base", + "@com_google_protobuf//upb:mem", ], language = "c++", visibility = ["@grpc:tsi"], @@ -2365,8 +2365,8 @@ grpc_cc_library( "libssl", "libcrypto", "absl/strings", - "upb_base_lib", - "upb_mem_lib", + "@com_google_protobuf//upb:base", + "@com_google_protobuf//upb:mem", ], language = "c++", tags = ["nofixdeps"], @@ -2410,8 +2410,8 @@ grpc_cc_library( "absl/synchronization", "absl/memory", "absl/types:optional", - "upb_base_lib", - "upb_mem_lib", + "@com_google_protobuf//upb:base", + "@com_google_protobuf//upb:mem", "protobuf_headers", "absl/container:inlined_vector", ], @@ -2490,8 +2490,8 @@ grpc_cc_library( "absl/synchronization", "absl/types:optional", "absl/memory", - "upb_base_lib", - "upb_mem_lib", + "@com_google_protobuf//upb:base", + "@com_google_protobuf//upb:mem", "absl/strings:str_format", "protobuf_headers", ], @@ -2664,8 +2664,8 @@ grpc_cc_library( "absl/strings", "absl/time", "absl/types:optional", - "upb_base_lib", - "upb_mem_lib", + "@com_google_protobuf//upb:base", + "@com_google_protobuf//upb:mem", ], language = "c++", public_hdrs = [ @@ -3501,8 +3501,8 @@ grpc_cc_library( "absl/base:core_headers", "absl/status", "absl/strings", - "upb_base_lib", - "upb_mem_lib", + "@com_google_protobuf//upb:base", + "@com_google_protobuf//upb:mem", ], language = "c++", deps = [ @@ -3602,9 +3602,9 @@ grpc_cc_library( "absl/strings:cord", "absl/types:optional", "absl/types:variant", - "upb_base_lib", - "upb_mem_lib", - "upb_message_lib", + "@com_google_protobuf//upb:base", + "@com_google_protobuf//upb:mem", + "@com_google_protobuf//upb:message", ], language = "c++", visibility = ["@grpc:client_channel"], @@ -4004,8 +4004,8 @@ grpc_cc_library( ], external_deps = [ "absl/strings", - "upb_base_lib", - "upb_mem_lib", + "@com_google_protobuf//upb:base", + "@com_google_protobuf//upb:mem", ], language = "c++", visibility = ["@grpc:public"], @@ -4257,11 +4257,11 @@ grpc_cc_library( "absl/strings", "absl/strings:str_format", "absl/types:optional", - "upb_base_lib", - "upb_mem_lib", - "upb_textformat_lib", - "upb_json_lib", - "upb_reflection", + "@com_google_protobuf//upb:base", + "@com_google_protobuf//upb:mem", + "@com_google_protobuf//upb:text", + "@com_google_protobuf//upb:json", + "@com_google_protobuf//upb:reflection", ], language = "c++", tags = ["nofixdeps"], diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index 0a679a0b2a9..1da3bac40ab 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -58,7 +58,9 @@ def if_windows(a): def _get_external_deps(external_deps): ret = [] for dep in external_deps: - if dep == "address_sorting": + if dep.startswith("@"): + ret.append(dep) + elif dep == "address_sorting": ret.append("//third_party/address_sorting") elif dep == "xxhash": ret.append("//third_party/xxhash") diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl index 24a60a59b94..328c2a45c72 100644 --- a/bazel/grpc_deps.bzl +++ b/bazel/grpc_deps.bzl @@ -20,36 +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_base_lib", - actual = "@com_google_protobuf//upb/base", - ) - - native.bind( - name = "upb_message_lib", - actual = "@com_google_protobuf//upb:message", - ) - - native.bind( - name = "upb_mem_lib", - actual = "@com_google_protobuf//upb/mem", - ) - - native.bind( - name = "upb_reflection", - actual = "@com_google_protobuf//upb:reflection", - ) - - native.bind( - name = "upb_textformat_lib", - actual = "@com_google_protobuf//upb/text", - ) - - native.bind( - name = "upb_json_lib", - actual = "@com_google_protobuf//upb/json", - ) - native.bind( name = "libssl", actual = "@boringssl//:ssl", diff --git a/src/core/BUILD b/src/core/BUILD index f7733378c45..437735b143f 100644 --- a/src/core/BUILD +++ b/src/core/BUILD @@ -364,8 +364,8 @@ grpc_cc_library( "absl/strings:cord", "absl/time", "absl/types:optional", - "upb_base_lib", - "upb_mem_lib", + "@com_google_protobuf//upb:base", + "@com_google_protobuf//upb:mem", ], language = "c++", deps = [ @@ -3481,9 +3481,9 @@ grpc_cc_library( ], external_deps = [ "absl/strings", - "upb_base_lib", - "upb_mem_lib", - "upb_message_lib", + "@com_google_protobuf//upb:base", + "@com_google_protobuf//upb:mem", + "@com_google_protobuf//upb:message", ], language = "c++", deps = [ @@ -4767,8 +4767,8 @@ grpc_cc_library( "absl/strings:str_format", "absl/types:optional", "absl/types:variant", - "upb_base_lib", - "upb_mem_lib", + "@com_google_protobuf//upb:base", + "@com_google_protobuf//upb:mem", ], language = "c++", deps = [ @@ -4883,8 +4883,8 @@ grpc_cc_library( "absl/strings", "absl/strings:str_format", "absl/types:optional", - "upb_base_lib", - "upb_mem_lib", + "@com_google_protobuf//upb:base", + "@com_google_protobuf//upb:mem", ], language = "c++", deps = [ @@ -4944,7 +4944,7 @@ grpc_cc_library( ], external_deps = [ "absl/strings", - "upb_base_lib", + "@com_google_protobuf//upb:base", ], language = "c++", deps = ["//:gpr_platform"], @@ -5020,13 +5020,13 @@ grpc_cc_library( "absl/types:optional", "absl/types:span", "absl/types:variant", - "upb_base_lib", - "upb_mem_lib", - "upb_textformat_lib", - "upb_json_lib", + "@com_google_protobuf//upb:base", + "@com_google_protobuf//upb:mem", + "@com_google_protobuf//upb:text", + "@com_google_protobuf//upb:json", "re2", - "upb_reflection", - "upb_message_lib", + "@com_google_protobuf//upb:reflection", + "@com_google_protobuf//upb:message", ], language = "c++", tags = ["nofixdeps"], @@ -5491,8 +5491,8 @@ grpc_cc_library( "absl/status:statusor", "absl/strings", "absl/types:optional", - "upb_base_lib", - "upb_mem_lib", + "@com_google_protobuf//upb:base", + "@com_google_protobuf//upb:mem", ], language = "c++", deps = [ @@ -6107,8 +6107,8 @@ grpc_cc_library( "absl/status:statusor", "absl/strings", "absl/types:optional", - "upb_base_lib", - "upb_mem_lib", + "@com_google_protobuf//upb:base", + "@com_google_protobuf//upb:mem", ], language = "c++", deps = [ diff --git a/src/cpp/ext/csm/BUILD b/src/cpp/ext/csm/BUILD index e822ea37b65..e534f117607 100644 --- a/src/cpp/ext/csm/BUILD +++ b/src/cpp/ext/csm/BUILD @@ -49,8 +49,8 @@ grpc_cc_library( "otel/api", "otel/sdk/src/metrics", "otel/sdk:headers", - "upb_base_lib", - "upb_mem_lib", + "@com_google_protobuf//upb:base", + "@com_google_protobuf//upb:mem", ], language = "c++", visibility = ["//:__subpackages__"],