forked from facebook/watchman
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TARGETS
317 lines (291 loc) · 7.5 KB
/
TARGETS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
# Things aren't as nice in here as we'd like, but that's because
# we need to preserve how things build in the autoconf and windows
# builds for watchman.
compiler_flags = [
"-Wunused-variable",
]
os_linker_flags = [
(
"macos",
[
"-framework",
"CoreServices",
],
),
]
# Generates 'config.h' by probing for system capabilities
def prober():
import os
# We're going to extract the configured compiler from the buck config
# and pass that down to the probe script.
config_flags = {
'cc': 'cc_real',
'cppflags': 'cppflags',
'ldflags': 'ldflags',
}
probe_cmd = [
'python',
'$SRCDIR/probe.py',
'--configure=$SRCDIR/configure.ac',
'--cwd=%s' % os.getcwd()]
for name, key in config_flags.iteritems():
val = read_config('cxx', key, read_config('cxx', name, ''))
probe_cmd.append("--%s='%s'" % (name, val))
probe_cmd.append('> $OUT')
buck_genrule(
name='generate_config_h',
srcs=[
'probe.py',
'configure.ac',
],
cmd=' '.join(probe_cmd),
out='config.h',
)
def config_h():
# we use this same convention in the eden build to discover whether
# we are building in the internal fb repo or in the opensourced project(s).
if read_config('codebase', 'mode') == 'public':
prober()
cpp_library(
name='fb_deps',
srcs=[],
)
else:
# Just copy the pre-configured linux attributes so that we have
# know precisely what the characteristics will be for this build.
buck_genrule(
name='generate_config_h',
srcs=['facebook/linux_config.h'],
cmd='cp $SRCDIR/facebook/linux_config.h $OUT',
out='config.h',
)
cpp_library(
name='fb_deps',
srcs=[],
compiler_flags=['-DWATCHMAN_FACEBOOK_INTERNAL'],
deps=[
"@/common/base:build_info",
],
)
config_h()
# Wraps the generated config.h file in a library rule that we can
# depend upon.
buck_cxx_library(
name = "config_h",
header_namespace = "",
exported_headers = [
":generate_config_h",
],
visibility = ["PUBLIC"],
)
# Exports all watchman headers without the 'watchman/' prefix that
# they would otherwise have in our build tree.
buck_cxx_library(
name = "headers",
header_namespace = "",
exported_headers = glob(["**/*.h"]),
exported_deps = [
":config_h",
":fb_deps",
"//watchman/thirdparty/jansson:config_h",
],
visibility = ["PUBLIC"],
)
cpp_library(
name = "eden_watcher",
srcs = [
"watcher/eden.cpp",
],
compiler_flags = compiler_flags,
# We use constructors to declare commands rather than maintaining
# static tables of things. Ensure that they don't get stripped
# out of the final binary!
link_whole = True,
supported_platforms_regex = "glibc",
deps = [
":err",
":headers",
"@/eden/fs/service:thrift-streaming-cpp2",
],
)
# Linux specific watcher module
cpp_library(
name = "sysdep_watcher",
srcs = ["watcher/inotify.cpp"],
compiler_flags = compiler_flags,
# We use constructors to declare commands rather than maintaining
# static tables of things. Ensure that they don't get stripped
# out of the final binary!
link_whole = True,
supported_platforms_regex = "glibc",
deps = [
":eden_watcher",
":err",
":headers",
],
)
# mac specific watcher module
cpp_library(
name = "sysdep_watcher",
srcs = [
"watcher/fsevents.cpp",
"watcher/kqueue.cpp",
],
compiler_flags = compiler_flags,
# We use constructors to declare commands rather than maintaining
# static tables of things. Ensure that they don't get stripped
# out of the final binary!
link_whole = True,
supported_platforms_regex = "macos",
deps = [":headers"],
)
# windows specific watcher module
cpp_library(
name = "sysdep_watcher",
srcs = ["watcher/win32.cpp"],
compiler_flags = compiler_flags,
# We use constructors to declare commands rather than maintaining
# static tables of things. Ensure that they don't get stripped
# out of the final binary!
link_whole = True,
supported_platforms_regex = "windows",
deps = [":headers"],
)
cpp_library(
name = "log",
srcs = [
"PubSub.cpp",
"log.cpp",
],
compiler_flags = compiler_flags,
deps = [
":headers",
"@/watchman/thirdparty/jansson:jansson",
],
)
cpp_library(
name = "hash",
srcs = ["hash.cpp"],
compiler_flags = compiler_flags,
deps = [":headers"],
)
cpp_library(
name = "string",
srcs = ["string.cpp"],
compiler_flags = compiler_flags,
deps = [
":hash",
":headers",
"@/watchman/thirdparty/jansson:utf",
],
)
cpp_library(
name = "err",
srcs = [
"root/poison.cpp",
"root/warnerr.cpp",
],
compiler_flags = compiler_flags,
deps = [":headers"],
)
cpp_library(
name = "pcre",
srcs = ["query/pcre.cpp"],
compiler_flags = ["-DHAVE_PCRE_H"] + compiler_flags,
link_whole = True,
deps = [":headers"],
external_deps = ["pcre"],
)
cpp_library(
name = "testsupport",
srcs = [
"ChildProcess.cpp",
"FileDescriptor.cpp",
"FileInformation.cpp",
"Pipe.cpp",
"ThreadPool.cpp",
"bser.cpp",
"cfg.cpp",
"expflags.cpp",
"ignore.cpp",
"opendir.cpp",
"pending.cpp",
"time.cpp",
],
compiler_flags = compiler_flags,
deps = [
":headers",
":log",
":string",
"@/watchman/thirdparty/jansson:jansson",
"@/watchman/thirdparty/libart/src:art",
],
)
# The bulk of the watchman implementation lives in this library
cpp_library(
name = "watchmanlib",
srcs = glob(
[
"*.cpp",
"query/*.cpp",
"watcher/auto.cpp",
"root/*.cpp",
"cmds/*.cpp",
"scm/*.cpp",
],
excludes = [
"main.cpp",
"stream_win.cpp",
"log.cpp",
"query/pcre.cpp",
"root/warnerr.cpp",
"root/poison.cpp",
],
),
compiler_flags = compiler_flags,
# We use constructors to declare commands rather than maintaining
# static tables of things. Ensure that they don't get stripped
# out of the final binary!
link_whole = True,
os_linker_flags = os_linker_flags,
deps = [
":err",
":headers",
":log",
":pcre",
":string",
":sysdep_watcher",
"@/watchman/thirdparty/jansson:jansson",
"@/watchman/thirdparty/libart/src:art",
"@/watchman/thirdparty/wildmatch:wildmatch",
],
)
# and the watchman binary itself
cpp_binary(
name = "watchman",
srcs = ["main.cpp"],
compiler_flags = compiler_flags,
deps = [
":headers",
":watchmanlib",
],
)
# This is the custom test runner used by the open source build.
python_library(
name = "runtests",
srcs = ["runtests.py"],
py_version = "<3",
deps = [
":watchman",
"@/watchman/tests/integration:testlib",
],
)
python_library(
name = "runtests-py3",
srcs = ["runtests.py"],
py_version = ">=3.5",
deps = [
":watchman",
"@/watchman/tests/integration:testlib-py3",
],
)