• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2021 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7#     https://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, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15load(
16    "//pw_build:pigweed.bzl",
17    "pw_cc_facade",
18    "pw_cc_library",
19    "pw_cc_test",
20)
21
22package(default_visibility = ["//visibility:public"])
23
24licenses(["notice"])
25
26pw_cc_facade(
27    name = "facade",
28    hdrs = [
29        "assert_compatibility_public_overrides/pw_assert_backend/assert_backend.h",
30        "public/pw_assert/assert.h",
31        "public/pw_assert/check.h",
32        "public/pw_assert/internal/check_impl.h",
33        "public/pw_assert/short.h",
34    ],
35    includes = [
36        "assert_compatibility_public_overrides",
37        "public",
38    ],
39    deps = [
40        ":config",
41        "//pw_preprocessor",
42    ],
43)
44
45pw_cc_library(
46    name = "pw_assert",
47    deps = [
48        ":facade",
49        "@pigweed_config//:pw_assert_backend",
50    ],
51)
52
53pw_cc_library(
54    name = "config",
55    hdrs = ["public/pw_assert/config.h"],
56    includes = ["public"],
57)
58
59pw_cc_library(
60    name = "libc_assert",
61    hdrs = [
62        "libc_assert_public_overrides/assert.h",
63        "libc_assert_public_overrides/cassert",
64        "public/pw_assert/internal/libc_assert.h",
65    ],
66    includes = [
67        "libc_assert_public_overrides",
68        "public",
69    ],
70    deps = [
71        "//pw_assert",
72        "//pw_preprocessor",
73    ],
74)
75
76pw_cc_library(
77    name = "print_and_abort",
78    hdrs = ["public/pw_assert/internal/print_and_abort.h"],
79    includes = ["public"],
80    visibility = ["//visibility:private"],
81    deps = [":config"],
82)
83
84pw_cc_library(
85    name = "print_and_abort_assert_backend",
86    hdrs = ["print_and_abort_assert_public_overrides/pw_assert_backend/assert_backend.h"],
87    includes = ["print_and_abort_assert_public_overrides"],
88    deps = [
89        ":config",
90        ":print_and_abort",
91    ],
92)
93
94pw_cc_library(
95    name = "print_and_abort_check_backend",
96    hdrs =
97        ["print_and_abort_check_public_overrides/pw_assert_backend/check_backend.h"],
98    includes = ["print_and_abort_public_overrides"],
99    deps = [":print_and_abort"],
100)
101
102pw_cc_library(
103    name = "backend_multiplexer",
104    visibility = ["@pigweed_config//:__pkg__"],
105    deps = [
106        "@pigweed//pw_assert_basic",
107    ],
108)
109
110pw_cc_test(
111    name = "assert_facade_test",
112    srcs = [
113        "assert_facade_test.cc",
114        "assert_test.cc",
115        "fake_backend.cc",
116        "public/pw_assert/internal/check_impl.h",
117        "pw_assert_test/fake_backend.h",
118    ],
119    deps = [
120        ":facade",
121        "//pw_assert",
122        "//pw_compilation_testing:negative_compilation_testing",
123        "//pw_preprocessor",
124        "//pw_span",
125        "//pw_status",
126        "//pw_string",
127        "//pw_unit_test",
128    ],
129)
130
131pw_cc_test(
132    name = "assert_backend_compile_test",
133    srcs = [
134        "assert_backend_compile_test.cc",
135        "assert_backend_compile_test_c.c",
136    ],
137    deps = [
138        "//pw_assert",
139        "//pw_status",
140        "//pw_unit_test",
141    ],
142)
143