|
|
|
sources = glob(['**/*.java'])
|
|
|
|
|
|
|
|
dependencies = [
|
|
|
|
'//dependencies/java/android/support/v4:android-support-v4',
|
|
|
|
'//infer/annotations:annotations',
|
|
|
|
'//infer/lib/java/android:android',
|
|
|
|
]
|
|
|
|
|
|
|
|
java_library(
|
|
|
|
name = 'checkers',
|
|
|
|
srcs = sources,
|
|
|
|
deps = dependencies,
|
|
|
|
visibility = [
|
|
|
|
'PUBLIC'
|
|
|
|
]
|
|
|
|
)
|
|
|
|
|
|
|
|
out = 'out'
|
|
|
|
inferconfig_file = '$(location //infer/tests/codetoanalyze/java:inferconfig)'
|
|
|
|
copy_inferconfig = ' '.join(['cp', inferconfig_file, '$SRCDIR'])
|
|
|
|
clean_cmd = ' '.join(['rm', '-rf', out])
|
|
|
|
classpath = ':'.join([('$(classpath ' + path + ')') for path in dependencies])
|
|
|
|
infer_cmd = ' '.join([
|
|
|
|
'infer',
|
|
|
|
'--no-progress-bar',
|
|
|
|
'--absolute-paths',
|
|
|
|
'-o', out,
|
|
|
|
'-a', 'checkers',
|
|
|
|
'--',
|
|
|
|
'javac',
|
|
|
|
'-cp', classpath,
|
|
|
|
'$SRCS',
|
|
|
|
])
|
|
|
|
copy_cmd = ' '.join(['cp', out + '/report.csv', '$OUT'])
|
|
|
|
command = ' && '.join([clean_cmd, copy_inferconfig, infer_cmd, copy_cmd])
|
|
|
|
|
|
|
|
genrule(
|
|
|
|
name = 'analyze',
|
|
|
|
srcs = sources,
|
|
|
|
out = 'report.csv',
|
|
|
|
cmd = command,
|
|
|
|
deps = dependencies + [':checkers'],
|
|
|
|
visibility = [
|
|
|
|
'PUBLIC',
|
|
|
|
]
|
|
|
|
)
|