xref: /aosp_15_r20/external/regex-re2/BUILD (revision ccdc9c3e24c519bfa4832a66aa2e83a52c19f295)
1# Copyright 2009 The RE2 Authors.  All Rights Reserved.
2# Use of this source code is governed by a BSD-style
3# license that can be found in the LICENSE file.
4
5# Bazel (http://bazel.io/) BUILD file for RE2.
6
7licenses(["notice"])
8
9exports_files(["LICENSE"])
10
11config_setting(
12    name = "darwin",
13    values = {"cpu": "darwin"},
14)
15
16config_setting(
17    name = "windows",
18    values = {"cpu": "x64_windows"},
19)
20
21config_setting(
22    name = "windows_msvc",
23    values = {"cpu": "x64_windows_msvc"},
24)
25
26cc_library(
27    name = "re2",
28    srcs = [
29        "re2/bitmap256.h",
30        "re2/bitstate.cc",
31        "re2/compile.cc",
32        "re2/dfa.cc",
33        "re2/filtered_re2.cc",
34        "re2/mimics_pcre.cc",
35        "re2/nfa.cc",
36        "re2/onepass.cc",
37        "re2/parse.cc",
38        "re2/perl_groups.cc",
39        "re2/prefilter.cc",
40        "re2/prefilter.h",
41        "re2/prefilter_tree.cc",
42        "re2/prefilter_tree.h",
43        "re2/prog.cc",
44        "re2/prog.h",
45        "re2/re2.cc",
46        "re2/regexp.cc",
47        "re2/regexp.h",
48        "re2/set.cc",
49        "re2/simplify.cc",
50        "re2/stringpiece.cc",
51        "re2/tostring.cc",
52        "re2/unicode_casefold.cc",
53        "re2/unicode_casefold.h",
54        "re2/unicode_groups.cc",
55        "re2/unicode_groups.h",
56        "re2/walker-inl.h",
57        "util/flags.h",
58        "util/logging.h",
59        "util/mix.h",
60        "util/mutex.h",
61        "util/pod_array.h",
62        "util/rune.cc",
63        "util/sparse_array.h",
64        "util/sparse_set.h",
65        "util/strutil.cc",
66        "util/strutil.h",
67        "util/utf.h",
68        "util/util.h",
69    ],
70    hdrs = [
71        "re2/filtered_re2.h",
72        "re2/re2.h",
73        "re2/set.h",
74        "re2/stringpiece.h",
75    ],
76    copts = select({
77        ":windows": [],
78        ":windows_msvc": [],
79        "//conditions:default": ["-pthread"],
80    }),
81    linkopts = select({
82        # Darwin doesn't need `-pthread' when linking and it appears that
83        # older versions of Clang will warn about the unused command line
84        # argument, so just don't pass it.
85        ":darwin": [],
86        ":windows": [],
87        ":windows_msvc": [],
88        "//conditions:default": ["-pthread"],
89    }),
90    visibility = ["//visibility:public"],
91)
92
93cc_library(
94    name = "testing",
95    testonly = 1,
96    srcs = [
97        "re2/testing/backtrack.cc",
98        "re2/testing/dump.cc",
99        "re2/testing/exhaustive_tester.cc",
100        "re2/testing/null_walker.cc",
101        "re2/testing/regexp_generator.cc",
102        "re2/testing/string_generator.cc",
103        "re2/testing/tester.cc",
104        "util/pcre.cc",
105    ],
106    hdrs = [
107        "re2/testing/exhaustive_tester.h",
108        "re2/testing/regexp_generator.h",
109        "re2/testing/string_generator.h",
110        "re2/testing/tester.h",
111        "util/benchmark.h",
112        "util/pcre.h",
113        "util/test.h",
114    ],
115    deps = [":re2"],
116)
117
118cc_library(
119    name = "test",
120    testonly = 1,
121    srcs = ["util/test.cc"],
122    deps = [":testing"],
123)
124
125load(":re2_test.bzl", "re2_test")
126
127re2_test(
128    "charclass_test",
129    size = "small",
130)
131
132re2_test(
133    "compile_test",
134    size = "small",
135)
136
137re2_test(
138    "filtered_re2_test",
139    size = "small",
140)
141
142re2_test(
143    "mimics_pcre_test",
144    size = "small",
145)
146
147re2_test(
148    "parse_test",
149    size = "small",
150)
151
152re2_test(
153    "possible_match_test",
154    size = "small",
155)
156
157re2_test(
158    "re2_arg_test",
159    size = "small",
160)
161
162re2_test(
163    "re2_test",
164    size = "small",
165)
166
167re2_test(
168    "regexp_test",
169    size = "small",
170)
171
172re2_test(
173    "required_prefix_test",
174    size = "small",
175)
176
177re2_test(
178    "search_test",
179    size = "small",
180)
181
182re2_test(
183    "set_test",
184    size = "small",
185)
186
187re2_test(
188    "simplify_test",
189    size = "small",
190)
191
192re2_test(
193    "string_generator_test",
194    size = "small",
195)
196
197re2_test(
198    "dfa_test",
199    size = "large",
200)
201
202re2_test(
203    "exhaustive1_test",
204    size = "large",
205)
206
207re2_test(
208    "exhaustive2_test",
209    size = "large",
210)
211
212re2_test(
213    "exhaustive3_test",
214    size = "large",
215)
216
217re2_test(
218    "exhaustive_test",
219    size = "large",
220)
221
222re2_test(
223    "random_test",
224    size = "large",
225)
226
227cc_library(
228    name = "benchmark",
229    testonly = 1,
230    srcs = ["util/benchmark.cc"],
231    deps = [":testing"],
232)
233
234cc_binary(
235    name = "regexp_benchmark",
236    testonly = 1,
237    srcs = ["re2/testing/regexp_benchmark.cc"],
238    deps = [":benchmark"],
239)
240