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.

53 lines
985 B

import os
original_java_library = java_library
def java_library(
name,
srcs=[],
**kwargs
):
original_java_library(
name=name,
srcs=srcs,
**kwargs
)
create_infer_genrule(name, srcs)
original_android_library = android_library
def android_library(
name,
srcs=[],
**kwargs
):
original_android_library(
name=name,
srcs=srcs,
**kwargs
)
create_infer_genrule(name, srcs)
def create_infer_genrule(
name,
srcs
):
genrule_name = name + '_infer'
genrule(
name = genrule_name,
srcs=srcs,
cmd = ' '.join([
os.getenv('INFER_BIN', 'infer'),
'--genrule-mode',
'--project-root', os.getenv('PROJECT_ROOT', os.environ['PWD']),
'--eradicate-only',
'--results-dir', '$OUT',
'--classpath', '$(classpath :{})'.format(name),
'--sourcepath', '$SRCDIR',
'--generated-classes', '$(location :{})'.format(name),
]),
out = 'infer_out',
)