sources = glob(['**/*.java']) dependencies = [ '//infer/annotations:annotations', '//infer/lib/java/android:android', '//dependencies/java/jsr-305:jsr-305', '//dependencies/java/jsr-330:jsr-330', '//dependencies/java/android/support/v4:android-support-v4', '//dependencies/java/butterknife:butterknife', ] java_library( name = 'eradicate', srcs = sources, deps = dependencies, visibility = [ 'PUBLIC' ] ) out = 'out' clean_cmd = ' '.join(['rm', '-rf', out]) classpath = ':'.join([('$(classpath ' + path + ')') for path in dependencies]) env_cmd = ' '.join(['export', 'ERADICATE_RETURN_OVER_ANNOTATED=1']) infer_cmd = ' '.join([ 'infer', '--no-progress-bar', '--absolute-paths', '-o', out, '-a', 'eradicate', '--', 'javac', '-cp', classpath, '$SRCS', ]) copy_cmd = ' '.join(['cp', out + '/report.csv', '$OUT']) command = ' && '.join([clean_cmd, env_cmd, infer_cmd, copy_cmd]) genrule( name = 'analyze', srcs = sources, out = 'report.csv', cmd = command, deps = dependencies + [':eradicate'], visibility = [ 'PUBLIC', ] )