xref: /aosp_15_r20/external/pigweed/pw_assert_basic/BUILD.bazel (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1# Copyright 2020 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("//pw_build:pw_facade.bzl", "pw_facade")
16
17package(default_visibility = ["//visibility:public"])
18
19licenses(["notice"])
20
21# Note: to avoid circular dependencies, this target only includes the headers
22# for pw_assert_basic. The source file and its dependencies are in the separate
23# ":impl" target.
24#
25# If you point //pw_assert:backend to //pw_assert_basic, then
26# //pw_assert:backend_impl should point to //pw_assert_basic:impl.
27cc_library(
28    name = "pw_assert_basic",
29    hdrs = [
30        "public/pw_assert_basic/assert_basic.h",
31        "public_overrides/pw_assert_backend/check_backend.h",
32    ],
33    includes = [
34        "public",
35        "public_overrides",
36    ],
37    deps = [
38        ":handler.facade",
39        "//pw_assert:assert_compatibility_backend",
40        "//pw_preprocessor",
41    ],
42)
43
44pw_facade(
45    name = "handler",
46    hdrs = [
47        "public/pw_assert_basic/handler.h",
48    ],
49    backend = ":handler_backend",
50    strip_include_prefix = "public",
51    deps = [
52        "//pw_preprocessor",
53    ],
54)
55
56label_flag(
57    name = "handler_backend",
58    build_setting_default = ":pw_assert_basic_handler",
59)
60
61cc_library(
62    name = "impl",
63    srcs = [
64        "assert_basic.cc",
65    ],
66    deps = [
67        ":handler",
68        ":pw_assert_basic",
69        "//pw_assert:check.facade",
70        "//pw_preprocessor",
71    ],
72    # Other libraries may not always depend on this library, even if it is
73    # necessary at link time.
74    alwayslink = 1,
75)
76
77cc_library(
78    name = "pw_assert_basic_handler",
79    srcs = [
80        "basic_handler.cc",
81    ],
82    implementation_deps = [
83        "//pw_preprocessor",
84        "//pw_string:builder",
85        "//pw_sys_io",
86    ],
87    deps = [":handler.facade"],
88    # Other libraries may not always depend on this library, even if it is
89    # necessary at link time.
90    alwayslink = 1,
91)
92