Skip to content

Commit

Permalink
Add tensorstore bazel aliases for cc_grpc_library
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 713103236
Change-Id: I11124c491da18e94f7edaca5ffbb3d2676fd9d25
  • Loading branch information
laramiel authored and copybara-github committed Jan 8, 2025
1 parent 7d7c347 commit 424c2c7
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 9 deletions.
6 changes: 6 additions & 0 deletions bazel/tensorstore.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
"""Rule definitions for TensorStore targets."""

load("@bazel_skylib//rules:build_test.bzl", "build_test")
load(
"//bazel:cc_grpc_library.bzl",
_cc_grpc_library = "cc_grpc_library",
)

def _get_tensorstore_copts(copts):
return (copts or []) + []
Expand Down Expand Up @@ -53,3 +57,5 @@ def tensorstore_proto_library(has_services = None, **kwargs):
native.proto_library(**kwargs)

tensorstore_cc_proto_library = native.cc_proto_library

tensorstore_cc_grpc_library = _cc_grpc_library
7 changes: 6 additions & 1 deletion tensorstore/internal/thread/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,16 @@ tensorstore_cc_test(
],
)

THREAD_POOL_DEFINES = []

THREAD_POOL_DEPS = []

tensorstore_cc_library(
name = "thread_pool",
srcs = ["thread_pool.cc"],
hdrs = ["thread_pool.h"],
deps = [
local_defines = THREAD_POOL_DEFINES,
deps = THREAD_POOL_DEPS + [
":pool_impl",
":task",
":task_group_impl",
Expand Down
7 changes: 6 additions & 1 deletion tensorstore/internal/tracing/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ tensorstore_cc_library(
],
)

TRACING_DEFINES = []

TRACING_DEPS = []

tensorstore_cc_library(
name = "tracing",
srcs = [
Expand All @@ -22,7 +26,8 @@ tensorstore_cc_library(
"trace_context.h",
"trace_span.h",
],
deps = [
defines = TRACING_DEFINES,
deps = TRACING_DEPS + [
":span_attribute",
"//tensorstore/internal:source_location",
"//tensorstore/util:span",
Expand Down
8 changes: 8 additions & 0 deletions tensorstore/internal/tracing/trace_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "absl/status/status.h"
#include "tensorstore/internal/tracing/logged_trace_span.h"
#include "tensorstore/internal/tracing/span_attribute.h"
#include "tensorstore/internal/tracing/trace_context.h"
#include "tensorstore/internal/tracing/trace_span.h"

namespace {
Expand All @@ -34,6 +35,13 @@ using ::tensorstore::internal_tracing::TraceSpan;
using ::testing::_;
using ::testing::HasSubstr;

TEST(TraceTest, SwapContext) {
tensorstore::internal_tracing::TraceContext tc(
tensorstore::internal_tracing::TraceContext::kThread);

tensorstore::internal_tracing::SwapCurrentTraceContext(&tc);
}

TEST(TraceTest, Span) {
TraceSpan span("TraceSpan",
{
Expand Down
7 changes: 6 additions & 1 deletion tensorstore/kvstore/gcs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,16 @@ tensorstore_cc_library(
alwayslink = 1,
)

GCS_CREDENTIALS_DEPS = []

GCS_CREDENTIALS_DEFINES = []

tensorstore_cc_library(
name = "exp_credentials_spec",
srcs = ["exp_credentials_spec.cc"],
hdrs = ["exp_credentials_spec.h"],
deps = [
defines = GCS_CREDENTIALS_DEFINES,
deps = GCS_CREDENTIALS_DEPS + [
"//tensorstore:json_serialization_options_base",
"//tensorstore/internal:type_traits",
"//tensorstore/internal/grpc/clientauth:authentication_strategy",
Expand Down
7 changes: 6 additions & 1 deletion tensorstore/kvstore/gcs_grpc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,16 @@ tensorstore_cc_library(
],
)

DEFAULT_STRATEGY_DEPS = []

DEFAULT_STRATEGY_DEFINES = []

tensorstore_cc_library(
name = "default_strategy",
srcs = ["default_strategy.cc"],
hdrs = ["default_strategy.h"],
deps = [
local_defines = DEFAULT_STRATEGY_DEFINES,
deps = DEFAULT_STRATEGY_DEPS + [
"//tensorstore/internal/grpc/clientauth:authentication_strategy",
"//tensorstore/internal/grpc/clientauth:channel_authentication",
"@com_google_absl//absl/log:absl_log",
Expand Down
6 changes: 3 additions & 3 deletions tensorstore/kvstore/ocdbt/distributed/BUILD
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Distributed write support for Optionally-cooperative Distributed B+tree driver

load("//bazel:cc_grpc_library.bzl", "cc_grpc_library")
load(
"//bazel:tensorstore.bzl",
"tensorstore_cc_grpc_library",
"tensorstore_cc_library",
"tensorstore_cc_proto_library",
"tensorstore_cc_test",
Expand Down Expand Up @@ -84,7 +84,7 @@ tensorstore_cc_proto_library(
deps = [":coordinator_proto"],
)

cc_grpc_library(
tensorstore_cc_grpc_library(
name = "coordinator_cc_grpc",
srcs = [":coordinator_proto"],
deps = [
Expand All @@ -103,7 +103,7 @@ tensorstore_cc_proto_library(
deps = [":cooperator_proto"],
)

cc_grpc_library(
tensorstore_cc_grpc_library(
name = "cooperator_cc_grpc",
srcs = [":cooperator_proto"],
deps = [
Expand Down
4 changes: 2 additions & 2 deletions tensorstore/kvstore/tsgrpc/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
load("//bazel:cc_grpc_library.bzl", "cc_grpc_library")
load(
"//bazel:tensorstore.bzl",
"tensorstore_cc_binary",
"tensorstore_cc_grpc_library",
"tensorstore_cc_library",
"tensorstore_cc_proto_library",
"tensorstore_cc_test",
Expand Down Expand Up @@ -48,7 +48,7 @@ tensorstore_cc_proto_library(
deps = [":kvstore_proto"],
)

cc_grpc_library(
tensorstore_cc_grpc_library(
name = "kvstore_cc_grpc",
srcs = [":kvstore_proto"],
service_namespace = "grpc_gen",
Expand Down

0 comments on commit 424c2c7

Please sign in to comment.