blob: 58ce601118c3843cc61d10340c4a646c58488e63 [file] [log] [blame]
Nathaniel Brough975a3c22021-02-28 21:46:16 +08001# Copyright 2021 The Pigweed Authors
Keir Mierle3cee8792020-01-22 17:08:13 -08002#
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
Keir Mierle2f813c62020-02-13 16:24:41 -080015load(
16 "//pw_build:pigweed.bzl",
17 "pw_cc_library",
18 "pw_cc_test",
19)
20
Keir Mierle3cee8792020-01-22 17:08:13 -080021package(default_visibility = ["//visibility:public"])
22
23licenses(["notice"]) # Apache License 2.0
24
Keir Mierle2f813c62020-02-13 16:24:41 -080025# 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 = [
Keir Mierle3cee8792020-01-22 17:08:13 -080031 "public/pw_assert/assert.h",
Wyatt Heplera59998f2021-03-19 14:35:10 -070032 "public/pw_assert/check.h",
33 "public/pw_assert/internal/check_impl.h",
Keir Mierle854adec2020-09-03 14:07:19 -070034 "public/pw_assert/light.h",
35 "public/pw_assert/options.h",
Wyatt Heplera59998f2021-03-19 14:35:10 -070036 "public/pw_assert/short.h",
Keir Mierle3cee8792020-01-22 17:08:13 -080037 ],
Keir Mierle2f813c62020-02-13 16:24:41 -080038 includes = ["public"],
39 deps = [
Rob Mohr06819482020-04-06 13:25:43 -070040 PW_ASSERT_BACKEND + ":headers",
Keir Mierle2f813c62020-02-13 16:24:41 -080041 "//pw_preprocessor",
42 ],
Keir Mierle3cee8792020-01-22 17:08:13 -080043)
44
Keir Mierle2f813c62020-02-13 16:24:41 -080045pw_cc_library(
46 name = "pw_assert",
47 deps = [
48 ":facade",
Rob Mohr06819482020-04-06 13:25:43 -070049 PW_ASSERT_BACKEND + ":headers",
Nathaniel Brough975a3c22021-02-28 21:46:16 +080050 PW_ASSERT_BACKEND,
Rob Mohr06819482020-04-06 13:25:43 -070051 ],
52)
53
54pw_cc_library(
55 name = "backend",
56 deps = [
Keir Mierle2f813c62020-02-13 16:24:41 -080057 PW_ASSERT_BACKEND,
58 ],
59)
60
61pw_cc_test(
Keir Mierle8d2a84f2020-04-14 22:00:00 -070062 name = "assert_facade_test",
Keir Mierle3cee8792020-01-22 17:08:13 -080063 srcs = [
Keir Mierle8d2a84f2020-04-14 22:00:00 -070064 "assert_facade_test.cc",
65 "fake_backend.cc",
Keir Mierle854adec2020-09-03 14:07:19 -070066 "light_test.cc",
Keir Mierle8d2a84f2020-04-14 22:00:00 -070067 "public/pw_assert/internal/assert_impl.h",
68 "pw_assert_test/fake_backend.h",
69 ],
70 deps = [
Rob Mohrfcc1ae52020-04-16 11:03:19 -070071 ":facade",
Rob Mohra02f0bf2020-04-21 07:06:51 -070072 "//pw_preprocessor",
Rob Mohr0b8d5b12020-04-20 10:14:50 -070073 "//pw_span",
74 "//pw_string",
Keir Mierle8d2a84f2020-04-14 22:00:00 -070075 "//pw_unit_test",
Nathaniel Brough975a3c22021-02-28 21:46:16 +080076 PW_ASSERT_BACKEND,
Keir Mierle8d2a84f2020-04-14 22:00:00 -070077 ],
78)
79
80pw_cc_test(
81 name = "assert_backend_compile_test",
82 srcs = [
Keir Mierle8d2a84f2020-04-14 22:00:00 -070083 "assert_backend_compile_test.cc",
Nathaniel Brough975a3c22021-02-28 21:46:16 +080084 "assert_backend_compile_test_c.c",
Keir Mierle3cee8792020-01-22 17:08:13 -080085 ],
Rob Mohr06819482020-04-06 13:25:43 -070086 deps = [
87 ":backend",
88 ":facade",
89 ":pw_assert",
90 "//pw_unit_test",
91 ],
Keir Mierle3cee8792020-01-22 17:08:13 -080092)