xref: /aosp_15_r20/external/pigweed/pw_string/BUILD.bazel (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1# Copyright 2019 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("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test")
16
17package(default_visibility = ["//visibility:public"])
18
19licenses(["notice"])
20
21cc_library(
22    name = "config",
23    hdrs = ["public/pw_string/internal/config.h"],
24    strip_include_prefix = "public",
25    deps = [":config_override"],
26)
27
28label_flag(
29    name = "config_override",
30    build_setting_default = "//pw_build:default_module_config",
31)
32
33cc_library(
34    name = "pw_string",
35    deps = [
36        ":builder",
37        ":format",
38        ":to_string",
39        ":util",
40    ],
41)
42
43cc_library(
44    name = "builder",
45    srcs = ["string_builder.cc"],
46    hdrs = ["public/pw_string/string_builder.h"],
47    strip_include_prefix = "public",
48    deps = [
49        ":format",
50        ":string",
51        ":to_string",
52        ":util",
53        "//pw_preprocessor",
54        "//pw_status",
55    ],
56)
57
58cc_library(
59    name = "format",
60    srcs = ["format.cc"],
61    hdrs = ["public/pw_string/format.h"],
62    strip_include_prefix = "public",
63    deps = [
64        ":string",
65        "//pw_preprocessor",
66        "//pw_span",
67        "//pw_status",
68    ],
69)
70
71cc_library(
72    name = "string",
73    hdrs = [
74        "public/pw_string/internal/string_common_functions.inc",
75        "public/pw_string/internal/string_impl.h",
76        "public/pw_string/string.h",
77    ],
78    strip_include_prefix = "public",
79    deps = ["//pw_assert"],
80)
81
82cc_library(
83    name = "to_string",
84    srcs = ["type_to_string.cc"],
85    hdrs = [
86        "public/pw_string/to_string.h",
87        "public/pw_string/type_to_string.h",
88    ],
89    strip_include_prefix = "public",
90    deps = [
91        ":config",
92        ":format",
93        ":util",
94        "//pw_result",
95        "//pw_status",
96        "//third_party/fuchsia:stdcompat",
97    ],
98)
99
100cc_library(
101    name = "utf_codecs",
102    srcs = ["utf_codecs.cc"],
103    hdrs = ["public/pw_string/utf_codecs.h"],
104    strip_include_prefix = "public",
105    deps = [
106        ":builder",
107        "//pw_assert",
108        "//pw_result",
109        "//pw_span",
110        "//pw_status",
111    ],
112)
113
114cc_library(
115    name = "util",
116    hdrs = [
117        "public/pw_string/internal/length.h",
118        "public/pw_string/util.h",
119    ],
120    strip_include_prefix = "public",
121    deps = [
122        ":string",
123        "//pw_assert",
124        "//pw_result",
125        "//pw_span",
126        "//pw_status",
127    ],
128)
129
130pw_cc_test(
131    name = "format_test",
132    srcs = ["format_test.cc"],
133    deps = [
134        ":format",
135        "//pw_span",
136        "//pw_unit_test",
137    ],
138)
139
140pw_cc_test(
141    name = "string_test",
142    srcs = ["string_test.cc"],
143    deps = [
144        ":string",
145        "//pw_compilation_testing:negative_compilation_testing",
146        "//pw_unit_test",
147    ],
148)
149
150pw_cc_test(
151    name = "type_to_string_test",
152    srcs = ["type_to_string_test.cc"],
153    deps = [
154        ":to_string",
155        "//pw_unit_test",
156    ],
157)
158
159pw_cc_test(
160    name = "string_builder_test",
161    srcs = ["string_builder_test.cc"],
162    deps = [
163        ":builder",
164        "//pw_unit_test",
165    ],
166)
167
168pw_cc_test(
169    name = "to_string_test",
170    srcs = ["to_string_test.cc"],
171    deps = [
172        ":config",
173        ":to_string",
174        "//pw_status",
175        "//pw_unit_test",
176    ],
177)
178
179pw_cc_test(
180    name = "utf_codecs_test",
181    srcs = ["utf_codecs_test.cc"],
182    deps = [
183        ":utf_codecs",
184        "//pw_unit_test",
185    ],
186)
187
188pw_cc_test(
189    name = "util_test",
190    srcs = ["util_test.cc"],
191    deps = [
192        ":util",
193        "//pw_unit_test",
194    ],
195)
196
197filegroup(
198    name = "doxygen",
199    srcs = [
200        "public/pw_string/format.h",
201        "public/pw_string/string.h",
202        "public/pw_string/string_builder.h",
203        "public/pw_string/utf_codecs.h",
204        "public/pw_string/util.h",
205    ],
206)
207