xref: /aosp_15_r20/external/pigweed/pw_tokenizer/BUILD.bazel (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1*61c4878aSAndroid Build Coastguard Worker# Copyright 2023 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 Worker
15*61c4878aSAndroid Build Coastguard Workerload("@rules_python//python:proto.bzl", "py_proto_library")
16*61c4878aSAndroid Build Coastguard Workerload("//pw_build:compatibility.bzl", "incompatible_with_mcu")
17*61c4878aSAndroid Build Coastguard Workerload("//pw_build:pw_cc_binary.bzl", "pw_cc_binary")
18*61c4878aSAndroid Build Coastguard Workerload("//pw_build:pw_cc_blob_library.bzl", "pw_cc_blob_info", "pw_cc_blob_library")
19*61c4878aSAndroid Build Coastguard Workerload("//pw_build:pw_linker_script.bzl", "pw_linker_script")
20*61c4878aSAndroid Build Coastguard Workerload("//pw_fuzzer:fuzzer.bzl", "pw_cc_fuzz_test")
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 Workercc_library(
28*61c4878aSAndroid Build Coastguard Worker    name = "pw_tokenizer",
29*61c4878aSAndroid Build Coastguard Worker    srcs = [
30*61c4878aSAndroid Build Coastguard Worker        "encode_args.cc",
31*61c4878aSAndroid Build Coastguard Worker        "hash.cc",
32*61c4878aSAndroid Build Coastguard Worker        "tokenize.cc",
33*61c4878aSAndroid Build Coastguard Worker    ],
34*61c4878aSAndroid Build Coastguard Worker    hdrs = [
35*61c4878aSAndroid Build Coastguard Worker        "public/pw_tokenizer/config.h",
36*61c4878aSAndroid Build Coastguard Worker        "public/pw_tokenizer/encode_args.h",
37*61c4878aSAndroid Build Coastguard Worker        "public/pw_tokenizer/enum.h",
38*61c4878aSAndroid Build Coastguard Worker        "public/pw_tokenizer/hash.h",
39*61c4878aSAndroid Build Coastguard Worker        "public/pw_tokenizer/internal/argument_types.h",
40*61c4878aSAndroid Build Coastguard Worker        "public/pw_tokenizer/internal/argument_types_macro_4_byte.h",
41*61c4878aSAndroid Build Coastguard Worker        "public/pw_tokenizer/internal/argument_types_macro_8_byte.h",
42*61c4878aSAndroid Build Coastguard Worker        "public/pw_tokenizer/internal/enum.h",
43*61c4878aSAndroid Build Coastguard Worker        "public/pw_tokenizer/internal/pw_tokenizer_65599_fixed_length_128_hash_macro.h",
44*61c4878aSAndroid Build Coastguard Worker        "public/pw_tokenizer/internal/pw_tokenizer_65599_fixed_length_256_hash_macro.h",
45*61c4878aSAndroid Build Coastguard Worker        "public/pw_tokenizer/internal/pw_tokenizer_65599_fixed_length_80_hash_macro.h",
46*61c4878aSAndroid Build Coastguard Worker        "public/pw_tokenizer/internal/pw_tokenizer_65599_fixed_length_96_hash_macro.h",
47*61c4878aSAndroid Build Coastguard Worker        "public/pw_tokenizer/internal/tokenize_string.h",
48*61c4878aSAndroid Build Coastguard Worker        "public/pw_tokenizer/nested_tokenization.h",
49*61c4878aSAndroid Build Coastguard Worker        "public/pw_tokenizer/tokenize.h",
50*61c4878aSAndroid Build Coastguard Worker    ],
51*61c4878aSAndroid Build Coastguard Worker    strip_include_prefix = "public",
52*61c4878aSAndroid Build Coastguard Worker    deps = [
53*61c4878aSAndroid Build Coastguard Worker        ":config_override",
54*61c4878aSAndroid Build Coastguard Worker        "//pw_bytes:bit",
55*61c4878aSAndroid Build Coastguard Worker        "//pw_containers:to_array",
56*61c4878aSAndroid Build Coastguard Worker        "//pw_polyfill",
57*61c4878aSAndroid Build Coastguard Worker        "//pw_preprocessor",
58*61c4878aSAndroid Build Coastguard Worker        "//pw_span",
59*61c4878aSAndroid Build Coastguard Worker        "//pw_varint",
60*61c4878aSAndroid Build Coastguard Worker    ],
61*61c4878aSAndroid Build Coastguard Worker)
62*61c4878aSAndroid Build Coastguard Worker
63*61c4878aSAndroid Build Coastguard Workerlabel_flag(
64*61c4878aSAndroid Build Coastguard Worker    name = "config_override",
65*61c4878aSAndroid Build Coastguard Worker    build_setting_default = "//pw_build:default_module_config",
66*61c4878aSAndroid Build Coastguard Worker)
67*61c4878aSAndroid Build Coastguard Worker
68*61c4878aSAndroid Build Coastguard Workerpw_linker_script(
69*61c4878aSAndroid Build Coastguard Worker    name = "linker_script",
70*61c4878aSAndroid Build Coastguard Worker    linker_script = "pw_tokenizer_linker_sections.ld",
71*61c4878aSAndroid Build Coastguard Worker)
72*61c4878aSAndroid Build Coastguard Worker
73*61c4878aSAndroid Build Coastguard Workercc_library(
74*61c4878aSAndroid Build Coastguard Worker    name = "test_backend",
75*61c4878aSAndroid Build Coastguard Worker    visibility = ["//targets:__pkg__"],
76*61c4878aSAndroid Build Coastguard Worker)
77*61c4878aSAndroid Build Coastguard Worker
78*61c4878aSAndroid Build Coastguard Workercc_library(
79*61c4878aSAndroid Build Coastguard Worker    name = "base64",
80*61c4878aSAndroid Build Coastguard Worker    srcs = [
81*61c4878aSAndroid Build Coastguard Worker        "base64.cc",
82*61c4878aSAndroid Build Coastguard Worker    ],
83*61c4878aSAndroid Build Coastguard Worker    hdrs = [
84*61c4878aSAndroid Build Coastguard Worker        "public/pw_tokenizer/base64.h",
85*61c4878aSAndroid Build Coastguard Worker    ],
86*61c4878aSAndroid Build Coastguard Worker    strip_include_prefix = "public",
87*61c4878aSAndroid Build Coastguard Worker    deps = [
88*61c4878aSAndroid Build Coastguard Worker        ":pw_tokenizer",
89*61c4878aSAndroid Build Coastguard Worker        "//pw_base64",
90*61c4878aSAndroid Build Coastguard Worker        "//pw_preprocessor",
91*61c4878aSAndroid Build Coastguard Worker        "//pw_span",
92*61c4878aSAndroid Build Coastguard Worker        "//pw_string:string",
93*61c4878aSAndroid Build Coastguard Worker    ],
94*61c4878aSAndroid Build Coastguard Worker)
95*61c4878aSAndroid Build Coastguard Worker
96*61c4878aSAndroid Build Coastguard Workercc_library(
97*61c4878aSAndroid Build Coastguard Worker    name = "decoder",
98*61c4878aSAndroid Build Coastguard Worker    srcs = [
99*61c4878aSAndroid Build Coastguard Worker        "decode.cc",
100*61c4878aSAndroid Build Coastguard Worker        "detokenize.cc",
101*61c4878aSAndroid Build Coastguard Worker        "token_database.cc",
102*61c4878aSAndroid Build Coastguard Worker    ],
103*61c4878aSAndroid Build Coastguard Worker    hdrs = [
104*61c4878aSAndroid Build Coastguard Worker        "public/pw_tokenizer/detokenize.h",
105*61c4878aSAndroid Build Coastguard Worker        "public/pw_tokenizer/internal/decode.h",
106*61c4878aSAndroid Build Coastguard Worker        "public/pw_tokenizer/token_database.h",
107*61c4878aSAndroid Build Coastguard Worker    ],
108*61c4878aSAndroid Build Coastguard Worker    implementation_deps = [
109*61c4878aSAndroid Build Coastguard Worker        "//pw_elf:reader",
110*61c4878aSAndroid Build Coastguard Worker    ],
111*61c4878aSAndroid Build Coastguard Worker    strip_include_prefix = "public",
112*61c4878aSAndroid Build Coastguard Worker    deps = [
113*61c4878aSAndroid Build Coastguard Worker        ":base64",
114*61c4878aSAndroid Build Coastguard Worker        "//pw_bytes",
115*61c4878aSAndroid Build Coastguard Worker        "//pw_result",
116*61c4878aSAndroid Build Coastguard Worker        "//pw_span",
117*61c4878aSAndroid Build Coastguard Worker        "//pw_stream",
118*61c4878aSAndroid Build Coastguard Worker        "//pw_varint",
119*61c4878aSAndroid Build Coastguard Worker    ],
120*61c4878aSAndroid Build Coastguard Worker)
121*61c4878aSAndroid Build Coastguard Worker
122*61c4878aSAndroid Build Coastguard Workerproto_library(
123*61c4878aSAndroid Build Coastguard Worker    name = "tokenizer_proto",
124*61c4878aSAndroid Build Coastguard Worker    srcs = [
125*61c4878aSAndroid Build Coastguard Worker        "pw_tokenizer_proto/options.proto",
126*61c4878aSAndroid Build Coastguard Worker    ],
127*61c4878aSAndroid Build Coastguard Worker    strip_import_prefix = "/pw_tokenizer",
128*61c4878aSAndroid Build Coastguard Worker    deps = [
129*61c4878aSAndroid Build Coastguard Worker        "@com_google_protobuf//:descriptor_proto",
130*61c4878aSAndroid Build Coastguard Worker    ],
131*61c4878aSAndroid Build Coastguard Worker)
132*61c4878aSAndroid Build Coastguard Worker
133*61c4878aSAndroid Build Coastguard Workerpy_proto_library(
134*61c4878aSAndroid Build Coastguard Worker    name = "tokenizer_proto_py_pb2",
135*61c4878aSAndroid Build Coastguard Worker    deps = [":tokenizer_proto"],
136*61c4878aSAndroid Build Coastguard Worker)
137*61c4878aSAndroid Build Coastguard Worker
138*61c4878aSAndroid Build Coastguard Worker# Executable for generating test data for the C++ and Python detokenizers. This
139*61c4878aSAndroid Build Coastguard Worker# target should only be built for the host.
140*61c4878aSAndroid Build Coastguard Workerpw_cc_binary(
141*61c4878aSAndroid Build Coastguard Worker    name = "generate_decoding_test_data",
142*61c4878aSAndroid Build Coastguard Worker    srcs = [
143*61c4878aSAndroid Build Coastguard Worker        "generate_decoding_test_data.cc",
144*61c4878aSAndroid Build Coastguard Worker    ],
145*61c4878aSAndroid Build Coastguard Worker    target_compatible_with = select(
146*61c4878aSAndroid Build Coastguard Worker        {
147*61c4878aSAndroid Build Coastguard Worker            "@platforms//os:linux": [],
148*61c4878aSAndroid Build Coastguard Worker            "@platforms//os:macos": [],
149*61c4878aSAndroid Build Coastguard Worker            "@platforms//os:windows": [],
150*61c4878aSAndroid Build Coastguard Worker            "//conditions:default": ["@platforms//:incompatible"],
151*61c4878aSAndroid Build Coastguard Worker        },
152*61c4878aSAndroid Build Coastguard Worker    ),
153*61c4878aSAndroid Build Coastguard Worker    deps = [
154*61c4878aSAndroid Build Coastguard Worker        ":decoder",
155*61c4878aSAndroid Build Coastguard Worker        ":pw_tokenizer",
156*61c4878aSAndroid Build Coastguard Worker        "//pw_preprocessor",
157*61c4878aSAndroid Build Coastguard Worker        "//pw_span",
158*61c4878aSAndroid Build Coastguard Worker        "//pw_varint",
159*61c4878aSAndroid Build Coastguard Worker    ],
160*61c4878aSAndroid Build Coastguard Worker)
161*61c4878aSAndroid Build Coastguard Worker
162*61c4878aSAndroid Build Coastguard Workerpw_cc_test(
163*61c4878aSAndroid Build Coastguard Worker    name = "argument_types_test",
164*61c4878aSAndroid Build Coastguard Worker    srcs = [
165*61c4878aSAndroid Build Coastguard Worker        "argument_types_test.cc",
166*61c4878aSAndroid Build Coastguard Worker        "argument_types_test_c.c",
167*61c4878aSAndroid Build Coastguard Worker        "pw_tokenizer_private/argument_types_test.h",
168*61c4878aSAndroid Build Coastguard Worker    ],
169*61c4878aSAndroid Build Coastguard Worker    deps = [
170*61c4878aSAndroid Build Coastguard Worker        ":pw_tokenizer",
171*61c4878aSAndroid Build Coastguard Worker        "//pw_preprocessor",
172*61c4878aSAndroid Build Coastguard Worker        "//pw_unit_test",
173*61c4878aSAndroid Build Coastguard Worker    ],
174*61c4878aSAndroid Build Coastguard Worker)
175*61c4878aSAndroid Build Coastguard Worker
176*61c4878aSAndroid Build Coastguard Workerpw_cc_test(
177*61c4878aSAndroid Build Coastguard Worker    name = "base64_test",
178*61c4878aSAndroid Build Coastguard Worker    srcs = [
179*61c4878aSAndroid Build Coastguard Worker        "base64_test.cc",
180*61c4878aSAndroid Build Coastguard Worker    ],
181*61c4878aSAndroid Build Coastguard Worker    deps = [
182*61c4878aSAndroid Build Coastguard Worker        ":base64",
183*61c4878aSAndroid Build Coastguard Worker        "//pw_span",
184*61c4878aSAndroid Build Coastguard Worker        "//pw_unit_test",
185*61c4878aSAndroid Build Coastguard Worker    ],
186*61c4878aSAndroid Build Coastguard Worker)
187*61c4878aSAndroid Build Coastguard Worker
188*61c4878aSAndroid Build Coastguard Workerpw_cc_test(
189*61c4878aSAndroid Build Coastguard Worker    name = "decode_test",
190*61c4878aSAndroid Build Coastguard Worker    srcs = [
191*61c4878aSAndroid Build Coastguard Worker        "decode_test.cc",
192*61c4878aSAndroid Build Coastguard Worker        "pw_tokenizer_private/tokenized_string_decoding_test_data.h",
193*61c4878aSAndroid Build Coastguard Worker        "pw_tokenizer_private/varint_decoding_test_data.h",
194*61c4878aSAndroid Build Coastguard Worker    ],
195*61c4878aSAndroid Build Coastguard Worker    # TODO: https://pwbug.dev/346628514 - Fix this for rp2040
196*61c4878aSAndroid Build Coastguard Worker    target_compatible_with = select({
197*61c4878aSAndroid Build Coastguard Worker        "//pw_build/constraints/chipset:rp2040": ["@platforms//:incompatible"],
198*61c4878aSAndroid Build Coastguard Worker        "//conditions:default": [],
199*61c4878aSAndroid Build Coastguard Worker    }),
200*61c4878aSAndroid Build Coastguard Worker    deps = [
201*61c4878aSAndroid Build Coastguard Worker        ":decoder",
202*61c4878aSAndroid Build Coastguard Worker        "//pw_unit_test",
203*61c4878aSAndroid Build Coastguard Worker        "//pw_varint",
204*61c4878aSAndroid Build Coastguard Worker    ],
205*61c4878aSAndroid Build Coastguard Worker)
206*61c4878aSAndroid Build Coastguard Worker
207*61c4878aSAndroid Build Coastguard Workerpw_cc_blob_info(
208*61c4878aSAndroid Build Coastguard Worker    name = "detokenizer_example_elf_blob",
209*61c4878aSAndroid Build Coastguard Worker    file_path = "//pw_tokenizer/py:example_binary_with_tokenized_strings",
210*61c4878aSAndroid Build Coastguard Worker    symbol_name = "kElfSection",
211*61c4878aSAndroid Build Coastguard Worker)
212*61c4878aSAndroid Build Coastguard Worker
213*61c4878aSAndroid Build Coastguard Workerpw_cc_blob_library(
214*61c4878aSAndroid Build Coastguard Worker    name = "detokenizer_elf_test_blob",
215*61c4878aSAndroid Build Coastguard Worker    blobs = [
216*61c4878aSAndroid Build Coastguard Worker        ":detokenizer_example_elf_blob",
217*61c4878aSAndroid Build Coastguard Worker    ],
218*61c4878aSAndroid Build Coastguard Worker    namespace = "test::ns",
219*61c4878aSAndroid Build Coastguard Worker    out_header = "pw_tokenizer/example_binary_with_tokenized_strings.h",
220*61c4878aSAndroid Build Coastguard Worker)
221*61c4878aSAndroid Build Coastguard Worker
222*61c4878aSAndroid Build Coastguard Workerpw_cc_test(
223*61c4878aSAndroid Build Coastguard Worker    name = "detokenize_test",
224*61c4878aSAndroid Build Coastguard Worker    srcs = [
225*61c4878aSAndroid Build Coastguard Worker        "detokenize_test.cc",
226*61c4878aSAndroid Build Coastguard Worker    ],
227*61c4878aSAndroid Build Coastguard Worker    deps = [
228*61c4878aSAndroid Build Coastguard Worker        ":decoder",
229*61c4878aSAndroid Build Coastguard Worker        ":detokenizer_elf_test_blob",
230*61c4878aSAndroid Build Coastguard Worker        "//pw_stream",
231*61c4878aSAndroid Build Coastguard Worker        "//pw_unit_test",
232*61c4878aSAndroid Build Coastguard Worker    ],
233*61c4878aSAndroid Build Coastguard Worker)
234*61c4878aSAndroid Build Coastguard Worker
235*61c4878aSAndroid Build Coastguard Workerpw_cc_fuzz_test(
236*61c4878aSAndroid Build Coastguard Worker    name = "detokenize_fuzzer",
237*61c4878aSAndroid Build Coastguard Worker    srcs = ["detokenize_fuzzer.cc"],
238*61c4878aSAndroid Build Coastguard Worker    deps = [
239*61c4878aSAndroid Build Coastguard Worker        ":decoder",
240*61c4878aSAndroid Build Coastguard Worker        ":pw_tokenizer",
241*61c4878aSAndroid Build Coastguard Worker    ],
242*61c4878aSAndroid Build Coastguard Worker)
243*61c4878aSAndroid Build Coastguard Worker
244*61c4878aSAndroid Build Coastguard Workerpw_cc_test(
245*61c4878aSAndroid Build Coastguard Worker    name = "encode_args_test",
246*61c4878aSAndroid Build Coastguard Worker    srcs = ["encode_args_test.cc"],
247*61c4878aSAndroid Build Coastguard Worker    deps = [
248*61c4878aSAndroid Build Coastguard Worker        ":pw_tokenizer",
249*61c4878aSAndroid Build Coastguard Worker        "//pw_unit_test",
250*61c4878aSAndroid Build Coastguard Worker    ],
251*61c4878aSAndroid Build Coastguard Worker)
252*61c4878aSAndroid Build Coastguard Worker
253*61c4878aSAndroid Build Coastguard Workerpw_cc_test(
254*61c4878aSAndroid Build Coastguard Worker    name = "hash_test",
255*61c4878aSAndroid Build Coastguard Worker    srcs = [
256*61c4878aSAndroid Build Coastguard Worker        "hash_test.cc",
257*61c4878aSAndroid Build Coastguard Worker        "pw_tokenizer_private/generated_hash_test_cases.h",
258*61c4878aSAndroid Build Coastguard Worker    ],
259*61c4878aSAndroid Build Coastguard Worker    deps = [
260*61c4878aSAndroid Build Coastguard Worker        ":pw_tokenizer",
261*61c4878aSAndroid Build Coastguard Worker        "//pw_preprocessor",
262*61c4878aSAndroid Build Coastguard Worker        "//pw_unit_test",
263*61c4878aSAndroid Build Coastguard Worker    ],
264*61c4878aSAndroid Build Coastguard Worker)
265*61c4878aSAndroid Build Coastguard Worker
266*61c4878aSAndroid Build Coastguard Workerpw_cc_test(
267*61c4878aSAndroid Build Coastguard Worker    name = "simple_tokenize_test",
268*61c4878aSAndroid Build Coastguard Worker    srcs = [
269*61c4878aSAndroid Build Coastguard Worker        "simple_tokenize_test.cc",
270*61c4878aSAndroid Build Coastguard Worker    ],
271*61c4878aSAndroid Build Coastguard Worker    deps = [
272*61c4878aSAndroid Build Coastguard Worker        ":pw_tokenizer",
273*61c4878aSAndroid Build Coastguard Worker        "//pw_unit_test",
274*61c4878aSAndroid Build Coastguard Worker    ],
275*61c4878aSAndroid Build Coastguard Worker)
276*61c4878aSAndroid Build Coastguard Worker
277*61c4878aSAndroid Build Coastguard Workerpw_cc_test(
278*61c4878aSAndroid Build Coastguard Worker    name = "token_database_test",
279*61c4878aSAndroid Build Coastguard Worker    srcs = [
280*61c4878aSAndroid Build Coastguard Worker        "token_database_test.cc",
281*61c4878aSAndroid Build Coastguard Worker    ],
282*61c4878aSAndroid Build Coastguard Worker    deps = [
283*61c4878aSAndroid Build Coastguard Worker        ":decoder",
284*61c4878aSAndroid Build Coastguard Worker        "//pw_unit_test",
285*61c4878aSAndroid Build Coastguard Worker    ],
286*61c4878aSAndroid Build Coastguard Worker)
287*61c4878aSAndroid Build Coastguard Worker
288*61c4878aSAndroid Build Coastguard Workerpw_cc_test(
289*61c4878aSAndroid Build Coastguard Worker    name = "tokenize_test",
290*61c4878aSAndroid Build Coastguard Worker    srcs = [
291*61c4878aSAndroid Build Coastguard Worker        "pw_tokenizer_private/tokenize_test.h",
292*61c4878aSAndroid Build Coastguard Worker        "tokenize_test.cc",
293*61c4878aSAndroid Build Coastguard Worker        "tokenize_test_c.c",
294*61c4878aSAndroid Build Coastguard Worker    ],
295*61c4878aSAndroid Build Coastguard Worker    # TODO: b/344050496 - get working on rp2040 and stm32f429i
296*61c4878aSAndroid Build Coastguard Worker    target_compatible_with = incompatible_with_mcu(),
297*61c4878aSAndroid Build Coastguard Worker    deps = [
298*61c4878aSAndroid Build Coastguard Worker        ":pw_tokenizer",
299*61c4878aSAndroid Build Coastguard Worker        "//pw_preprocessor",
300*61c4878aSAndroid Build Coastguard Worker        "//pw_unit_test",
301*61c4878aSAndroid Build Coastguard Worker        "//pw_varint",
302*61c4878aSAndroid Build Coastguard Worker    ],
303*61c4878aSAndroid Build Coastguard Worker)
304*61c4878aSAndroid Build Coastguard Worker
305*61c4878aSAndroid Build Coastguard Workerpw_cc_test(
306*61c4878aSAndroid Build Coastguard Worker    name = "tokenize_c99_test",
307*61c4878aSAndroid Build Coastguard Worker    srcs = ["tokenize_c99_test_entry_point.cc"],
308*61c4878aSAndroid Build Coastguard Worker    deps = [
309*61c4878aSAndroid Build Coastguard Worker        ":tokenize_c99_test_c",
310*61c4878aSAndroid Build Coastguard Worker        "//pw_unit_test",
311*61c4878aSAndroid Build Coastguard Worker    ],
312*61c4878aSAndroid Build Coastguard Worker)
313*61c4878aSAndroid Build Coastguard Worker
314*61c4878aSAndroid Build Coastguard Workerpw_cc_test(
315*61c4878aSAndroid Build Coastguard Worker    name = "enum_test",
316*61c4878aSAndroid Build Coastguard Worker    srcs = [
317*61c4878aSAndroid Build Coastguard Worker        "enum_test.cc",
318*61c4878aSAndroid Build Coastguard Worker    ],
319*61c4878aSAndroid Build Coastguard Worker    deps = [
320*61c4878aSAndroid Build Coastguard Worker        "//pw_compilation_testing:negative_compilation_testing",
321*61c4878aSAndroid Build Coastguard Worker        "//pw_tokenizer",
322*61c4878aSAndroid Build Coastguard Worker        "//pw_unit_test",
323*61c4878aSAndroid Build Coastguard Worker    ],
324*61c4878aSAndroid Build Coastguard Worker)
325*61c4878aSAndroid Build Coastguard Worker
326*61c4878aSAndroid Build Coastguard Workercc_library(
327*61c4878aSAndroid Build Coastguard Worker    name = "tokenize_c99_test_c",
328*61c4878aSAndroid Build Coastguard Worker    srcs = ["tokenize_c99_test.c"],
329*61c4878aSAndroid Build Coastguard Worker    copts = [
330*61c4878aSAndroid Build Coastguard Worker        "-std=c99",
331*61c4878aSAndroid Build Coastguard Worker        # pw_tokenizer uses static_assert, so this test uses a static_assert to
332*61c4878aSAndroid Build Coastguard Worker        # verify that it works. Silence warnings about preadopting C11 features.
333*61c4878aSAndroid Build Coastguard Worker        "-Wno-c11-extensions",
334*61c4878aSAndroid Build Coastguard Worker    ],
335*61c4878aSAndroid Build Coastguard Worker    visibility = ["//visibility:private"],
336*61c4878aSAndroid Build Coastguard Worker    deps = [
337*61c4878aSAndroid Build Coastguard Worker        ":pw_tokenizer",
338*61c4878aSAndroid Build Coastguard Worker        "//pw_containers:inline_var_len_entry_queue",
339*61c4878aSAndroid Build Coastguard Worker    ],
340*61c4878aSAndroid Build Coastguard Worker)
341*61c4878aSAndroid Build Coastguard Worker
342*61c4878aSAndroid Build Coastguard Worker# Create a shared library for the tokenizer JNI wrapper. The include paths for
343*61c4878aSAndroid Build Coastguard Worker# the JNI headers must be available in the system or provided with the
344*61c4878aSAndroid Build Coastguard Worker# pw_java_native_interface_include_dirs variable.
345*61c4878aSAndroid Build Coastguard Workerfilegroup(
346*61c4878aSAndroid Build Coastguard Worker    name = "detokenizer_jni",
347*61c4878aSAndroid Build Coastguard Worker    srcs = [
348*61c4878aSAndroid Build Coastguard Worker        "java/dev/pigweed/tokenizer/detokenizer.cc",
349*61c4878aSAndroid Build Coastguard Worker    ],
350*61c4878aSAndroid Build Coastguard Worker)
351*61c4878aSAndroid Build Coastguard Worker
352*61c4878aSAndroid Build Coastguard Workerfilegroup(
353*61c4878aSAndroid Build Coastguard Worker    name = "doxygen",
354*61c4878aSAndroid Build Coastguard Worker    srcs = [
355*61c4878aSAndroid Build Coastguard Worker        "public/pw_tokenizer/config.h",
356*61c4878aSAndroid Build Coastguard Worker        "public/pw_tokenizer/detokenize.h",
357*61c4878aSAndroid Build Coastguard Worker        "public/pw_tokenizer/encode_args.h",
358*61c4878aSAndroid Build Coastguard Worker        "public/pw_tokenizer/enum.h",
359*61c4878aSAndroid Build Coastguard Worker        "public/pw_tokenizer/nested_tokenization.h",
360*61c4878aSAndroid Build Coastguard Worker        "public/pw_tokenizer/token_database.h",
361*61c4878aSAndroid Build Coastguard Worker        "public/pw_tokenizer/tokenize.h",
362*61c4878aSAndroid Build Coastguard Worker    ],
363*61c4878aSAndroid Build Coastguard Worker)
364