Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 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 | |
| 15 | load( |
| 16 | "//pw_build:pigweed.bzl", |
| 17 | "pw_cc_library", |
| 18 | "pw_cc_test", |
| 19 | ) |
| 20 | |
| 21 | package(default_visibility = ["//visibility:public"]) |
| 22 | |
| 23 | licenses(["notice"]) # Apache License 2.0 |
| 24 | |
| 25 | pw_cc_library( |
| 26 | name = "pw_kvs", |
| 27 | srcs = [ |
Wyatt Hepler | 1927c28 | 2020-02-11 16:45:02 -0800 | [diff] [blame] | 28 | "alignment.cc", |
Wyatt Hepler | 4da1fcb | 2020-01-30 17:32:18 -0800 | [diff] [blame] | 29 | "checksum.cc", |
Wyatt Hepler | d31d970 | 2020-02-14 08:46:36 -0800 | [diff] [blame] | 30 | "entry.cc", |
Wyatt Hepler | 7ded6da | 2020-03-11 18:24:43 -0700 | [diff] [blame] | 31 | "entry_cache.cc", |
Wyatt Hepler | 4da1fcb | 2020-01-30 17:32:18 -0800 | [diff] [blame] | 32 | "flash_memory.cc", |
Wyatt Hepler | 22d0d9f | 2020-03-05 14:57:11 -0800 | [diff] [blame] | 33 | "format.cc", |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 34 | "key_value_store.cc", |
Wyatt Hepler | bdd8e5a | 2020-02-20 19:27:26 -0800 | [diff] [blame] | 35 | "public/pw_kvs/internal/entry.h", |
Wyatt Hepler | 7ded6da | 2020-03-11 18:24:43 -0700 | [diff] [blame] | 36 | "public/pw_kvs/internal/entry_cache.h", |
Wyatt Hepler | 1fc1104 | 2020-02-19 17:17:51 -0800 | [diff] [blame] | 37 | "public/pw_kvs/internal/hash.h", |
| 38 | "public/pw_kvs/internal/key_descriptor.h", |
Wyatt Hepler | 2454f2d | 2020-03-20 12:54:35 -0700 | [diff] [blame] | 39 | "public/pw_kvs/internal/sectors.h", |
Keir Mierle | 0dd24a8 | 2020-02-21 16:08:59 -0800 | [diff] [blame] | 40 | "public/pw_kvs/internal/span_traits.h", |
Wyatt Hepler | 4da1fcb | 2020-01-30 17:32:18 -0800 | [diff] [blame] | 41 | "pw_kvs_private/macros.h", |
Wyatt Hepler | c84393f | 2020-03-20 11:23:24 -0700 | [diff] [blame] | 42 | "sectors.cc", |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 43 | ], |
| 44 | hdrs = [ |
Wyatt Hepler | 1927c28 | 2020-02-11 16:45:02 -0800 | [diff] [blame] | 45 | "public/pw_kvs/alignment.h", |
Wyatt Hepler | 4da1fcb | 2020-01-30 17:32:18 -0800 | [diff] [blame] | 46 | "public/pw_kvs/checksum.h", |
Wyatt Hepler | ec4b935 | 2020-01-31 15:51:50 -0800 | [diff] [blame] | 47 | "public/pw_kvs/crc16_checksum.h", |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 48 | "public/pw_kvs/flash_memory.h", |
Wyatt Hepler | 88adfe8 | 2020-02-20 19:33:27 -0800 | [diff] [blame] | 49 | "public/pw_kvs/format.h", |
Wyatt Hepler | 06b1b0b | 2020-03-09 08:26:34 -0700 | [diff] [blame] | 50 | "public/pw_kvs/io.h", |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 51 | "public/pw_kvs/key_value_store.h", |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 52 | ], |
| 53 | includes = ["public"], |
| 54 | deps = [ |
| 55 | "//pw_checksum", |
Wyatt Hepler | 1c329ca | 2020-02-07 18:07:23 -0800 | [diff] [blame] | 56 | "//pw_containers", |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 57 | "//pw_log", |
| 58 | "//pw_status", |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 59 | ], |
| 60 | ) |
| 61 | |
Wyatt Hepler | ec4b935 | 2020-01-31 15:51:50 -0800 | [diff] [blame] | 62 | pw_cc_library( |
| 63 | name = "crc16", |
| 64 | hdrs = [ |
| 65 | "public/pw_kvs/crc16_checksum.h", |
| 66 | ], |
| 67 | deps = [ |
| 68 | ":pw_kvs", |
| 69 | "//pw_checksum", |
| 70 | ], |
| 71 | ) |
| 72 | |
Wyatt Hepler | ad684a1 | 2020-02-04 17:17:29 -0800 | [diff] [blame] | 73 | pw_cc_library( |
Wyatt Hepler | cdd6dfc | 2020-02-18 12:04:04 -0800 | [diff] [blame] | 74 | name = "test_utils", |
| 75 | srcs = [ |
| 76 | "in_memory_fake_flash.cc", |
| 77 | ], |
Wyatt Hepler | ad684a1 | 2020-02-04 17:17:29 -0800 | [diff] [blame] | 78 | hdrs = [ |
| 79 | "public/pw_kvs/in_memory_fake_flash.h", |
Wyatt Hepler | cdd6dfc | 2020-02-18 12:04:04 -0800 | [diff] [blame] | 80 | "pw_kvs_private/byte_utils.h", |
Wyatt Hepler | ad684a1 | 2020-02-04 17:17:29 -0800 | [diff] [blame] | 81 | ], |
Wyatt Hepler | cdd6dfc | 2020-02-18 12:04:04 -0800 | [diff] [blame] | 82 | includes = ["public"], |
Wyatt Hepler | ad684a1 | 2020-02-04 17:17:29 -0800 | [diff] [blame] | 83 | visibility = ["//visibility:private"], |
| 84 | deps = [ |
Wyatt Hepler | cdd6dfc | 2020-02-18 12:04:04 -0800 | [diff] [blame] | 85 | "//pw_kvs", |
Wyatt Hepler | ad684a1 | 2020-02-04 17:17:29 -0800 | [diff] [blame] | 86 | "//pw_log", |
| 87 | "//pw_status", |
| 88 | ], |
| 89 | ) |
| 90 | |
David Rogers | 5cc5ce8 | 2020-03-13 19:19:03 -0700 | [diff] [blame] | 91 | pw_cc_library( |
| 92 | name = "test_partition", |
| 93 | srcs = [ |
| 94 | "flash_partition_with_stats.cc", |
| 95 | ], |
| 96 | hdrs = [ |
| 97 | "public/pw_kvs/flash_partition_with_stats.h", |
| 98 | ], |
| 99 | includes = ["public"], |
| 100 | visibility = ["//visibility:private"], |
| 101 | deps = [ |
| 102 | "//pw_kvs", |
| 103 | "//pw_log", |
| 104 | "//pw_status", |
| 105 | ], |
| 106 | ) |
| 107 | |
Wyatt Hepler | ec4b935 | 2020-01-31 15:51:50 -0800 | [diff] [blame] | 108 | pw_cc_test( |
Wyatt Hepler | 1927c28 | 2020-02-11 16:45:02 -0800 | [diff] [blame] | 109 | name = "alignment_test", |
| 110 | srcs = [ |
| 111 | "alignment_test.cc", |
| 112 | ], |
| 113 | deps = [ |
| 114 | ":pw_kvs", |
| 115 | ], |
| 116 | ) |
| 117 | |
| 118 | pw_cc_test( |
Wyatt Hepler | ec4b935 | 2020-01-31 15:51:50 -0800 | [diff] [blame] | 119 | name = "checksum_test", |
| 120 | srcs = ["checksum_test.cc"], |
| 121 | deps = [ |
| 122 | ":crc16", |
| 123 | ":pw_kvs", |
| 124 | "//pw_checksum", |
| 125 | "//pw_log", |
| 126 | ], |
| 127 | ) |
| 128 | |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 129 | pw_cc_test( |
Wyatt Hepler | 97fc794 | 2020-02-06 15:55:45 -0800 | [diff] [blame] | 130 | name = "entry_test", |
| 131 | srcs = [ |
| 132 | "entry_test.cc", |
| 133 | ], |
| 134 | deps = [ |
| 135 | ":pw_kvs", |
Wyatt Hepler | cdd6dfc | 2020-02-18 12:04:04 -0800 | [diff] [blame] | 136 | ":test_utils", |
Wyatt Hepler | 97fc794 | 2020-02-06 15:55:45 -0800 | [diff] [blame] | 137 | ], |
| 138 | ) |
| 139 | |
| 140 | pw_cc_test( |
Wyatt Hepler | 7ded6da | 2020-03-11 18:24:43 -0700 | [diff] [blame] | 141 | name = "entry_cache_test", |
| 142 | srcs = ["entry_cache_test.cc"], |
Wyatt Hepler | 0294627 | 2020-03-18 10:36:22 -0700 | [diff] [blame] | 143 | deps = [ |
| 144 | ":pw_kvs", |
| 145 | ":test_utils", |
| 146 | ], |
Wyatt Hepler | 7ded6da | 2020-03-11 18:24:43 -0700 | [diff] [blame] | 147 | ) |
| 148 | |
| 149 | pw_cc_test( |
Wyatt Hepler | 495b6ee | 2020-02-12 18:58:01 -0800 | [diff] [blame] | 150 | name = "key_value_store_test", |
| 151 | srcs = ["key_value_store_test.cc"], |
| 152 | deps = [ |
| 153 | ":crc16", |
Wyatt Hepler | 495b6ee | 2020-02-12 18:58:01 -0800 | [diff] [blame] | 154 | ":pw_kvs", |
Wyatt Hepler | cdd6dfc | 2020-02-18 12:04:04 -0800 | [diff] [blame] | 155 | ":test_utils", |
Wyatt Hepler | 118fc3c | 2020-02-21 14:23:19 -0800 | [diff] [blame] | 156 | "//pw_log", |
| 157 | ], |
| 158 | ) |
| 159 | |
| 160 | pw_cc_test( |
Wyatt Hepler | 8e94ed6 | 2020-03-05 16:45:32 -0800 | [diff] [blame] | 161 | name = "key_value_store_binary_format_test", |
Wyatt Hepler | 118fc3c | 2020-02-21 14:23:19 -0800 | [diff] [blame] | 162 | srcs = [ |
Wyatt Hepler | 8e94ed6 | 2020-03-05 16:45:32 -0800 | [diff] [blame] | 163 | "key_value_store_binary_format_test.cc", |
Wyatt Hepler | 118fc3c | 2020-02-21 14:23:19 -0800 | [diff] [blame] | 164 | ], |
| 165 | deps = [ |
| 166 | ":crc16", |
| 167 | ":pw_kvs", |
| 168 | ":test_utils", |
Wyatt Hepler | 495b6ee | 2020-02-12 18:58:01 -0800 | [diff] [blame] | 169 | "//pw_log", |
| 170 | ], |
| 171 | ) |
| 172 | |
| 173 | pw_cc_test( |
Wyatt Hepler | 16b0452 | 2020-02-07 16:00:14 -0800 | [diff] [blame] | 174 | name = "key_value_store_fuzz_test", |
| 175 | srcs = ["key_value_store_fuzz_test.cc"], |
| 176 | deps = [ |
| 177 | ":crc16", |
Wyatt Hepler | 16b0452 | 2020-02-07 16:00:14 -0800 | [diff] [blame] | 178 | ":pw_kvs", |
David Rogers | 5cc5ce8 | 2020-03-13 19:19:03 -0700 | [diff] [blame] | 179 | ":test_partition", |
Wyatt Hepler | cdd6dfc | 2020-02-18 12:04:04 -0800 | [diff] [blame] | 180 | ":test_utils", |
Wyatt Hepler | 16b0452 | 2020-02-07 16:00:14 -0800 | [diff] [blame] | 181 | "//pw_checksum", |
| 182 | ], |
| 183 | ) |
| 184 | |
| 185 | pw_cc_test( |
Wyatt Hepler | 495b6ee | 2020-02-12 18:58:01 -0800 | [diff] [blame] | 186 | name = "key_value_store_map_test", |
| 187 | srcs = ["key_value_store_map_test.cc"], |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 188 | deps = [ |
Wyatt Hepler | ec4b935 | 2020-01-31 15:51:50 -0800 | [diff] [blame] | 189 | ":crc16", |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 190 | ":pw_kvs", |
David Rogers | 5cc5ce8 | 2020-03-13 19:19:03 -0700 | [diff] [blame] | 191 | ":test_partition", |
Wyatt Hepler | cdd6dfc | 2020-02-18 12:04:04 -0800 | [diff] [blame] | 192 | ":test_utils", |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 193 | "//pw_checksum", |
Wyatt Hepler | 2ad6067 | 2020-01-21 08:00:16 -0800 | [diff] [blame] | 194 | ], |
| 195 | ) |
Wyatt Hepler | d621682 | 2020-02-04 16:39:15 -0800 | [diff] [blame] | 196 | |
Wyatt Hepler | c84393f | 2020-03-20 11:23:24 -0700 | [diff] [blame] | 197 | pw_cc_test( |
| 198 | name = "sectors_test", |
| 199 | srcs = ["sectors_test.cc"], |
| 200 | deps = [ |
| 201 | ":pw_kvs", |
| 202 | ":test_utils", |
| 203 | ], |
| 204 | ) |
| 205 | |
Wyatt Hepler | cdd6dfc | 2020-02-18 12:04:04 -0800 | [diff] [blame] | 206 | # TODO: This binary is not building due to a linker error. The error does not occur in GN Builds. |
| 207 | # A filegroup is used below so that the file is included in the Bazel build. |
| 208 | # cc_binary( |
| 209 | # name = "debug_cli", |
| 210 | # srcs = ["debug_cli.cc"], |
| 211 | # copts = ["-std=c++17"], |
| 212 | # deps = [ |
| 213 | # ":crc16", |
| 214 | # ":pw_kvs", |
| 215 | # ":test_utils", |
| 216 | # ], |
| 217 | # ) |
| 218 | |
| 219 | filegroup( |
Wyatt Hepler | d621682 | 2020-02-04 16:39:15 -0800 | [diff] [blame] | 220 | name = "debug_cli", |
| 221 | srcs = ["debug_cli.cc"], |
Wyatt Hepler | d621682 | 2020-02-04 16:39:15 -0800 | [diff] [blame] | 222 | ) |