• 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("@rules_python//python:defs.bzl", "py_binary", "py_library")
16
17package(default_visibility = ["//visibility:public"])
18
19licenses(["notice"])
20
21filegroup(
22    name = "pw_protobuf_common_sources",
23    srcs = [
24        "pw_protobuf/__init__.py",
25        "pw_protobuf/codegen_pwpb.py",
26        "pw_protobuf/options.py",
27        "pw_protobuf/output_file.py",
28        "pw_protobuf/plugin.py",
29        "pw_protobuf/proto_tree.py",
30        "pw_protobuf/symbol_name_mapping.py",
31    ],
32)
33
34py_library(
35    name = "plugin_library",
36    srcs = [":pw_protobuf_common_sources"],
37    imports = ["."],
38    deps = [
39        "//pw_protobuf:codegen_protos_pb2",
40        "//pw_protobuf:field_options_proto_pb2",
41        "@com_google_protobuf//:protobuf_python",
42    ],
43)
44
45py_binary(
46    name = "plugin",
47    srcs = ["pw_protobuf/plugin.py"],
48    imports = ["."],
49    python_version = "PY3",
50    deps = [
51        ":plugin_library",
52        "@com_google_protobuf//:protobuf_python",
53    ],
54)
55
56py_library(
57    name = "pw_protobuf",
58    srcs = [":pw_protobuf_common_sources"],
59    deps = ["//pw_cli/py:pw_cli"],
60)
61