xref: /aosp_15_r20/external/cronet/third_party/abseil-cpp/absl/log/internal/BUILD.bazel (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1#
2# Copyright 2022 The Abseil Authors.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      https://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17load(
18    "//absl:copts/configure_copts.bzl",
19    "ABSL_DEFAULT_COPTS",
20    "ABSL_DEFAULT_LINKOPTS",
21    "ABSL_TEST_COPTS",
22)
23
24package(
25    default_visibility = [
26        "//absl/log:__pkg__",
27    ],
28    features = [
29        "header_modules",
30        "layering_check",
31        "parse_headers",
32    ],
33)
34
35licenses(["notice"])
36
37cc_library(
38    name = "check_impl",
39    hdrs = ["check_impl.h"],
40    copts = ABSL_DEFAULT_COPTS,
41    linkopts = ABSL_DEFAULT_LINKOPTS,
42    deps = [
43        ":check_op",
44        ":conditions",
45        ":log_message",
46        ":strip",
47        "//absl/base:core_headers",
48    ],
49)
50
51cc_library(
52    name = "check_op",
53    srcs = ["check_op.cc"],
54    hdrs = ["check_op.h"],
55    copts = ABSL_DEFAULT_COPTS,
56    linkopts = ABSL_DEFAULT_LINKOPTS,
57    visibility = [
58        "//absl/log:__pkg__",
59    ],
60    deps = [
61        ":nullguard",
62        ":nullstream",
63        ":strip",
64        "//absl/base:config",
65        "//absl/base:core_headers",
66        "//absl/strings",
67    ],
68)
69
70cc_library(
71    name = "conditions",
72    srcs = ["conditions.cc"],
73    hdrs = ["conditions.h"],
74    copts = ABSL_DEFAULT_COPTS,
75    linkopts = ABSL_DEFAULT_LINKOPTS,
76    deps = [
77        ":voidify",
78        "//absl/base",
79        "//absl/base:config",
80        "//absl/base:core_headers",
81    ],
82)
83
84cc_library(
85    name = "config",
86    hdrs = ["config.h"],
87    copts = ABSL_DEFAULT_COPTS,
88    linkopts = ABSL_DEFAULT_LINKOPTS,
89    visibility = [
90        "//absl/log:__pkg__",
91    ],
92    deps = [
93        "//absl/base:config",
94        "//absl/base:core_headers",
95    ],
96)
97
98cc_library(
99    name = "flags",
100    hdrs = ["flags.h"],
101    copts = ABSL_DEFAULT_COPTS,
102    linkopts = ABSL_DEFAULT_LINKOPTS,
103    deps = [
104        "//absl/flags:flag",
105    ],
106)
107
108cc_library(
109    name = "format",
110    srcs = ["log_format.cc"],
111    hdrs = ["log_format.h"],
112    copts = ABSL_DEFAULT_COPTS,
113    linkopts = ABSL_DEFAULT_LINKOPTS,
114    deps = [
115        ":append_truncated",
116        ":config",
117        ":globals",
118        "//absl/base:config",
119        "//absl/base:core_headers",
120        "//absl/base:log_severity",
121        "//absl/strings",
122        "//absl/strings:str_format",
123        "//absl/time",
124        "//absl/types:span",
125    ],
126)
127
128cc_library(
129    name = "globals",
130    srcs = ["globals.cc"],
131    hdrs = ["globals.h"],
132    copts = ABSL_DEFAULT_COPTS,
133    linkopts = ABSL_DEFAULT_LINKOPTS,
134    visibility = [
135        "//absl/log:__pkg__",
136    ],
137    deps = [
138        "//absl/base:config",
139        "//absl/base:core_headers",
140        "//absl/base:log_severity",
141        "//absl/base:raw_logging_internal",
142        "//absl/strings",
143        "//absl/time",
144    ],
145)
146
147cc_library(
148    name = "log_impl",
149    hdrs = ["log_impl.h"],
150    copts = ABSL_DEFAULT_COPTS,
151    linkopts = ABSL_DEFAULT_LINKOPTS,
152    deps = [
153        ":conditions",
154        ":log_message",
155        ":strip",
156        "//absl/log:absl_vlog_is_on",
157    ],
158)
159
160cc_library(
161    name = "log_message",
162    srcs = ["log_message.cc"],
163    hdrs = ["log_message.h"],
164    copts = ABSL_DEFAULT_COPTS,
165    linkopts = ABSL_DEFAULT_LINKOPTS,
166    visibility = [
167        "//absl/log:__pkg__",
168    ],
169    deps = [
170        ":append_truncated",
171        ":format",
172        ":globals",
173        ":log_sink_set",
174        ":nullguard",
175        ":proto",
176        "//absl/base",
177        "//absl/base:config",
178        "//absl/base:core_headers",
179        "//absl/base:errno_saver",
180        "//absl/base:log_severity",
181        "//absl/base:raw_logging_internal",
182        "//absl/base:strerror",
183        "//absl/container:inlined_vector",
184        "//absl/debugging:examine_stack",
185        "//absl/log:globals",
186        "//absl/log:log_entry",
187        "//absl/log:log_sink",
188        "//absl/log:log_sink_registry",
189        "//absl/memory",
190        "//absl/strings",
191        "//absl/time",
192        "//absl/types:span",
193    ],
194)
195
196cc_library(
197    name = "append_truncated",
198    hdrs = ["append_truncated.h"],
199    copts = ABSL_DEFAULT_COPTS,
200    linkopts = ABSL_DEFAULT_LINKOPTS,
201    deps = [
202        "//absl/base:config",
203        "//absl/strings",
204        "//absl/types:span",
205    ],
206)
207
208cc_library(
209    name = "log_sink_set",
210    srcs = ["log_sink_set.cc"],
211    hdrs = ["log_sink_set.h"],
212    copts = ABSL_DEFAULT_COPTS,
213    linkopts = ABSL_DEFAULT_LINKOPTS + select({
214        "//conditions:default": [],
215        "@platforms//os:android": ["-llog"],
216    }),
217    deps = [
218        ":config",
219        ":globals",
220        "//absl/base",
221        "//absl/base:config",
222        "//absl/base:core_headers",
223        "//absl/base:log_severity",
224        "//absl/base:no_destructor",
225        "//absl/base:raw_logging_internal",
226        "//absl/cleanup",
227        "//absl/log:globals",
228        "//absl/log:log_entry",
229        "//absl/log:log_sink",
230        "//absl/strings",
231        "//absl/synchronization",
232        "//absl/types:span",
233    ],
234)
235
236cc_library(
237    name = "nullguard",
238    srcs = ["nullguard.cc"],
239    hdrs = ["nullguard.h"],
240    copts = ABSL_DEFAULT_COPTS,
241    linkopts = ABSL_DEFAULT_LINKOPTS,
242    deps = [
243        "//absl/base:config",
244        "//absl/base:core_headers",
245    ],
246)
247
248cc_library(
249    name = "nullstream",
250    hdrs = ["nullstream.h"],
251    copts = ABSL_DEFAULT_COPTS,
252    linkopts = ABSL_DEFAULT_LINKOPTS,
253    deps = [
254        "//absl/base:config",
255        "//absl/base:core_headers",
256        "//absl/base:log_severity",
257        "//absl/strings",
258    ],
259)
260
261cc_library(
262    name = "strip",
263    hdrs = ["strip.h"],
264    copts = ABSL_DEFAULT_COPTS,
265    linkopts = ABSL_DEFAULT_LINKOPTS,
266    deps = [
267        ":log_message",
268        ":nullstream",
269        "//absl/base:log_severity",
270    ],
271)
272
273cc_library(
274    name = "structured",
275    hdrs = ["structured.h"],
276    copts = ABSL_DEFAULT_COPTS,
277    linkopts = ABSL_DEFAULT_LINKOPTS,
278    deps = [
279        ":log_message",
280        "//absl/base:config",
281        "//absl/strings",
282    ],
283)
284
285cc_library(
286    name = "test_actions",
287    testonly = True,
288    srcs = ["test_actions.cc"],
289    hdrs = ["test_actions.h"],
290    copts = ABSL_DEFAULT_COPTS,
291    linkopts = ABSL_DEFAULT_LINKOPTS,
292    deps = [
293        "//absl/base:config",
294        "//absl/base:core_headers",
295        "//absl/base:log_severity",
296        "//absl/log:log_entry",
297        "//absl/strings",
298        "//absl/time",
299    ] + select({
300        "//absl:msvc_compiler": [],
301        "//conditions:default": [
302        ],
303    }),
304)
305
306cc_library(
307    name = "test_helpers",
308    testonly = True,
309    srcs = ["test_helpers.cc"],
310    hdrs = ["test_helpers.h"],
311    copts = ABSL_DEFAULT_COPTS,
312    linkopts = ABSL_DEFAULT_LINKOPTS,
313    deps = [
314        ":globals",
315        "//absl/base:config",
316        "//absl/base:log_severity",
317        "//absl/log:globals",
318        "//absl/log:initialize",
319        "@com_google_googletest//:gtest",
320    ],
321)
322
323cc_library(
324    name = "test_matchers",
325    testonly = True,
326    srcs = ["test_matchers.cc"],
327    hdrs = ["test_matchers.h"],
328    copts = ABSL_DEFAULT_COPTS,
329    linkopts = ABSL_DEFAULT_LINKOPTS,
330    deps = [
331        ":test_helpers",
332        "//absl/base:config",
333        "//absl/base:core_headers",
334        "//absl/base:log_severity",
335        "//absl/log:log_entry",
336        "//absl/strings",
337        "//absl/time",
338        "@com_google_googletest//:gtest",
339    ] + select({
340        "//absl:msvc_compiler": [],
341        "//conditions:default": [
342        ],
343    }),
344)
345
346cc_library(
347    name = "voidify",
348    hdrs = ["voidify.h"],
349    copts = ABSL_DEFAULT_COPTS,
350    linkopts = ABSL_DEFAULT_LINKOPTS,
351    deps = ["//absl/base:config"],
352)
353
354cc_library(
355    name = "proto",
356    srcs = ["proto.cc"],
357    hdrs = ["proto.h"],
358    copts = ABSL_DEFAULT_COPTS,
359    linkopts = ABSL_DEFAULT_LINKOPTS,
360    deps = [
361        "//absl/base",
362        "//absl/base:config",
363        "//absl/base:core_headers",
364        "//absl/strings",
365        "//absl/types:span",
366    ],
367)
368
369cc_library(
370    name = "fnmatch",
371    srcs = ["fnmatch.cc"],
372    hdrs = ["fnmatch.h"],
373    copts = ABSL_DEFAULT_COPTS,
374    linkopts = ABSL_DEFAULT_LINKOPTS,
375    deps = [
376        "//absl/base:config",
377        "//absl/strings",
378    ],
379)
380
381cc_library(
382    name = "vlog_config",
383    srcs = ["vlog_config.cc"],
384    hdrs = ["vlog_config.h"],
385    copts = ABSL_DEFAULT_COPTS,
386    linkopts = ABSL_DEFAULT_LINKOPTS,
387    visibility = [
388        "//absl/log:__subpackages__",
389    ],
390    deps = [
391        "//absl/base",
392        "//absl/base:config",
393        "//absl/base:core_headers",
394        "//absl/base:no_destructor",
395        "//absl/log/internal:fnmatch",
396        "//absl/memory",
397        "//absl/strings",
398        "//absl/synchronization",
399        "//absl/types:optional",
400    ],
401)
402
403cc_binary(
404    name = "vlog_config_benchmark",
405    testonly = True,
406    srcs = ["vlog_config_benchmark.cc"],
407    copts = ABSL_TEST_COPTS,
408    linkopts = ABSL_DEFAULT_LINKOPTS,
409    tags = [
410        "benchmark",
411    ],
412    visibility = ["//visibility:private"],
413    deps = [
414        ":vlog_config",
415        "//absl/base:config",
416        "//absl/base:core_headers",
417        "//absl/container:layout",
418        "//absl/memory",
419        "//absl/random:distributions",
420        "//absl/strings",
421        "@com_github_google_benchmark//:benchmark_main",
422    ],
423)
424
425# Test targets
426cc_test(
427    name = "stderr_log_sink_test",
428    size = "small",
429    srcs = ["stderr_log_sink_test.cc"],
430    copts = ABSL_TEST_COPTS,
431    linkopts = ABSL_DEFAULT_LINKOPTS,
432    tags = [
433        "no_test:os:android",
434        "no_test:os:ios",
435        "no_test_android",
436        "no_test_darwin_x86_64",
437        "no_test_ios",
438        "no_test_wasm",
439    ],
440    deps = [
441        ":test_helpers",
442        "//absl/base:core_headers",
443        "//absl/base:log_severity",
444        "//absl/log",
445        "//absl/log:globals",
446        "@com_google_googletest//:gtest",
447        "@com_google_googletest//:gtest_main",
448    ],
449)
450
451cc_test(
452    name = "fnmatch_test",
453    srcs = ["fnmatch_test.cc"],
454    copts = ABSL_TEST_COPTS,
455    linkopts = ABSL_DEFAULT_LINKOPTS,
456    deps = [
457        ":fnmatch",
458        "@com_google_googletest//:gtest",
459        "@com_google_googletest//:gtest_main",
460    ],
461)
462
463cc_test(
464    name = "fnmatch_benchmark",
465    srcs = ["fnmatch_benchmark.cc"],
466    copts = ABSL_TEST_COPTS,
467    linkopts = ABSL_DEFAULT_LINKOPTS,
468    tags = ["benchmark"],
469    deps = [
470        ":fnmatch",
471        "@com_github_google_benchmark//:benchmark_main",
472    ],
473)
474