1#
2# Copyright 2017 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# This package contains `absl::Status`.
17# It will expand later to have utilities around `Status` like `StatusOr`,
18# `StatusBuilder` and macros.
19
20load(
21    "//absl:copts/configure_copts.bzl",
22    "ABSL_DEFAULT_COPTS",
23    "ABSL_DEFAULT_LINKOPTS",
24    "ABSL_TEST_COPTS",
25)
26
27package(default_visibility = ["//visibility:public"])
28
29licenses(["notice"])
30
31cc_library(
32    name = "status",
33    srcs = [
34        "internal/status_internal.h",
35        "status.cc",
36        "status_payload_printer.cc",
37    ],
38    hdrs = [
39        "status.h",
40        "status_payload_printer.h",
41    ],
42    copts = ABSL_DEFAULT_COPTS,
43    linkopts = ABSL_DEFAULT_LINKOPTS,
44    deps = [
45        "//absl/base:atomic_hook",
46        "//absl/base:core_headers",
47        "//absl/base:raw_logging_internal",
48        "//absl/base:strerror",
49        "//absl/container:inlined_vector",
50        "//absl/debugging:stacktrace",
51        "//absl/debugging:symbolize",
52        "//absl/functional:function_ref",
53        "//absl/strings",
54        "//absl/strings:cord",
55        "//absl/strings:str_format",
56        "//absl/types:optional",
57    ],
58)
59
60cc_test(
61    name = "status_test",
62    srcs = ["status_test.cc"],
63    copts = ABSL_TEST_COPTS,
64    linkopts = ABSL_DEFAULT_LINKOPTS,
65    deps = [
66        ":status",
67        "//absl/strings",
68        "@com_google_googletest//:gtest_main",
69    ],
70)
71
72cc_library(
73    name = "statusor",
74    srcs = [
75        "internal/statusor_internal.h",
76        "statusor.cc",
77    ],
78    hdrs = [
79        "statusor.h",
80    ],
81    copts = ABSL_DEFAULT_COPTS,
82    linkopts = ABSL_DEFAULT_LINKOPTS,
83    deps = [
84        ":status",
85        "//absl/base",
86        "//absl/base:core_headers",
87        "//absl/base:raw_logging_internal",
88        "//absl/meta:type_traits",
89        "//absl/strings",
90        "//absl/types:variant",
91        "//absl/utility",
92    ],
93)
94
95cc_test(
96    name = "statusor_test",
97    size = "small",
98    srcs = ["statusor_test.cc"],
99    deps = [
100        ":status",
101        ":statusor",
102        "//absl/base",
103        "//absl/memory",
104        "//absl/strings",
105        "//absl/types:any",
106        "//absl/utility",
107        "@com_google_googletest//:gtest_main",
108    ],
109)
110