blob: 30ce32094f8d7b2b03efe5e525251f45f92a796a [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(
Robert Sayre0af56932018-02-18 06:47:46 -080012 name = "darwin",
13 values = {"cpu": "darwin"},
14)
15
16config_setting(
Loo Rong Jied66aaaa2018-01-10 13:41:05 +080017 name = "windows",
Paul Wankadia7cf8b882018-01-11 15:33:02 +110018 values = {"cpu": "x64_windows"},
Loo Rong Jied66aaaa2018-01-10 13:41:05 +080019)
20
21config_setting(
22 name = "windows_msvc",
23 values = {"cpu": "x64_windows_msvc"},
24)
25
Ming Zhaodd223322015-04-21 11:41:18 -070026cc_library(
Paul Wankadiaa96b4642015-04-27 20:29:47 +100027 name = "re2",
28 srcs = [
Paul Wankadiafb40e7d2016-08-04 20:20:03 +100029 "re2/bitmap256.h",
Paul Wankadiaa96b4642015-04-27 20:29:47 +100030 "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",
Paul Wankadia791beff2015-11-17 00:15:44 +110050 "re2/stringpiece.cc",
Paul Wankadiaa96b4642015-04-27 20:29:47 +100051 "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",
Paul Wankadiaa96b4642015-04-27 20:29:47 +100057 "util/flags.h",
Paul Wankadiaa96b4642015-04-27 20:29:47 +100058 "util/logging.h",
Paul Wankadia1e8fade2016-08-16 22:27:03 +100059 "util/mix.h",
Paul Wankadiaa96b4642015-04-27 20:29:47 +100060 "util/mutex.h",
Paul Wankadia75c77882018-08-30 06:04:50 -070061 "util/pod_array.h",
Paul Wankadiaa96b4642015-04-27 20:29:47 +100062 "util/rune.cc",
63 "util/sparse_array.h",
64 "util/sparse_set.h",
Paul Wankadiaa96b4642015-04-27 20:29:47 +100065 "util/strutil.cc",
Paul Wankadia95ce0cc2016-08-16 23:11:37 +100066 "util/strutil.h",
Paul Wankadiaa96b4642015-04-27 20:29:47 +100067 "util/utf.h",
68 "util/util.h",
Paul Wankadiaa96b4642015-04-27 20:29:47 +100069 ],
70 hdrs = [
71 "re2/filtered_re2.h",
72 "re2/re2.h",
73 "re2/set.h",
Paul Wankadia791beff2015-11-17 00:15:44 +110074 "re2/stringpiece.h",
Paul Wankadiaa96b4642015-04-27 20:29:47 +100075 ],
Loo Rong Jied66aaaa2018-01-10 13:41:05 +080076 copts = select({
77 ":windows": [],
78 ":windows_msvc": [],
79 "//conditions:default": ["-pthread"],
80 }),
81 linkopts = select({
Robert Sayre0af56932018-02-18 06:47:46 -080082 # 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": [],
Loo Rong Jied66aaaa2018-01-10 13:41:05 +080086 ":windows": [],
87 ":windows_msvc": [],
88 "//conditions:default": ["-pthread"],
89 }),
Paul Wankadiaa96b4642015-04-27 20:29:47 +100090 visibility = ["//visibility:public"],
Ming Zhaodd223322015-04-21 11:41:18 -070091)
92
Ming Zhaodd223322015-04-21 11:41:18 -070093cc_library(
Thiago Farina5f4c8552016-04-12 08:22:52 -030094 name = "testing",
Paul Wankadiaa96b4642015-04-27 20:29:47 +100095 testonly = 1,
96 srcs = [
97 "re2/testing/backtrack.cc",
98 "re2/testing/dump.cc",
Paul Wankadiaf3a95882015-09-26 03:21:18 +100099 "re2/testing/exhaustive_tester.cc",
100 "re2/testing/null_walker.cc",
Paul Wankadiaa96b4642015-04-27 20:29:47 +1000101 "re2/testing/regexp_generator.cc",
102 "re2/testing/string_generator.cc",
103 "re2/testing/tester.cc",
104 "util/pcre.cc",
Paul Wankadiaa96b4642015-04-27 20:29:47 +1000105 ],
106 hdrs = [
Paul Wankadiaf3a95882015-09-26 03:21:18 +1000107 "re2/testing/exhaustive_tester.h",
Paul Wankadiaa96b4642015-04-27 20:29:47 +1000108 "re2/testing/regexp_generator.h",
109 "re2/testing/string_generator.h",
110 "re2/testing/tester.h",
Paul Wankadiab12a3242016-04-14 14:34:20 +1000111 "util/benchmark.h",
Paul Wankadiaa96b4642015-04-27 20:29:47 +1000112 "util/pcre.h",
Damien Martin-Guillerez5968df02016-03-31 17:35:34 +0200113 "util/test.h",
Paul Wankadiaa96b4642015-04-27 20:29:47 +1000114 ],
Paul Wankadia791beff2015-11-17 00:15:44 +1100115 deps = [":re2"],
Ming Zhaodd223322015-04-21 11:41:18 -0700116)
117
Thiago Farina5f4c8552016-04-12 08:22:52 -0300118cc_library(
119 name = "test",
Damien Martin-Guillerezfc5ff3b2016-10-20 11:52:13 +0200120 testonly = 1,
Paul Wankadiab12a3242016-04-14 14:34:20 +1000121 srcs = ["util/test.cc"],
Thiago Farina5f4c8552016-04-12 08:22:52 -0300122 deps = [":testing"],
123)
124
Paul Wankadia884287d2017-10-11 21:37:57 +1100125load(":re2_test.bzl", "re2_test")
Ming Zhaodd223322015-04-21 11:41:18 -0700126
Paul Wankadia5ca216d2017-10-11 21:33:59 +1100127re2_test(
128 "charclass_test",
129 size = "small",
130)
Shahms King63e4dbd2016-03-04 10:45:44 -0800131
Paul Wankadia5ca216d2017-10-11 21:33:59 +1100132re2_test(
133 "compile_test",
134 size = "small",
135)
Shahms King63e4dbd2016-03-04 10:45:44 -0800136
Paul Wankadia5ca216d2017-10-11 21:33:59 +1100137re2_test(
138 "filtered_re2_test",
139 size = "small",
140)
Shahms King63e4dbd2016-03-04 10:45:44 -0800141
Paul Wankadia5ca216d2017-10-11 21:33:59 +1100142re2_test(
143 "mimics_pcre_test",
144 size = "small",
145)
Shahms King63e4dbd2016-03-04 10:45:44 -0800146
Paul Wankadia5ca216d2017-10-11 21:33:59 +1100147re2_test(
148 "parse_test",
149 size = "small",
150)
Shahms King63e4dbd2016-03-04 10:45:44 -0800151
Paul Wankadia5ca216d2017-10-11 21:33:59 +1100152re2_test(
153 "possible_match_test",
154 size = "small",
155)
Shahms King63e4dbd2016-03-04 10:45:44 -0800156
Paul Wankadia5ca216d2017-10-11 21:33:59 +1100157re2_test(
158 "re2_arg_test",
159 size = "small",
160)
Shahms King63e4dbd2016-03-04 10:45:44 -0800161
Paul Wankadia5ca216d2017-10-11 21:33:59 +1100162re2_test(
163 "re2_test",
164 size = "small",
165)
Shahms King63e4dbd2016-03-04 10:45:44 -0800166
Paul Wankadia5ca216d2017-10-11 21:33:59 +1100167re2_test(
168 "regexp_test",
169 size = "small",
170)
Shahms King63e4dbd2016-03-04 10:45:44 -0800171
Paul Wankadia5ca216d2017-10-11 21:33:59 +1100172re2_test(
173 "required_prefix_test",
174 size = "small",
175)
Shahms King63e4dbd2016-03-04 10:45:44 -0800176
Paul Wankadia5ca216d2017-10-11 21:33:59 +1100177re2_test(
178 "search_test",
179 size = "small",
180)
Shahms King63e4dbd2016-03-04 10:45:44 -0800181
Paul Wankadia5ca216d2017-10-11 21:33:59 +1100182re2_test(
183 "set_test",
184 size = "small",
185)
Shahms King63e4dbd2016-03-04 10:45:44 -0800186
Paul Wankadia5ca216d2017-10-11 21:33:59 +1100187re2_test(
188 "simplify_test",
189 size = "small",
190)
Shahms King63e4dbd2016-03-04 10:45:44 -0800191
Paul Wankadia5ca216d2017-10-11 21:33:59 +1100192re2_test(
193 "string_generator_test",
194 size = "small",
195)
Ming Zhaodd223322015-04-21 11:41:18 -0700196
Shahms King63e4dbd2016-03-04 10:45:44 -0800197re2_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)
Paul Wankadiaf3a95882015-09-26 03:21:18 +1000226
Thiago Farina5f4c8552016-04-12 08:22:52 -0300227cc_library(
228 name = "benchmark",
Damien Martin-Guillerezfc5ff3b2016-10-20 11:52:13 +0200229 testonly = 1,
Paul Wankadiab12a3242016-04-14 14:34:20 +1000230 srcs = ["util/benchmark.cc"],
Thiago Farina5f4c8552016-04-12 08:22:52 -0300231 deps = [":testing"],
232)
233
234cc_binary(
235 name = "regexp_benchmark",
Damien Martin-Guillerezfc5ff3b2016-10-20 11:52:13 +0200236 testonly = 1,
Paul Wankadiab12a3242016-04-14 14:34:20 +1000237 srcs = ["re2/testing/regexp_benchmark.cc"],
Thiago Farina5f4c8552016-04-12 08:22:52 -0300238 deps = [":benchmark"],
239)