Nathaniel Brough | 975a3c2 | 2021-02-28 21:46:16 +0800 | [diff] [blame] | 1 | # Copyright 2021 The Pigweed Authors |
Keir Mierle | 3cee879 | 2020-01-22 17:08:13 -0800 | [diff] [blame] | 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 | |
Keir Mierle | 2f813c6 | 2020-02-13 16:24:41 -0800 | [diff] [blame] | 15 | load( |
| 16 | "//pw_build:pigweed.bzl", |
| 17 | "pw_cc_library", |
| 18 | "pw_cc_test", |
| 19 | ) |
| 20 | |
Keir Mierle | 3cee879 | 2020-01-22 17:08:13 -0800 | [diff] [blame] | 21 | package(default_visibility = ["//visibility:public"]) |
| 22 | |
| 23 | licenses(["notice"]) # Apache License 2.0 |
| 24 | |
Keir Mierle | 2f813c6 | 2020-02-13 16:24:41 -0800 | [diff] [blame] | 25 | # TODO(pwbug/101): Need to add support for facades/backends to Bazel. |
| 26 | PW_ASSERT_BACKEND = "//pw_assert_basic" |
| 27 | |
| 28 | pw_cc_library( |
| 29 | name = "facade", |
| 30 | hdrs = [ |
Keir Mierle | 3cee879 | 2020-01-22 17:08:13 -0800 | [diff] [blame] | 31 | "public/pw_assert/assert.h", |
Wyatt Hepler | a59998f | 2021-03-19 14:35:10 -0700 | [diff] [blame] | 32 | "public/pw_assert/check.h", |
| 33 | "public/pw_assert/internal/check_impl.h", |
Keir Mierle | 854adec | 2020-09-03 14:07:19 -0700 | [diff] [blame] | 34 | "public/pw_assert/light.h", |
| 35 | "public/pw_assert/options.h", |
Wyatt Hepler | a59998f | 2021-03-19 14:35:10 -0700 | [diff] [blame] | 36 | "public/pw_assert/short.h", |
Keir Mierle | 3cee879 | 2020-01-22 17:08:13 -0800 | [diff] [blame] | 37 | ], |
Keir Mierle | 2f813c6 | 2020-02-13 16:24:41 -0800 | [diff] [blame] | 38 | includes = ["public"], |
| 39 | deps = [ |
Rob Mohr | 0681948 | 2020-04-06 13:25:43 -0700 | [diff] [blame] | 40 | PW_ASSERT_BACKEND + ":headers", |
Keir Mierle | 2f813c6 | 2020-02-13 16:24:41 -0800 | [diff] [blame] | 41 | "//pw_preprocessor", |
| 42 | ], |
Keir Mierle | 3cee879 | 2020-01-22 17:08:13 -0800 | [diff] [blame] | 43 | ) |
| 44 | |
Keir Mierle | 2f813c6 | 2020-02-13 16:24:41 -0800 | [diff] [blame] | 45 | pw_cc_library( |
| 46 | name = "pw_assert", |
| 47 | deps = [ |
| 48 | ":facade", |
Rob Mohr | 0681948 | 2020-04-06 13:25:43 -0700 | [diff] [blame] | 49 | PW_ASSERT_BACKEND + ":headers", |
Nathaniel Brough | 975a3c2 | 2021-02-28 21:46:16 +0800 | [diff] [blame] | 50 | PW_ASSERT_BACKEND, |
Rob Mohr | 0681948 | 2020-04-06 13:25:43 -0700 | [diff] [blame] | 51 | ], |
| 52 | ) |
| 53 | |
| 54 | pw_cc_library( |
| 55 | name = "backend", |
| 56 | deps = [ |
Keir Mierle | 2f813c6 | 2020-02-13 16:24:41 -0800 | [diff] [blame] | 57 | PW_ASSERT_BACKEND, |
| 58 | ], |
| 59 | ) |
| 60 | |
| 61 | pw_cc_test( |
Keir Mierle | 8d2a84f | 2020-04-14 22:00:00 -0700 | [diff] [blame] | 62 | name = "assert_facade_test", |
Keir Mierle | 3cee879 | 2020-01-22 17:08:13 -0800 | [diff] [blame] | 63 | srcs = [ |
Keir Mierle | 8d2a84f | 2020-04-14 22:00:00 -0700 | [diff] [blame] | 64 | "assert_facade_test.cc", |
| 65 | "fake_backend.cc", |
Keir Mierle | 854adec | 2020-09-03 14:07:19 -0700 | [diff] [blame] | 66 | "light_test.cc", |
Keir Mierle | 8d2a84f | 2020-04-14 22:00:00 -0700 | [diff] [blame] | 67 | "public/pw_assert/internal/assert_impl.h", |
| 68 | "pw_assert_test/fake_backend.h", |
| 69 | ], |
| 70 | deps = [ |
Rob Mohr | fcc1ae5 | 2020-04-16 11:03:19 -0700 | [diff] [blame] | 71 | ":facade", |
Rob Mohr | a02f0bf | 2020-04-21 07:06:51 -0700 | [diff] [blame] | 72 | "//pw_preprocessor", |
Rob Mohr | 0b8d5b1 | 2020-04-20 10:14:50 -0700 | [diff] [blame] | 73 | "//pw_span", |
| 74 | "//pw_string", |
Keir Mierle | 8d2a84f | 2020-04-14 22:00:00 -0700 | [diff] [blame] | 75 | "//pw_unit_test", |
Nathaniel Brough | 975a3c2 | 2021-02-28 21:46:16 +0800 | [diff] [blame] | 76 | PW_ASSERT_BACKEND, |
Keir Mierle | 8d2a84f | 2020-04-14 22:00:00 -0700 | [diff] [blame] | 77 | ], |
| 78 | ) |
| 79 | |
| 80 | pw_cc_test( |
| 81 | name = "assert_backend_compile_test", |
| 82 | srcs = [ |
Keir Mierle | 8d2a84f | 2020-04-14 22:00:00 -0700 | [diff] [blame] | 83 | "assert_backend_compile_test.cc", |
Nathaniel Brough | 975a3c2 | 2021-02-28 21:46:16 +0800 | [diff] [blame] | 84 | "assert_backend_compile_test_c.c", |
Keir Mierle | 3cee879 | 2020-01-22 17:08:13 -0800 | [diff] [blame] | 85 | ], |
Rob Mohr | 0681948 | 2020-04-06 13:25:43 -0700 | [diff] [blame] | 86 | deps = [ |
| 87 | ":backend", |
| 88 | ":facade", |
| 89 | ":pw_assert", |
| 90 | "//pw_unit_test", |
| 91 | ], |
Keir Mierle | 3cee879 | 2020-01-22 17:08:13 -0800 | [diff] [blame] | 92 | ) |