You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.1 KiB
47 lines
1.1 KiB
v1_files = glob([ '**/*.java.v1'])
|
|
v2_files = glob(['**/*.java.v2'])
|
|
normal_files = glob(['**/*.java'])
|
|
sources = v1_files + v2_files + normal_files
|
|
|
|
java_library(
|
|
name = 'child_changed',
|
|
srcs = sources,
|
|
deps = [],
|
|
visibility = [
|
|
'PUBLIC'
|
|
]
|
|
)
|
|
|
|
def copy_files_strip_suffix_cmd(sfx, files):
|
|
return ' && '.join([' '.join(['cp', f, f.replace(sfx, '')]) for f in files])
|
|
|
|
out = 'out'
|
|
clean_cmd = ' '.join(['rm', '-rf', out])
|
|
stripped_suffix_files = map(lambda f: f.replace('.v1', ''), v1_files)
|
|
to_compile = ' '.join(normal_files + stripped_suffix_files)
|
|
infer_cmd = ' '.join([
|
|
'infer',
|
|
'-i',
|
|
'--absolute-paths',
|
|
'-o', out,
|
|
'-a', 'infer',
|
|
'--',
|
|
'javac',
|
|
to_compile
|
|
])
|
|
v1_copy_cmd = copy_files_strip_suffix_cmd('.v1', v1_files)
|
|
v2_copy_cmd = copy_files_strip_suffix_cmd('.v2', v2_files)
|
|
stats_copy_cmd = ' '.join(['cp', out + '/stats.json', '$OUT'])
|
|
command = ' && '.join([clean_cmd, v1_copy_cmd, infer_cmd, v2_copy_cmd, infer_cmd, stats_copy_cmd])
|
|
|
|
genrule(
|
|
name = 'analyze',
|
|
srcs = sources,
|
|
out = 'stats.json',
|
|
cmd = command,
|
|
deps = [':child_changed'],
|
|
visibility = [
|
|
'PUBLIC',
|
|
]
|
|
)
|