• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# 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)
20load("//pw_protobuf_compiler:proto.bzl", "pw_proto_library")
21load("//pw_build/bazel_internal:py_proto_library.bzl", "py_proto_library")
22
23package(default_visibility = ["//visibility:public"])
24
25licenses(["notice"])
26
27pw_cc_library(
28    name = "metric",
29    srcs = ["metric.cc"],
30    hdrs = [
31        "public/pw_metric/global.h",
32        "public/pw_metric/metric.h",
33    ],
34    includes = ["public"],
35    deps = [
36        "//pw_assert",
37        "//pw_containers",
38        "//pw_log",
39        "//pw_span",
40        "//pw_tokenizer:base64",
41    ],
42)
43
44pw_cc_library(
45    name = "global",
46    srcs = ["global.cc"],
47    hdrs = [
48        "public/pw_metric/global.h",
49    ],
50    deps = [
51        ":metric",
52    ],
53)
54
55# Common MetricWalker/MetricWriter used by RPC service.
56pw_cc_library(
57    name = "metric_walker",
58    hdrs = ["pw_metric_private/metric_walker.h"],
59    visibility = ["//visibility:private"],
60    deps = [
61        ":metric",
62        "//pw_assert",
63        "//pw_containers",
64        "//pw_status",
65        "//pw_tokenizer",
66    ],
67)
68
69pw_cc_library(
70    name = "metric_service_nanopb",
71    srcs = ["metric_service_nanopb.cc"],
72    hdrs = ["public/pw_metric/metric_service_nanopb.h"],
73    # TODO(b/258078909): Get this target to build.
74    tags = ["manual"],
75    deps = [
76        ":metric",
77        ":metric_proto_cc.nanopb_rpc",
78        ":metric_walker",
79    ],
80)
81
82pw_cc_library(
83    name = "metric_service_pwpb",
84    srcs = ["metric_service_pwpb.cc"],
85    hdrs = ["public/pw_metric/metric_service_pwpb.h"],
86    includes = [
87        "metric_proto_cc.pwpb.pb/pw_metric",
88        "metric_proto_cc.raw_rpc.pb/pw_metric",
89    ],
90    deps = [
91        ":metric",
92        ":metric_proto_cc.pwpb",
93        ":metric_proto_cc.pwpb_rpc",
94        ":metric_proto_cc.raw_rpc",
95        ":metric_walker",
96        "//pw_assert",
97        "//pw_bytes",
98        "//pw_containers",
99        "//pw_preprocessor",
100        "//pw_rpc/raw:server_api",
101        "//pw_span",
102        "//pw_status",
103    ],
104)
105
106proto_library(
107    name = "metric_proto",
108    srcs = [
109        "pw_metric_proto/metric_service.proto",
110    ],
111)
112
113# TODO(b/241456982): Not expected to build yet.
114py_proto_library(
115    name = "metric_proto_py_pb2",
116    tags = ["manual"],
117    deps = [":metric_proto"],
118)
119
120pw_proto_library(
121    name = "metric_proto_cc",
122    deps = [":metric_proto"],
123)
124
125pw_cc_test(
126    name = "metric_test",
127    srcs = [
128        "metric_test.cc",
129    ],
130    deps = [
131        ":metric",
132    ],
133)
134
135pw_cc_test(
136    name = "global_test",
137    srcs = [
138        "global_test.cc",
139    ],
140    deps = [
141        ":global",
142    ],
143)
144
145pw_cc_test(
146    name = "metric_service_nanopb_test",
147    srcs = [
148        "metric_service_nanopb_test.cc",
149    ],
150    # TODO(b/258078909): Get this target to build.
151    tags = ["manual"],
152    deps = [
153        ":metric_service_nanopb",
154    ],
155)
156
157pw_cc_test(
158    name = "metric_service_pwpb_test",
159    srcs = [
160        "metric_service_pwpb_test.cc",
161    ],
162    deps = [
163        ":metric_service_pwpb",
164        "//pw_rpc/pwpb:test_method_context",
165        "//pw_rpc/raw:test_method_context",
166    ],
167)
168