• 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("//pw_protobuf_compiler:pw_proto_library.bzl", "pwpb_proto_library")
21load("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test")
22
23package(
24    default_visibility = ["//visibility:public"],
25    features = ["-layering_check"],
26)
27
28licenses(["notice"])
29
30cc_library(
31    name = "uuid",
32    srcs = [
33        "uuid.cc",
34    ],
35    hdrs = [
36        "public/pw_snapshot/uuid.h",
37    ],
38    strip_include_prefix = "public",
39    deps = [
40        ":metadata_proto_pwpb",
41        "//pw_bytes",
42        "//pw_protobuf",
43        "//pw_status",
44    ],
45)
46
47proto_library(
48    name = "metadata_proto",
49    srcs = [
50        "pw_snapshot_protos/snapshot_metadata.proto",
51    ],
52    import_prefix = "pw_snapshot_metadata_proto",
53    strip_import_prefix = "/pw_snapshot/pw_snapshot_protos",
54    deps = [
55        "//pw_tokenizer:tokenizer_proto",
56    ],
57)
58
59py_proto_library(
60    name = "metadata_proto_py_pb2",
61    deps = [":metadata_proto"],
62)
63
64proto_library(
65    name = "snapshot_proto",
66    srcs = [
67        "pw_snapshot_protos/snapshot.proto",
68    ],
69    import_prefix = "pw_snapshot_protos",
70    strip_import_prefix = "/pw_snapshot/pw_snapshot_protos",
71    deps = [
72        ":metadata_proto",
73        "//pw_chrono:chrono_proto",
74        "//pw_cpu_exception_cortex_m:cpu_state_protos",
75        "//pw_cpu_exception_risc_v:cpu_state_protos",
76        "//pw_log:log_proto",
77        "//pw_thread:thread_proto",
78    ],
79)
80
81py_proto_library(
82    name = "snapshot_proto_py_pb2",
83    deps = [":snapshot_proto"],
84)
85
86pwpb_proto_library(
87    name = "metadata_proto_pwpb",
88    deps = [":snapshot_proto"],
89)
90
91pwpb_proto_library(
92    name = "snapshot_proto_pwpb",
93    deps = [":snapshot_proto"],
94)
95
96pw_cc_test(
97    name = "cpp_compile_test",
98    srcs = [
99        "cpp_compile_test.cc",
100    ],
101    deps = [":snapshot_proto_pwpb"],
102)
103
104pw_cc_test(
105    name = "uuid_test",
106    srcs = [
107        "uuid_test.cc",
108    ],
109    deps = [
110        ":metadata_proto_pwpb",
111        ":uuid",
112        "//pw_bytes",
113        "//pw_protobuf",
114        "//pw_result",
115        "//pw_status",
116    ],
117)
118
119sphinx_docs_library(
120    name = "docs",
121    srcs = [
122        "design_discussion.rst",
123        "docs.rst",
124        "module_usage.rst",
125        "proto_format.rst",
126        "setup.rst",
127    ],
128    prefix = "pw_snapshot/",
129    target_compatible_with = incompatible_with_mcu(),
130)
131