BUILD.bazel 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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. # This package contains `absl::Status`.
  16. # It will expand later to have utilities around `Status` like `StatusOr`,
  17. # `StatusBuilder` and macros.
  18. load(
  19. "//absl:copts/configure_copts.bzl",
  20. "ABSL_DEFAULT_COPTS",
  21. "ABSL_DEFAULT_LINKOPTS",
  22. "ABSL_TEST_COPTS",
  23. )
  24. package(
  25. default_visibility = ["//visibility:public"],
  26. features = [
  27. "header_modules",
  28. "layering_check",
  29. "parse_headers",
  30. ],
  31. )
  32. licenses(["notice"])
  33. cc_library(
  34. name = "status",
  35. srcs = [
  36. "internal/status_internal.cc",
  37. "internal/status_internal.h",
  38. "status.cc",
  39. "status_payload_printer.cc",
  40. ],
  41. hdrs = [
  42. "status.h",
  43. "status_payload_printer.h",
  44. ],
  45. copts = ABSL_DEFAULT_COPTS,
  46. linkopts = ABSL_DEFAULT_LINKOPTS,
  47. deps = [
  48. "//absl/base:atomic_hook",
  49. "//absl/base:config",
  50. "//absl/base:core_headers",
  51. "//absl/base:no_destructor",
  52. "//absl/base:nullability",
  53. "//absl/base:raw_logging_internal",
  54. "//absl/base:strerror",
  55. "//absl/container:inlined_vector",
  56. "//absl/debugging:stacktrace",
  57. "//absl/debugging:symbolize",
  58. "//absl/functional:function_ref",
  59. "//absl/memory",
  60. "//absl/strings",
  61. "//absl/strings:cord",
  62. "//absl/strings:str_format",
  63. "//absl/types:optional",
  64. "//absl/types:span",
  65. ],
  66. )
  67. cc_test(
  68. name = "status_test",
  69. srcs = ["status_test.cc"],
  70. copts = ABSL_TEST_COPTS,
  71. linkopts = ABSL_DEFAULT_LINKOPTS,
  72. deps = [
  73. ":status",
  74. "//absl/strings",
  75. "//absl/strings:cord",
  76. "//absl/strings:str_format",
  77. "@com_google_googletest//:gtest",
  78. "@com_google_googletest//:gtest_main",
  79. ],
  80. )
  81. cc_library(
  82. name = "statusor",
  83. srcs = [
  84. "internal/statusor_internal.h",
  85. "statusor.cc",
  86. ],
  87. hdrs = [
  88. "statusor.h",
  89. ],
  90. copts = ABSL_DEFAULT_COPTS,
  91. linkopts = ABSL_DEFAULT_LINKOPTS,
  92. deps = [
  93. ":status",
  94. "//absl/base",
  95. "//absl/base:config",
  96. "//absl/base:core_headers",
  97. "//absl/base:nullability",
  98. "//absl/base:raw_logging_internal",
  99. "//absl/meta:type_traits",
  100. "//absl/strings",
  101. "//absl/strings:has_ostream_operator",
  102. "//absl/strings:str_format",
  103. "//absl/types:variant",
  104. "//absl/utility",
  105. ],
  106. )
  107. cc_test(
  108. name = "statusor_test",
  109. size = "small",
  110. srcs = ["statusor_test.cc"],
  111. deps = [
  112. ":status",
  113. ":status_matchers",
  114. ":statusor",
  115. "//absl/base",
  116. "//absl/memory",
  117. "//absl/strings",
  118. "//absl/types:any",
  119. "//absl/types:variant",
  120. "//absl/utility",
  121. "@com_google_googletest//:gtest",
  122. "@com_google_googletest//:gtest_main",
  123. ],
  124. )
  125. cc_library(
  126. name = "status_matchers",
  127. testonly = 1,
  128. srcs = [
  129. "internal/status_matchers.cc",
  130. "internal/status_matchers.h",
  131. ],
  132. hdrs = ["status_matchers.h"],
  133. copts = ABSL_DEFAULT_COPTS,
  134. linkopts = ABSL_DEFAULT_LINKOPTS,
  135. deps = [
  136. ":status",
  137. ":statusor",
  138. "//absl/base:config",
  139. "//absl/strings:string_view",
  140. "@com_google_googletest//:gtest",
  141. ],
  142. )
  143. cc_test(
  144. name = "status_matchers_test",
  145. size = "small",
  146. srcs = ["status_matchers_test.cc"],
  147. copts = ABSL_TEST_COPTS,
  148. linkopts = ABSL_DEFAULT_LINKOPTS,
  149. deps = [
  150. ":status",
  151. ":status_matchers",
  152. ":statusor",
  153. "//absl/strings",
  154. "@com_google_googletest//:gtest",
  155. "@com_google_googletest//:gtest_main",
  156. ],
  157. )