forked from facebook/infer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDEFS
47 lines (44 loc) · 1.13 KB
/
DEFS
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
import os
original_java_library = java_library
def java_library(
name,
deps=[],
**kwargs
):
compile_name = name + '_compile'
top_deps = []
if 'GENERATE_INFER_GENRULES' in os.environ:
export_srcs_name = name + '_export_srcs'
genrule(
name = export_srcs_name,
srcs = kwargs.get('srcs', []),
cmd = 'mkdir -p $OUT && cp -R $SRCDIR/* $OUT/',
out = 'src_copy',
)
infer_name = name + '_infer'
genrule(
name = infer_name,
cmd = ' '.join([
os.getenv('INFER_BIN', 'infer'),
'--results-dir', '$OUT',
'--classpath', '$(classpath :{})'.format(compile_name),
'--sourcepath', '$(location :{})'.format(export_srcs_name),
'--generated-classes', '$(location :{})'.format(compile_name),
'--', 'genrule'
]),
out = 'infer_out',
)
top_deps += [':' + infer_name, ':' + export_srcs_name]
original_java_library(
name=name,
exported_deps=[
':' + compile_name,
],
deps=top_deps,
visibility = kwargs.get('visibility', [])
)
original_java_library(
name=compile_name,
deps=deps,
**kwargs
)