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