xref: /aosp_15_r20/external/pigweed/pw_protobuf_compiler/BUILD.bazel (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1*61c4878aSAndroid Build Coastguard Worker# Copyright 2020 The Pigweed Authors
2*61c4878aSAndroid Build Coastguard Worker#
3*61c4878aSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4*61c4878aSAndroid Build Coastguard Worker# use this file except in compliance with the License. You may obtain a copy of
5*61c4878aSAndroid Build Coastguard Worker# the License at
6*61c4878aSAndroid Build Coastguard Worker#
7*61c4878aSAndroid Build Coastguard Worker#     https://www.apache.org/licenses/LICENSE-2.0
8*61c4878aSAndroid Build Coastguard Worker#
9*61c4878aSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software
10*61c4878aSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11*61c4878aSAndroid Build Coastguard Worker# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12*61c4878aSAndroid Build Coastguard Worker# License for the specific language governing permissions and limitations under
13*61c4878aSAndroid Build Coastguard Worker# the License.
14*61c4878aSAndroid Build Coastguard Workerload("@rules_proto//proto:defs.bzl", "proto_library")
15*61c4878aSAndroid Build Coastguard Workerload("@rules_python//python:proto.bzl", "py_proto_library")
16*61c4878aSAndroid Build Coastguard Workerload(
17*61c4878aSAndroid Build Coastguard Worker    "//pw_protobuf_compiler:pw_proto_library.bzl",
18*61c4878aSAndroid Build Coastguard Worker    "nanopb_proto_library",
19*61c4878aSAndroid Build Coastguard Worker    "pwpb_proto_library",
20*61c4878aSAndroid Build Coastguard Worker)
21*61c4878aSAndroid Build Coastguard Workerload("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test")
22*61c4878aSAndroid Build Coastguard Worker
23*61c4878aSAndroid Build Coastguard Workerpackage(default_visibility = ["//visibility:public"])
24*61c4878aSAndroid Build Coastguard Worker
25*61c4878aSAndroid Build Coastguard Workerlicenses(["notice"])
26*61c4878aSAndroid Build Coastguard Worker
27*61c4878aSAndroid Build Coastguard Workerpw_cc_test(
28*61c4878aSAndroid Build Coastguard Worker    name = "nanopb_test",
29*61c4878aSAndroid Build Coastguard Worker    srcs = ["nanopb_test.cc"],
30*61c4878aSAndroid Build Coastguard Worker    # TODO: https://pwbug.dev/328311416 - Fix this test.
31*61c4878aSAndroid Build Coastguard Worker    tags = ["manual"],
32*61c4878aSAndroid Build Coastguard Worker    deps = [
33*61c4878aSAndroid Build Coastguard Worker        ":pw_protobuf_compiler_nanopb_protos_nanopb",
34*61c4878aSAndroid Build Coastguard Worker        "//pw_unit_test",
35*61c4878aSAndroid Build Coastguard Worker    ],
36*61c4878aSAndroid Build Coastguard Worker)
37*61c4878aSAndroid Build Coastguard Worker
38*61c4878aSAndroid Build Coastguard Workerpw_cc_test(
39*61c4878aSAndroid Build Coastguard Worker    name = "pwpb_test",
40*61c4878aSAndroid Build Coastguard Worker    srcs = ["pwpb_test.cc"],
41*61c4878aSAndroid Build Coastguard Worker    deps = [
42*61c4878aSAndroid Build Coastguard Worker        "//pw_protobuf_compiler/pwpb_test_protos:pwpb_test_pw_proto",
43*61c4878aSAndroid Build Coastguard Worker        "//pw_string",
44*61c4878aSAndroid Build Coastguard Worker        "//pw_unit_test",
45*61c4878aSAndroid Build Coastguard Worker    ],
46*61c4878aSAndroid Build Coastguard Worker)
47*61c4878aSAndroid Build Coastguard Worker
48*61c4878aSAndroid Build Coastguard Workerproto_library(
49*61c4878aSAndroid Build Coastguard Worker    name = "pwpb_test_proto_no_prefix",
50*61c4878aSAndroid Build Coastguard Worker    srcs = ["pwpb_no_prefix_test_protos/pwpb_test_no_prefix.proto"],
51*61c4878aSAndroid Build Coastguard Worker    strip_import_prefix = "/pw_protobuf_compiler/pwpb_no_prefix_test_protos",
52*61c4878aSAndroid Build Coastguard Worker    deps = [
53*61c4878aSAndroid Build Coastguard Worker        "//pw_protobuf:field_options_proto",
54*61c4878aSAndroid Build Coastguard Worker    ],
55*61c4878aSAndroid Build Coastguard Worker)
56*61c4878aSAndroid Build Coastguard Worker
57*61c4878aSAndroid Build Coastguard Workerpwpb_proto_library(
58*61c4878aSAndroid Build Coastguard Worker    name = "pwpb_test_pw_proto_no_prefix",
59*61c4878aSAndroid Build Coastguard Worker    deps = [
60*61c4878aSAndroid Build Coastguard Worker        ":pwpb_test_proto_no_prefix",
61*61c4878aSAndroid Build Coastguard Worker    ],
62*61c4878aSAndroid Build Coastguard Worker)
63*61c4878aSAndroid Build Coastguard Worker
64*61c4878aSAndroid Build Coastguard Workerpw_cc_test(
65*61c4878aSAndroid Build Coastguard Worker    name = "pwpb_test_no_prefix",
66*61c4878aSAndroid Build Coastguard Worker    srcs = ["pwpb_test_no_prefix.cc"],
67*61c4878aSAndroid Build Coastguard Worker    deps = [
68*61c4878aSAndroid Build Coastguard Worker        ":pwpb_test_pw_proto_no_prefix",
69*61c4878aSAndroid Build Coastguard Worker        "//pw_string",
70*61c4878aSAndroid Build Coastguard Worker        "//pw_unit_test",
71*61c4878aSAndroid Build Coastguard Worker    ],
72*61c4878aSAndroid Build Coastguard Worker)
73*61c4878aSAndroid Build Coastguard Worker
74*61c4878aSAndroid Build Coastguard Workerpy_proto_library(
75*61c4878aSAndroid Build Coastguard Worker    name = "pw_protobuf_compiler_protos_py_pb2",
76*61c4878aSAndroid Build Coastguard Worker    deps = [":pw_protobuf_compiler_protos"],
77*61c4878aSAndroid Build Coastguard Worker)
78*61c4878aSAndroid Build Coastguard Worker
79*61c4878aSAndroid Build Coastguard Workerproto_library(
80*61c4878aSAndroid Build Coastguard Worker    name = "pw_protobuf_compiler_protos",
81*61c4878aSAndroid Build Coastguard Worker    srcs = [
82*61c4878aSAndroid Build Coastguard Worker        "pw_protobuf_compiler_protos/nested/more_nesting/test.proto",
83*61c4878aSAndroid Build Coastguard Worker        "pw_protobuf_compiler_protos/test.proto",
84*61c4878aSAndroid Build Coastguard Worker    ],
85*61c4878aSAndroid Build Coastguard Worker    strip_import_prefix = "/pw_protobuf_compiler",
86*61c4878aSAndroid Build Coastguard Worker)
87*61c4878aSAndroid Build Coastguard Worker
88*61c4878aSAndroid Build Coastguard Workerproto_library(
89*61c4878aSAndroid Build Coastguard Worker    name = "pw_protobuf_compiler_nanopb_protos",
90*61c4878aSAndroid Build Coastguard Worker    srcs = ["nanopb_test_protos/nanopb_test.proto"],
91*61c4878aSAndroid Build Coastguard Worker    deps = ["@com_github_nanopb_nanopb//:nanopb_proto"],
92*61c4878aSAndroid Build Coastguard Worker)
93*61c4878aSAndroid Build Coastguard Worker
94*61c4878aSAndroid Build Coastguard Workernanopb_proto_library(
95*61c4878aSAndroid Build Coastguard Worker    name = "pw_protobuf_compiler_nanopb_protos_nanopb",
96*61c4878aSAndroid Build Coastguard Worker    deps = [":pw_protobuf_compiler_nanopb_protos"],
97*61c4878aSAndroid Build Coastguard Worker)
98*61c4878aSAndroid Build Coastguard Worker
99*61c4878aSAndroid Build Coastguard Workerpy_proto_library(
100*61c4878aSAndroid Build Coastguard Worker    name = "pw_protobuf_compiler_nanopb_protos_py_pb2",
101*61c4878aSAndroid Build Coastguard Worker    deps = [":pw_protobuf_compiler_nanopb_protos"],
102*61c4878aSAndroid Build Coastguard Worker)
103*61c4878aSAndroid Build Coastguard Worker
104*61c4878aSAndroid Build Coastguard Workerpw_cc_test(
105*61c4878aSAndroid Build Coastguard Worker    name = "nested_packages_test",
106*61c4878aSAndroid Build Coastguard Worker    srcs = ["nested_packages_test.cc"],
107*61c4878aSAndroid Build Coastguard Worker    deps = [
108*61c4878aSAndroid Build Coastguard Worker        "//pw_protobuf_compiler/pw_nested_packages:aggregate_pwpb",
109*61c4878aSAndroid Build Coastguard Worker        "//pw_protobuf_compiler/pw_nested_packages:aggregate_wrapper_pwpb",
110*61c4878aSAndroid Build Coastguard Worker        "//pw_protobuf_compiler/pw_nested_packages/data_type/id:id_pwpb",
111*61c4878aSAndroid Build Coastguard Worker        "//pw_protobuf_compiler/pw_nested_packages/data_type/thing:thing_pwpb",
112*61c4878aSAndroid Build Coastguard Worker        "//pw_protobuf_compiler/pw_nested_packages/data_type/thing:type_of_thing_pwpb",
113*61c4878aSAndroid Build Coastguard Worker        "//pw_unit_test",
114*61c4878aSAndroid Build Coastguard Worker    ],
115*61c4878aSAndroid Build Coastguard Worker)
116