XdsClient: refactor BUILD rules to minimize gRPC-specific dependencies for core XdsClient code (#30767)

* XdsClient: refactor BUILD rules to minimize gRPC-specific dependencies for core XdsClient code

* add visibility tag
pull/30790/head
Mark D. Roth 2 years ago committed by GitHub
parent 8d6352afd5
commit 6acdcee57c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 132
      BUILD
  2. 1
      bazel/grpc_build_system.bzl
  3. 7
      test/core/backoff/BUILD
  4. 3
      test/core/backoff/backoff_test.cc

132
BUILD

@ -2866,6 +2866,24 @@ grpc_cc_library(
],
)
grpc_cc_library(
name = "backoff",
srcs = [
"src/core/lib/backoff/backoff.cc",
],
hdrs = [
"src/core/lib/backoff/backoff.h",
],
external_deps = ["absl/random"],
language = "c++",
visibility = ["@grpc:alt_grpc_base_legacy"],
deps = [
"exec_ctx",
"gpr_platform",
"time",
],
)
grpc_cc_library(
name = "pollset_set",
srcs = [
@ -2884,7 +2902,6 @@ grpc_cc_library(
name = "grpc_base",
srcs = [
"src/core/lib/address_utils/parse_address.cc",
"src/core/lib/backoff/backoff.cc",
"src/core/lib/channel/channel_stack.cc",
"src/core/lib/channel/channel_stack_builder_impl.cc",
"src/core/lib/channel/channel_trace.cc",
@ -2993,7 +3010,6 @@ grpc_cc_library(
"src/core/lib/transport/error_utils.h",
"src/core/lib/transport/http2_errors.h",
"src/core/lib/address_utils/parse_address.h",
"src/core/lib/backoff/backoff.h",
"src/core/lib/channel/call_finalization.h",
"src/core/lib/channel/call_tracer.h",
"src/core/lib/channel/channel_stack.h",
@ -3601,6 +3617,7 @@ grpc_cc_library(
visibility = ["@grpc:client_channel"],
deps = [
"arena",
"backoff",
"channel_fwd",
"channel_init",
"channel_stack_type",
@ -4074,6 +4091,7 @@ grpc_cc_library(
],
language = "c++",
deps = [
"backoff",
"channel_fwd",
"channel_init",
"channel_stack_type",
@ -4145,6 +4163,7 @@ grpc_cc_library(
],
language = "c++",
deps = [
"backoff",
"config",
"debug_location",
"dual_ref_counted",
@ -4177,19 +4196,97 @@ grpc_cc_library(
],
)
grpc_cc_library(
name = "upb_utils",
hdrs = [
"src/core/ext/xds/upb_utils.h",
],
external_deps = [
"absl/strings",
"upb_lib",
],
language = "c++",
deps = ["gpr_platform"],
)
grpc_cc_library(
name = "xds_client",
srcs = [
"src/core/ext/xds/xds_api.cc",
"src/core/ext/xds/xds_bootstrap.cc",
"src/core/ext/xds/xds_client.cc",
"src/core/ext/xds/xds_client_stats.cc",
"src/core/ext/xds/xds_resource_type.cc",
],
hdrs = [
"src/core/ext/xds/xds_api.h",
"src/core/ext/xds/xds_bootstrap.h",
"src/core/ext/xds/xds_channel_args.h",
"src/core/ext/xds/xds_client.h",
"src/core/ext/xds/xds_client_stats.h",
"src/core/ext/xds/xds_resource_type.h",
"src/core/ext/xds/xds_resource_type_impl.h",
"src/core/ext/xds/xds_transport.h",
],
external_deps = [
"absl/base:core_headers",
"absl/memory",
"absl/status",
"absl/status:statusor",
"absl/strings",
"absl/strings:str_format",
"absl/types:optional",
"upb_lib",
"upb_textformat_lib",
"upb_json_lib",
"upb_reflection",
],
language = "c++",
tags = ["nofixdeps"],
visibility = ["@grpc:xds_client_core"],
deps = [
"backoff",
"debug_location",
"default_event_engine",
"dual_ref_counted",
"envoy_admin_upb",
"envoy_config_core_upb",
"envoy_config_endpoint_upb",
"envoy_service_discovery_upb",
"envoy_service_discovery_upbdefs",
"envoy_service_load_stats_upb",
"envoy_service_load_stats_upbdefs",
"envoy_service_status_upb",
"envoy_service_status_upbdefs",
"event_engine_base_hdrs",
"exec_ctx",
"google_rpc_status_upb",
"gpr",
"gpr_codegen",
"grpc_trace",
"json",
"orphanable",
"protobuf_any_upb",
"protobuf_duration_upb",
"protobuf_struct_upb",
"protobuf_timestamp_upb",
"ref_counted_ptr",
"time",
"upb_utils",
"uri_parser",
"work_serializer",
],
)
grpc_cc_library(
name = "grpc_xds_client",
srcs = [
"src/core/ext/xds/certificate_provider_registry.cc",
"src/core/ext/xds/certificate_provider_store.cc",
"src/core/ext/xds/file_watcher_certificate_provider_factory.cc",
"src/core/ext/xds/xds_api.cc",
"src/core/ext/xds/xds_bootstrap.cc",
"src/core/ext/xds/xds_bootstrap_grpc.cc",
"src/core/ext/xds/xds_certificate_provider.cc",
"src/core/ext/xds/xds_client.cc",
"src/core/ext/xds/xds_client_grpc.cc",
"src/core/ext/xds/xds_client_stats.cc",
"src/core/ext/xds/xds_cluster.cc",
"src/core/ext/xds/xds_cluster_specifier_plugin.cc",
"src/core/ext/xds/xds_common_types.cc",
@ -4199,7 +4296,6 @@ grpc_cc_library(
"src/core/ext/xds/xds_http_rbac_filter.cc",
"src/core/ext/xds/xds_lb_policy_registry.cc",
"src/core/ext/xds/xds_listener.cc",
"src/core/ext/xds/xds_resource_type.cc",
"src/core/ext/xds/xds_route_config.cc",
"src/core/ext/xds/xds_routing.cc",
"src/core/ext/xds/xds_transport_grpc.cc",
@ -4210,15 +4306,9 @@ grpc_cc_library(
"src/core/ext/xds/certificate_provider_registry.h",
"src/core/ext/xds/certificate_provider_store.h",
"src/core/ext/xds/file_watcher_certificate_provider_factory.h",
"src/core/ext/xds/upb_utils.h",
"src/core/ext/xds/xds_api.h",
"src/core/ext/xds/xds_bootstrap.h",
"src/core/ext/xds/xds_bootstrap_grpc.h",
"src/core/ext/xds/xds_certificate_provider.h",
"src/core/ext/xds/xds_channel_args.h",
"src/core/ext/xds/xds_client.h",
"src/core/ext/xds/xds_client_grpc.h",
"src/core/ext/xds/xds_client_stats.h",
"src/core/ext/xds/xds_cluster.h",
"src/core/ext/xds/xds_cluster_specifier_plugin.h",
"src/core/ext/xds/xds_common_types.h",
@ -4228,17 +4318,13 @@ grpc_cc_library(
"src/core/ext/xds/xds_http_rbac_filter.h",
"src/core/ext/xds/xds_lb_policy_registry.h",
"src/core/ext/xds/xds_listener.h",
"src/core/ext/xds/xds_resource_type.h",
"src/core/ext/xds/xds_resource_type_impl.h",
"src/core/ext/xds/xds_route_config.h",
"src/core/ext/xds/xds_routing.h",
"src/core/ext/xds/xds_transport.h",
"src/core/ext/xds/xds_transport_grpc.h",
"src/core/lib/security/credentials/xds/xds_credentials.h",
],
external_deps = [
"absl/base:core_headers",
"absl/container:inlined_vector",
"absl/functional:bind_front",
"absl/memory",
"absl/status",
@ -4338,9 +4424,11 @@ grpc_cc_library(
"status_helper",
"time",
"tsi_ssl_credentials",
"upb_utils",
"uri_parser",
"useful",
"work_serializer",
"xds_client",
"xds_type_upb",
"xds_type_upbdefs",
],
@ -4414,6 +4502,7 @@ grpc_cc_library(
"sockaddr_utils",
"unique_type_name",
"uri_parser",
"xds_client",
],
)
@ -4499,6 +4588,7 @@ grpc_cc_library(
"time",
"unique_type_name",
"work_serializer",
"xds_client",
],
)
@ -4519,9 +4609,9 @@ grpc_cc_library(
language = "c++",
deps = [
"gpr_platform",
"grpc_xds_client",
"ref_counted_ptr",
"server_address",
"xds_client",
],
)
@ -4565,6 +4655,7 @@ grpc_cc_library(
"server_address",
"subchannel_interface",
"work_serializer",
"xds_client",
],
)
@ -4605,6 +4696,7 @@ grpc_cc_library(
"ref_counted_ptr",
"server_address",
"subchannel_interface",
"xds_client",
],
)
@ -5121,6 +5213,7 @@ grpc_cc_library(
],
language = "c++",
deps = [
"backoff",
"debug_location",
"gpr",
"grpc_base",
@ -5163,6 +5256,7 @@ grpc_cc_library(
],
language = "c++",
deps = [
"backoff",
"config",
"debug_location",
"gpr",
@ -5209,6 +5303,7 @@ grpc_cc_library(
],
language = "c++",
deps = [
"backoff",
"config",
"debug_location",
"event_engine_common",
@ -5378,6 +5473,7 @@ grpc_cc_library(
"unique_type_name",
"uri_parser",
"work_serializer",
"xds_client",
],
)

@ -104,6 +104,7 @@ def _update_visibility(visibility):
"tsi_interface": PRIVATE,
"tsi": PRIVATE,
"xds": PRIVATE,
"xds_client_core": PRIVATE,
}
final_visibility = []
for rule in visibility:

@ -30,11 +30,12 @@ grpc_cc_test(
"gtest",
],
language = "C++",
uses_event_engine = True, # uses EventEngine::Now()
uses_event_engine = False,
uses_polling = False,
deps = [
"//:gpr",
"//:grpc",
"//:backoff",
"//:exec_ctx",
"//:time",
"//test/core/util:grpc_test_util",
],
)

@ -22,9 +22,6 @@
#include <gtest/gtest.h>
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include "src/core/lib/gprpp/time.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "test/core/util/test_config.h"

Loading…
Cancel
Save