xref: /aosp_15_r20/external/pigweed/pw_sensor/py/BUILD.bazel (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1# Copyright 2024 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:defs.bzl", "py_library")
16load("//pw_build:python.bzl", "pw_py_binary", "pw_py_test")
17
18package(default_visibility = ["//visibility:public"])
19
20py_library(
21    name = "pw_sensor",
22    srcs = [
23        "pw_sensor/__init__.py",
24        "pw_sensor/constants_generator.py",
25        "pw_sensor/sensor_desc.py",
26        "pw_sensor/validator.py",
27    ],
28    data = [
29        ":base_schemas",
30    ],
31    imports = ["."],
32    deps = [
33        "@python_packages//jsonschema",
34        "@python_packages//pyyaml",
35    ],
36)
37
38pw_py_binary(
39    name = "constants_generator",
40    srcs = [
41        "pw_sensor/constants_generator.py",
42    ],
43    imports = ["."],
44    deps = [
45        ":pw_sensor",
46        "@python_packages//pyyaml",
47    ],
48)
49
50pw_py_binary(
51    name = "sensor_desc",
52    srcs = ["pw_sensor/sensor_desc.py"],
53    imports = ["."],
54    deps = [
55        ":pw_sensor",
56        "@python_packages//pyyaml",
57    ],
58)
59
60filegroup(
61    name = "base_schemas",
62    srcs = [
63        "pw_sensor/dependency_schema.json",
64        "pw_sensor/metadata_schema.json",
65        "pw_sensor/resolved_schema.json",
66    ],
67)
68
69pw_py_test(
70    name = "validator_test",
71    srcs = ["validator_test.py"],
72    deps = [
73        ":pw_sensor",
74        "@python_packages//jsonschema",
75        "@python_packages//pyyaml",
76    ],
77)
78