blob: 3a78ea9b9e0684d1f0af276c4c33e18e344adfbd [file] [log] [blame]
Paul Wankadiaf3a95882015-09-26 03:21:18 +10001# 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
Paul Wankadiaa96b4642015-04-27 20:29:47 +10005# Bazel (http://bazel.io/) BUILD file for RE2.
Ming Zhaodd223322015-04-21 11:41:18 -07006
7licenses(["notice"])
8
Shahms King63e4dbd2016-03-04 10:45:44 -08009exports_files(["LICENSE"])
10
Loo Rong Jied66aaaa2018-01-10 13:41:05 +080011config_setting(
12 name = "windows",
13 values = { "cpu": "x64_windows" },
14)
15
16config_setting(
17 name = "windows_msvc",
18 values = {"cpu": "x64_windows_msvc"},
19)
20
Ming Zhaodd223322015-04-21 11:41:18 -070021cc_library(
Paul Wankadiaa96b4642015-04-27 20:29:47 +100022 name = "re2",
23 srcs = [
Paul Wankadiafb40e7d2016-08-04 20:20:03 +100024 "re2/bitmap256.h",
Paul Wankadiaa96b4642015-04-27 20:29:47 +100025 "re2/bitstate.cc",
26 "re2/compile.cc",
27 "re2/dfa.cc",
28 "re2/filtered_re2.cc",
29 "re2/mimics_pcre.cc",
30 "re2/nfa.cc",
31 "re2/onepass.cc",
32 "re2/parse.cc",
33 "re2/perl_groups.cc",
34 "re2/prefilter.cc",
35 "re2/prefilter.h",
36 "re2/prefilter_tree.cc",
37 "re2/prefilter_tree.h",
38 "re2/prog.cc",
39 "re2/prog.h",
40 "re2/re2.cc",
41 "re2/regexp.cc",
42 "re2/regexp.h",
43 "re2/set.cc",
44 "re2/simplify.cc",
Paul Wankadia791beff2015-11-17 00:15:44 +110045 "re2/stringpiece.cc",
Paul Wankadiaa96b4642015-04-27 20:29:47 +100046 "re2/tostring.cc",
47 "re2/unicode_casefold.cc",
48 "re2/unicode_casefold.h",
49 "re2/unicode_groups.cc",
50 "re2/unicode_groups.h",
51 "re2/walker-inl.h",
Paul Wankadiaa96b4642015-04-27 20:29:47 +100052 "util/flags.h",
Paul Wankadiaa96b4642015-04-27 20:29:47 +100053 "util/logging.h",
Paul Wankadia1e8fade2016-08-16 22:27:03 +100054 "util/mix.h",
Paul Wankadiaa96b4642015-04-27 20:29:47 +100055 "util/mutex.h",
56 "util/rune.cc",
57 "util/sparse_array.h",
58 "util/sparse_set.h",
Paul Wankadiaa96b4642015-04-27 20:29:47 +100059 "util/strutil.cc",
Paul Wankadia95ce0cc2016-08-16 23:11:37 +100060 "util/strutil.h",
Paul Wankadiaa96b4642015-04-27 20:29:47 +100061 "util/utf.h",
62 "util/util.h",
Paul Wankadiaa96b4642015-04-27 20:29:47 +100063 ],
64 hdrs = [
65 "re2/filtered_re2.h",
66 "re2/re2.h",
67 "re2/set.h",
Paul Wankadia791beff2015-11-17 00:15:44 +110068 "re2/stringpiece.h",
Paul Wankadiaa96b4642015-04-27 20:29:47 +100069 ],
Loo Rong Jied66aaaa2018-01-10 13:41:05 +080070 copts = select({
71 ":windows": [],
72 ":windows_msvc": [],
73 "//conditions:default": ["-pthread"],
74 }),
75 linkopts = select({
76 ":windows": [],
77 ":windows_msvc": [],
78 "//conditions:default": ["-pthread"],
79 }),
Paul Wankadiaa96b4642015-04-27 20:29:47 +100080 visibility = ["//visibility:public"],
Ming Zhaodd223322015-04-21 11:41:18 -070081)
82
Ming Zhaodd223322015-04-21 11:41:18 -070083cc_library(
Thiago Farina5f4c8552016-04-12 08:22:52 -030084 name = "testing",
Paul Wankadiaa96b4642015-04-27 20:29:47 +100085 testonly = 1,
86 srcs = [
87 "re2/testing/backtrack.cc",
88 "re2/testing/dump.cc",
Paul Wankadiaf3a95882015-09-26 03:21:18 +100089 "re2/testing/exhaustive_tester.cc",
90 "re2/testing/null_walker.cc",
Paul Wankadiaa96b4642015-04-27 20:29:47 +100091 "re2/testing/regexp_generator.cc",
92 "re2/testing/string_generator.cc",
93 "re2/testing/tester.cc",
94 "util/pcre.cc",
Paul Wankadiaa96b4642015-04-27 20:29:47 +100095 ],
96 hdrs = [
Paul Wankadiaf3a95882015-09-26 03:21:18 +100097 "re2/testing/exhaustive_tester.h",
Paul Wankadiaa96b4642015-04-27 20:29:47 +100098 "re2/testing/regexp_generator.h",
99 "re2/testing/string_generator.h",
100 "re2/testing/tester.h",
Paul Wankadiab12a3242016-04-14 14:34:20 +1000101 "util/benchmark.h",
Paul Wankadiaa96b4642015-04-27 20:29:47 +1000102 "util/pcre.h",
Damien Martin-Guillerez5968df02016-03-31 17:35:34 +0200103 "util/test.h",
Paul Wankadiaa96b4642015-04-27 20:29:47 +1000104 ],
Paul Wankadia791beff2015-11-17 00:15:44 +1100105 deps = [":re2"],
Ming Zhaodd223322015-04-21 11:41:18 -0700106)
107
Thiago Farina5f4c8552016-04-12 08:22:52 -0300108cc_library(
109 name = "test",
Damien Martin-Guillerezfc5ff3b2016-10-20 11:52:13 +0200110 testonly = 1,
Paul Wankadiab12a3242016-04-14 14:34:20 +1000111 srcs = ["util/test.cc"],
Thiago Farina5f4c8552016-04-12 08:22:52 -0300112 deps = [":testing"],
113)
114
Paul Wankadia884287d2017-10-11 21:37:57 +1100115load(":re2_test.bzl", "re2_test")
Ming Zhaodd223322015-04-21 11:41:18 -0700116
Paul Wankadia5ca216d2017-10-11 21:33:59 +1100117re2_test(
118 "charclass_test",
119 size = "small",
120)
Shahms King63e4dbd2016-03-04 10:45:44 -0800121
Paul Wankadia5ca216d2017-10-11 21:33:59 +1100122re2_test(
123 "compile_test",
124 size = "small",
125)
Shahms King63e4dbd2016-03-04 10:45:44 -0800126
Paul Wankadia5ca216d2017-10-11 21:33:59 +1100127re2_test(
128 "filtered_re2_test",
129 size = "small",
130)
Shahms King63e4dbd2016-03-04 10:45:44 -0800131
Paul Wankadia5ca216d2017-10-11 21:33:59 +1100132re2_test(
133 "mimics_pcre_test",
134 size = "small",
135)
Shahms King63e4dbd2016-03-04 10:45:44 -0800136
Paul Wankadia5ca216d2017-10-11 21:33:59 +1100137re2_test(
138 "parse_test",
139 size = "small",
140)
Shahms King63e4dbd2016-03-04 10:45:44 -0800141
Paul Wankadia5ca216d2017-10-11 21:33:59 +1100142re2_test(
143 "possible_match_test",
144 size = "small",
145)
Shahms King63e4dbd2016-03-04 10:45:44 -0800146
Paul Wankadia5ca216d2017-10-11 21:33:59 +1100147re2_test(
148 "re2_arg_test",
149 size = "small",
150)
Shahms King63e4dbd2016-03-04 10:45:44 -0800151
Paul Wankadia5ca216d2017-10-11 21:33:59 +1100152re2_test(
153 "re2_test",
154 size = "small",
155)
Shahms King63e4dbd2016-03-04 10:45:44 -0800156
Paul Wankadia5ca216d2017-10-11 21:33:59 +1100157re2_test(
158 "regexp_test",
159 size = "small",
160)
Shahms King63e4dbd2016-03-04 10:45:44 -0800161
Paul Wankadia5ca216d2017-10-11 21:33:59 +1100162re2_test(
163 "required_prefix_test",
164 size = "small",
165)
Shahms King63e4dbd2016-03-04 10:45:44 -0800166
Paul Wankadia5ca216d2017-10-11 21:33:59 +1100167re2_test(
168 "search_test",
169 size = "small",
170)
Shahms King63e4dbd2016-03-04 10:45:44 -0800171
Paul Wankadia5ca216d2017-10-11 21:33:59 +1100172re2_test(
173 "set_test",
174 size = "small",
175)
Shahms King63e4dbd2016-03-04 10:45:44 -0800176
Paul Wankadia5ca216d2017-10-11 21:33:59 +1100177re2_test(
178 "simplify_test",
179 size = "small",
180)
Shahms King63e4dbd2016-03-04 10:45:44 -0800181
Paul Wankadia5ca216d2017-10-11 21:33:59 +1100182re2_test(
183 "string_generator_test",
184 size = "small",
185)
Ming Zhaodd223322015-04-21 11:41:18 -0700186
Shahms King63e4dbd2016-03-04 10:45:44 -0800187re2_test(
188 "dfa_test",
189 size = "large",
190)
191
192re2_test(
193 "exhaustive1_test",
194 size = "large",
195)
196
197re2_test(
198 "exhaustive2_test",
199 size = "large",
200)
201
202re2_test(
203 "exhaustive3_test",
204 size = "large",
205)
206
207re2_test(
208 "exhaustive_test",
209 size = "large",
210)
211
212re2_test(
213 "random_test",
214 size = "large",
215)
Paul Wankadiaf3a95882015-09-26 03:21:18 +1000216
Thiago Farina5f4c8552016-04-12 08:22:52 -0300217cc_library(
218 name = "benchmark",
Damien Martin-Guillerezfc5ff3b2016-10-20 11:52:13 +0200219 testonly = 1,
Paul Wankadiab12a3242016-04-14 14:34:20 +1000220 srcs = ["util/benchmark.cc"],
Thiago Farina5f4c8552016-04-12 08:22:52 -0300221 deps = [":testing"],
222)
223
224cc_binary(
225 name = "regexp_benchmark",
Damien Martin-Guillerezfc5ff3b2016-10-20 11:52:13 +0200226 testonly = 1,
Paul Wankadiab12a3242016-04-14 14:34:20 +1000227 srcs = ["re2/testing/regexp_benchmark.cc"],
Loo Rong Jied66aaaa2018-01-10 13:41:05 +0800228 linkopts = select({
229 ":windows": [],
230 ":windows_msvc": [],
231 "//conditions:default": [
232 "-lm",
233 "-lrt",
234 ],
235 }),
Thiago Farina5f4c8552016-04-12 08:22:52 -0300236 deps = [":benchmark"],
237)