• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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("@com_google_protobuf//bazel:proto_library.bzl", "proto_library")
16load("@rules_cc//cc:cc_library.bzl", "cc_library")
17load("@rules_python//python:proto.bzl", "py_proto_library")
18load("@rules_python//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library")
19load("//pw_build:compatibility.bzl", "incompatible_with_mcu")
20load(
21    "//pw_protobuf_compiler:pw_proto_library.bzl",
22    "pwpb_proto_library",
23    "raw_rpc_proto_library",
24)
25load("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test")
26
27package(
28    default_visibility = ["//visibility:public"],
29    features = ["-layering_check"],
30)
31
32licenses(["notice"])
33
34proto_library(
35    name = "file_proto",
36    srcs = ["file.proto"],
37    deps = [
38        "//pw_protobuf:common_proto",
39    ],
40)
41
42pwpb_proto_library(
43    name = "file_proto_pwpb",
44    deps = [
45        ":file_proto",
46        "//pw_protobuf:common_proto",
47    ],
48)
49
50raw_rpc_proto_library(
51    name = "file_proto_raw_rpc",
52    deps = [
53        ":file_proto",
54        "//pw_protobuf:common_proto",
55    ],
56)
57
58py_proto_library(
59    name = "file_proto_py_pb2",
60    deps = [":file_proto"],
61)
62
63cc_library(
64    name = "flat_file_system",
65    srcs = [
66        "flat_file_system.cc",
67    ],
68    hdrs = [
69        "public/pw_file/flat_file_system.h",
70    ],
71    implementation_deps = ["//pw_assert:check"],
72    strip_include_prefix = "public",
73    deps = [
74        ":file_proto_pwpb",
75        ":file_proto_raw_rpc",
76        "//pw_bytes",
77        "//pw_result",
78        "//pw_rpc/raw:server_api",
79        "//pw_status",
80    ],
81)
82
83pw_cc_test(
84    name = "flat_file_system_test",
85    srcs = [
86        "flat_file_system_test.cc",
87    ],
88    deps = [
89        ":file_proto_pwpb",
90        ":flat_file_system",
91        "//pw_bytes",
92        "//pw_protobuf",
93        "//pw_rpc/raw:test_method_context",
94        "//pw_status",
95    ],
96)
97
98sphinx_docs_library(
99    name = "docs",
100    srcs = [
101        "docs.rst",
102        "file.proto",
103    ],
104    prefix = "pw_file/",
105    target_compatible_with = incompatible_with_mcu(),
106)
107