xref: /aosp_15_r20/external/pigweed/pw_file/BUILD.bazel (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1# Copyright 2021 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("@rules_python//python:proto.bzl", "py_proto_library")
16load(
17    "//pw_protobuf_compiler:pw_proto_library.bzl",
18    "pwpb_proto_library",
19    "raw_rpc_proto_library",
20)
21load("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test")
22
23package(default_visibility = ["//visibility:public"])
24
25licenses(["notice"])
26
27proto_library(
28    name = "file_proto",
29    srcs = ["file.proto"],
30    deps = [
31        "//pw_protobuf:common_proto",
32    ],
33)
34
35pwpb_proto_library(
36    name = "file_proto_pwpb",
37    deps = [
38        ":file_proto",
39        "//pw_protobuf:common_proto",
40    ],
41)
42
43raw_rpc_proto_library(
44    name = "file_proto_raw_rpc",
45    deps = [
46        ":file_proto",
47        "//pw_protobuf:common_proto",
48    ],
49)
50
51py_proto_library(
52    name = "file_proto_py_pb2",
53    deps = [":file_proto"],
54)
55
56cc_library(
57    name = "flat_file_system",
58    srcs = [
59        "flat_file_system.cc",
60    ],
61    hdrs = [
62        "public/pw_file/flat_file_system.h",
63    ],
64    strip_include_prefix = "public",
65    deps = [
66        ":file_proto_pwpb",
67        ":file_proto_raw_rpc",
68        "//pw_bytes",
69        "//pw_result",
70        "//pw_rpc/raw:server_api",
71        "//pw_status",
72    ],
73)
74
75pw_cc_test(
76    name = "flat_file_system_test",
77    srcs = [
78        "flat_file_system_test.cc",
79    ],
80    deps = [
81        ":file_proto_pwpb",
82        ":flat_file_system",
83        "//pw_bytes",
84        "//pw_protobuf",
85        "//pw_rpc/raw:test_method_context",
86        "//pw_status",
87    ],
88)
89