• 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("@rules_python//python:defs.bzl", "py_binary")
16
17package(default_visibility = ["//visibility:public"])
18
19licenses(["notice"])
20
21filegroup(
22    name = "pw_rpc_common_sources",
23    srcs = [
24        "pw_rpc/callback_client/__init__.py",
25        "pw_rpc/callback_client/call.py",
26        "pw_rpc/callback_client/errors.py",
27        "pw_rpc/callback_client/impl.py",
28        "pw_rpc/codegen.py",
29        "pw_rpc/codegen_nanopb.py",
30        "pw_rpc/codegen_pwpb.py",
31        "pw_rpc/codegen_raw.py",
32        "pw_rpc/console_tools/__init__.py",
33        "pw_rpc/console_tools/console.py",
34        "pw_rpc/console_tools/functions.py",
35        "pw_rpc/console_tools/watchdog.py",
36        "pw_rpc/descriptors.py",
37        "pw_rpc/ids.py",
38        "pw_rpc/packets.py",
39        "pw_rpc/plugin.py",
40        "pw_rpc/plugin_nanopb.py",
41        "pw_rpc/plugin_pwpb.py",
42        "pw_rpc/plugin_raw.py",
43    ],
44)
45
46py_binary(
47    name = "plugin_raw",
48    srcs = [":pw_rpc_common_sources"],
49    imports = ["."],
50    main = "pw_rpc/plugin_raw.py",
51    python_version = "PY3",
52    deps = [
53        "//pw_protobuf/py:plugin_library",
54        "//pw_protobuf_compiler/py:pw_protobuf_compiler",
55        "//pw_status/py:pw_status",
56        "@com_google_protobuf//:protobuf_python",
57    ],
58)
59
60py_binary(
61    name = "plugin_nanopb",
62    srcs = [":pw_rpc_common_sources"],
63    imports = ["."],
64    main = "pw_rpc/plugin_nanopb.py",
65    python_version = "PY3",
66    deps = [
67        "//pw_protobuf/py:plugin_library",
68        "//pw_protobuf_compiler/py:pw_protobuf_compiler",
69        "//pw_status/py:pw_status",
70        "@com_google_protobuf//:protobuf_python",
71    ],
72)
73
74py_binary(
75    name = "plugin_pwpb",
76    srcs = [":pw_rpc_common_sources"],
77    imports = ["."],
78    main = "pw_rpc/plugin_pwpb.py",
79    python_version = "PY3",
80    deps = [
81        "//pw_protobuf/py:plugin_library",
82        "//pw_protobuf_compiler/py:pw_protobuf_compiler",
83        "//pw_status/py:pw_status",
84        "@com_google_protobuf//:protobuf_python",
85    ],
86)
87
88py_library(
89    name = "pw_rpc",
90    srcs = [
91        "pw_rpc/__init__.py",
92        "pw_rpc/client.py",
93        ":pw_rpc_common_sources",
94    ],
95    imports = ["."],
96    deps = [
97        "//pw_protobuf/py:pw_protobuf",
98        "//pw_protobuf_compiler/py:pw_protobuf_compiler",
99        "//pw_rpc:internal_packet_proto_pb2",
100        "//pw_status/py:pw_status",
101    ],
102)
103
104py_test(
105    name = "callback_client_test",
106    size = "small",
107    srcs = [
108        "tests/callback_client_test.py",
109    ],
110    deps = [
111        ":pw_rpc",
112        "//pw_protobuf_compiler:pw_protobuf_compiler_protos",
113        "//pw_rpc:internal_packet_proto_pb2",
114        "//pw_status/py:pw_status",
115    ],
116)
117
118py_test(
119    name = "client_test",
120    size = "small",
121    srcs = [
122        "tests/client_test.py",
123    ],
124    deps = [
125        ":pw_rpc",
126        "//pw_rpc:internal_packet_proto_pb2",
127        "//pw_status/py:pw_status",
128    ],
129)
130
131py_test(
132    name = "descriptors_test",
133    size = "small",
134    srcs = [
135        "tests/descriptors_test.py",
136    ],
137    deps = [
138        ":pw_rpc",
139        "//pw_protobuf_compiler:pw_protobuf_compiler_protos",
140        "@com_google_protobuf//:protobuf_python",
141    ],
142)
143
144py_test(
145    name = "ids_test",
146    size = "small",
147    srcs = [
148        "tests/ids_test.py",
149    ],
150    deps = [
151        ":pw_rpc",
152        "//pw_build/py:pw_build",
153        "//pw_protobuf_compiler:pw_protobuf_compiler_protos",
154    ],
155)
156
157py_test(
158    name = "packets_test",
159    size = "small",
160    srcs = [
161        "tests/packets_test.py",
162    ],
163    deps = [
164        ":pw_rpc",
165        "//pw_rpc:internal_packet_proto_pb2",
166        "//pw_status/py:pw_status",
167    ],
168)
169