• 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_library",
18    "pw_cc_test",
19)
20
21package(default_visibility = ["//visibility:public"])
22
23licenses(["notice"])  # Apache License 2.0
24
25# TODO(pwbug/101): Need to add support for facades/backends to Bazel.
26PW_ASSERT_BACKEND = "//pw_assert_basic"
27
28pw_cc_library(
29    name = "facade",
30    hdrs = [
31        "public/pw_assert/assert.h",
32        "public/pw_assert/check.h",
33        "public/pw_assert/internal/check_impl.h",
34        "public/pw_assert/light.h",
35        "public/pw_assert/options.h",
36        "public/pw_assert/short.h",
37    ],
38    includes = ["public"],
39    deps = [
40        PW_ASSERT_BACKEND + ":headers",
41        "//pw_preprocessor",
42    ],
43)
44
45pw_cc_library(
46    name = "pw_assert",
47    deps = [
48        ":facade",
49        PW_ASSERT_BACKEND + ":headers",
50        PW_ASSERT_BACKEND,
51    ],
52)
53
54pw_cc_library(
55    name = "backend",
56    deps = [
57        PW_ASSERT_BACKEND,
58    ],
59)
60
61pw_cc_test(
62    name = "assert_facade_test",
63    srcs = [
64        "assert_facade_test.cc",
65        "fake_backend.cc",
66        "light_test.cc",
67        "public/pw_assert/internal/assert_impl.h",
68        "pw_assert_test/fake_backend.h",
69    ],
70    deps = [
71        ":facade",
72        "//pw_preprocessor",
73        "//pw_span",
74        "//pw_string",
75        "//pw_unit_test",
76        PW_ASSERT_BACKEND,
77    ],
78)
79
80pw_cc_test(
81    name = "assert_backend_compile_test",
82    srcs = [
83        "assert_backend_compile_test.cc",
84        "assert_backend_compile_test_c.c",
85    ],
86    deps = [
87        ":backend",
88        ":facade",
89        ":pw_assert",
90        "//pw_unit_test",
91    ],
92)
93