xref: /aosp_15_r20/external/federated-compute/fcp/tracing/BUILD (revision 14675a029014e728ec732f129a32e299b2da0601)
1# Copyright 2019 Google LLC
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15load("@flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
16load("//fcp:config.bzl", "FCP_COPTS")
17
18package(
19    default_visibility = ["//fcp:internal"],
20    licenses = ["notice"],  # Apache 2.0
21)
22
23exports_files([
24    "tracing_schema_common.fbs",
25    "tracing_severity.h",
26    "tracing_tag.h",
27    "tracing_traits.h",
28])
29
30flatbuffer_cc_library(
31    name = "tracing_schema_common",
32    srcs = ["tracing_schema_common.fbs"],
33    srcs_filegroup_name = "tracing_schema_common_fbs",
34)
35
36cc_library(
37    name = "tracing",
38    srcs = [
39        "text_tracing_recorder_impl.cc",
40        "text_tracing_span_impl.cc",
41        "tracing_recorder_impl.cc",
42        "tracing_span_id.cc",
43        "tracing_span_impl.cc",
44        "tracing_span_ref.cc",
45        "tracing_traits.cc",
46    ],
47    hdrs = [
48        "scoped_tracing_recorder.h",
49        "text_tracing_recorder.h",
50        "text_tracing_recorder_impl.h",
51        "text_tracing_span_impl.h",
52        "tracing_recorder.h",
53        "tracing_recorder_impl.h",
54        "tracing_span.h",
55        "tracing_span_id.h",
56        "tracing_span_impl.h",
57        "tracing_span_ref.h",
58        "tracing_tag.h",
59        "tracing_traits.h",
60    ],
61    copts = FCP_COPTS,
62    deps = [
63        ":tracing_severity",
64        "//fcp/base",
65        "//fcp/base:error",
66        "@com_google_absl//absl/base:core_headers",
67        "@com_google_absl//absl/container:flat_hash_map",
68        "@com_google_absl//absl/synchronization",
69        "@com_google_absl//absl/time",
70        "@flatbuffers",
71    ],
72)
73
74cc_library(
75    name = "test_tracing_recorder",
76    testonly = True,
77    srcs = [
78        "test_tracing_recorder.cc",
79        "test_tracing_recorder_impl.cc",
80        "test_tracing_span_impl.cc",
81    ],
82    hdrs = [
83        "test_tracing_recorder.h",
84        "test_tracing_recorder_impl.h",
85        "test_tracing_span_impl.h",
86        "tracing_traits.h",
87    ],
88    copts = FCP_COPTS,
89    deps = [
90        ":tracing",
91        ":tracing_severity",
92        "//fcp/base:source_location",
93        "@com_google_absl//absl/base:core_headers",
94        "@com_google_absl//absl/container:flat_hash_map",
95        "@com_google_absl//absl/container:flat_hash_set",
96        "@com_google_absl//absl/synchronization",
97        "@com_google_googletest//:gtest_main",
98        "@flatbuffers",
99    ],
100)
101
102cc_library(
103    name = "tracing_severity",
104    hdrs = ["tracing_severity.h"],
105)
106
107cc_library(
108    name = "tracing_context_utils",
109    srcs = ["tracing_context_utils.cc"],
110    hdrs = ["tracing_context_utils.h"],
111    deps = [
112        ":tracing",
113        "//fcp/base",
114        "@com_google_protobuf//:protobuf",
115        "@flatbuffers",
116    ],
117)
118
119cc_test(
120    name = "tracing_tag_test",
121    srcs = [
122        "tracing_tag_test.cc",
123    ],
124    copts = FCP_COPTS,
125    deps = [
126        ":tracing",
127        "@com_google_absl//absl/hash:hash_testing",
128        "@com_google_googletest//:gtest_main",
129    ],
130)
131