xref: /aosp_15_r20/external/pigweed/pw_protobuf_compiler/BUILD.bazel (revision 61c4878ac05f98d0ceed94b57d316916de578985)
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.
14load("@rules_proto//proto:defs.bzl", "proto_library")
15load("@rules_python//python:proto.bzl", "py_proto_library")
16load(
17    "//pw_protobuf_compiler:pw_proto_library.bzl",
18    "nanopb_proto_library",
19    "pwpb_proto_library",
20)
21load("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test")
22
23package(default_visibility = ["//visibility:public"])
24
25licenses(["notice"])
26
27pw_cc_test(
28    name = "nanopb_test",
29    srcs = ["nanopb_test.cc"],
30    # TODO: https://pwbug.dev/328311416 - Fix this test.
31    tags = ["manual"],
32    deps = [
33        ":pw_protobuf_compiler_nanopb_protos_nanopb",
34        "//pw_unit_test",
35    ],
36)
37
38pw_cc_test(
39    name = "pwpb_test",
40    srcs = ["pwpb_test.cc"],
41    deps = [
42        "//pw_protobuf_compiler/pwpb_test_protos:pwpb_test_pw_proto",
43        "//pw_string",
44        "//pw_unit_test",
45    ],
46)
47
48proto_library(
49    name = "pwpb_test_proto_no_prefix",
50    srcs = ["pwpb_no_prefix_test_protos/pwpb_test_no_prefix.proto"],
51    strip_import_prefix = "/pw_protobuf_compiler/pwpb_no_prefix_test_protos",
52    deps = [
53        "//pw_protobuf:field_options_proto",
54    ],
55)
56
57pwpb_proto_library(
58    name = "pwpb_test_pw_proto_no_prefix",
59    deps = [
60        ":pwpb_test_proto_no_prefix",
61    ],
62)
63
64pw_cc_test(
65    name = "pwpb_test_no_prefix",
66    srcs = ["pwpb_test_no_prefix.cc"],
67    deps = [
68        ":pwpb_test_pw_proto_no_prefix",
69        "//pw_string",
70        "//pw_unit_test",
71    ],
72)
73
74py_proto_library(
75    name = "pw_protobuf_compiler_protos_py_pb2",
76    deps = [":pw_protobuf_compiler_protos"],
77)
78
79proto_library(
80    name = "pw_protobuf_compiler_protos",
81    srcs = [
82        "pw_protobuf_compiler_protos/nested/more_nesting/test.proto",
83        "pw_protobuf_compiler_protos/test.proto",
84    ],
85    strip_import_prefix = "/pw_protobuf_compiler",
86)
87
88proto_library(
89    name = "pw_protobuf_compiler_nanopb_protos",
90    srcs = ["nanopb_test_protos/nanopb_test.proto"],
91    deps = ["@com_github_nanopb_nanopb//:nanopb_proto"],
92)
93
94nanopb_proto_library(
95    name = "pw_protobuf_compiler_nanopb_protos_nanopb",
96    deps = [":pw_protobuf_compiler_nanopb_protos"],
97)
98
99py_proto_library(
100    name = "pw_protobuf_compiler_nanopb_protos_py_pb2",
101    deps = [":pw_protobuf_compiler_nanopb_protos"],
102)
103
104pw_cc_test(
105    name = "nested_packages_test",
106    srcs = ["nested_packages_test.cc"],
107    deps = [
108        "//pw_protobuf_compiler/pw_nested_packages:aggregate_pwpb",
109        "//pw_protobuf_compiler/pw_nested_packages:aggregate_wrapper_pwpb",
110        "//pw_protobuf_compiler/pw_nested_packages/data_type/id:id_pwpb",
111        "//pw_protobuf_compiler/pw_nested_packages/data_type/thing:thing_pwpb",
112        "//pw_protobuf_compiler/pw_nested_packages/data_type/thing:type_of_thing_pwpb",
113        "//pw_unit_test",
114    ],
115)
116