• 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        # For importing pw_protobuf
39        ".",
40        # For importing pw_protobuf_codegen_protos and pw_protobuf_protos
41        "..",
42    ],
43    deps = [
44        "//pw_protobuf:codegen_protos_pb2",
45        "//pw_protobuf:field_options_proto_pb2",
46        "@com_google_protobuf//:protobuf_python",
47    ],
48)
49
50py_binary(
51    name = "plugin",
52    srcs = ["pw_protobuf/plugin.py"],
53    imports = ["."],
54    python_version = "PY3",
55    deps = [
56        ":plugin_library",
57        "@com_google_protobuf//:protobuf_python",
58    ],
59)
60
61py_library(
62    name = "pw_protobuf",
63    srcs = [":pw_protobuf_common_sources"],
64    deps = ["//pw_cli/py:pw_cli"],
65)
66