blob: bb38bcba31ef9c6266d6fd1f9673ea6f080880b5 [file] [log] [blame]
Wyatt Hepler2ad60672020-01-21 08:00:16 -08001# 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(
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
25pw_cc_library(
26 name = "pw_kvs",
27 srcs = [
Wyatt Hepler1927c282020-02-11 16:45:02 -080028 "alignment.cc",
Wyatt Hepler4da1fcb2020-01-30 17:32:18 -080029 "checksum.cc",
Wyatt Heplerd31d9702020-02-14 08:46:36 -080030 "entry.cc",
Wyatt Hepler4da1fcb2020-01-30 17:32:18 -080031 "flash_memory.cc",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080032 "key_value_store.cc",
Wyatt Heplerd31d9702020-02-14 08:46:36 -080033 "pw_kvs_private/entry.h",
Wyatt Hepler4da1fcb2020-01-30 17:32:18 -080034 "pw_kvs_private/macros.h",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080035 ],
36 hdrs = [
Wyatt Hepler1927c282020-02-11 16:45:02 -080037 "public/pw_kvs/alignment.h",
Wyatt Hepler4da1fcb2020-01-30 17:32:18 -080038 "public/pw_kvs/checksum.h",
Wyatt Heplerec4b9352020-01-31 15:51:50 -080039 "public/pw_kvs/crc16_checksum.h",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080040 "public/pw_kvs/flash_memory.h",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080041 "public/pw_kvs/key_value_store.h",
Wyatt Hepler1927c282020-02-11 16:45:02 -080042 "public/pw_kvs/output.h",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080043 ],
44 includes = ["public"],
45 deps = [
46 "//pw_checksum",
Wyatt Hepler1c329ca2020-02-07 18:07:23 -080047 "//pw_containers",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080048 "//pw_log",
49 "//pw_status",
Wyatt Hepler2ad60672020-01-21 08:00:16 -080050 ],
51)
52
Wyatt Heplerec4b9352020-01-31 15:51:50 -080053pw_cc_library(
54 name = "crc16",
55 hdrs = [
56 "public/pw_kvs/crc16_checksum.h",
57 ],
58 deps = [
59 ":pw_kvs",
60 "//pw_checksum",
61 ],
62)
63
Wyatt Heplerad684a12020-02-04 17:17:29 -080064pw_cc_library(
65 name = "in_memory_fake_flash",
66 hdrs = [
67 "public/pw_kvs/in_memory_fake_flash.h",
68 ],
69 visibility = ["//visibility:private"],
70 deps = [
71 "//pw_log",
72 "//pw_status",
73 ],
74)
75
Wyatt Heplerec4b9352020-01-31 15:51:50 -080076pw_cc_test(
Wyatt Hepler1927c282020-02-11 16:45:02 -080077 name = "alignment_test",
78 srcs = [
79 "alignment_test.cc",
80 ],
81 deps = [
82 ":pw_kvs",
83 ],
84)
85
86pw_cc_test(
Wyatt Heplerec4b9352020-01-31 15:51:50 -080087 name = "checksum_test",
88 srcs = ["checksum_test.cc"],
89 deps = [
90 ":crc16",
91 ":pw_kvs",
92 "//pw_checksum",
93 "//pw_log",
94 ],
95)
96
Wyatt Hepler2ad60672020-01-21 08:00:16 -080097pw_cc_test(
Wyatt Hepler97fc7942020-02-06 15:55:45 -080098 name = "entry_test",
99 srcs = [
100 "entry_test.cc",
101 ],
102 deps = [
103 ":pw_kvs",
104 ],
105)
106
107pw_cc_test(
Wyatt Hepler495b6ee2020-02-12 18:58:01 -0800108 name = "key_value_store_test",
109 srcs = ["key_value_store_test.cc"],
110 deps = [
111 ":crc16",
112 ":in_memory_fake_flash",
113 ":pw_kvs",
114 "//pw_checksum",
115 "//pw_log",
116 ],
117)
118
119pw_cc_test(
Wyatt Hepler16b04522020-02-07 16:00:14 -0800120 name = "key_value_store_fuzz_test",
121 srcs = ["key_value_store_fuzz_test.cc"],
122 deps = [
123 ":crc16",
124 ":in_memory_fake_flash",
125 ":pw_kvs",
126 "//pw_checksum",
127 ],
128)
129
130pw_cc_test(
Wyatt Hepler495b6ee2020-02-12 18:58:01 -0800131 name = "key_value_store_map_test",
132 srcs = ["key_value_store_map_test.cc"],
Wyatt Hepler2ad60672020-01-21 08:00:16 -0800133 deps = [
Wyatt Heplerec4b9352020-01-31 15:51:50 -0800134 ":crc16",
Wyatt Heplerad684a12020-02-04 17:17:29 -0800135 ":in_memory_fake_flash",
Wyatt Hepler2ad60672020-01-21 08:00:16 -0800136 ":pw_kvs",
137 "//pw_checksum",
Wyatt Hepler2ad60672020-01-21 08:00:16 -0800138 ],
139)
Wyatt Heplerd6216822020-02-04 16:39:15 -0800140
141cc_binary(
142 name = "debug_cli",
143 srcs = ["debug_cli.cc"],
144 copts = ["-std=c++17"],
145 deps = [
146 ":crc16",
147 ":in_memory_fake_flash",
148 ":pw_kvs",
149 ],
150)