[infer][java] Export the Infer command as environment variables

Reviewed By: sblackshear, jvillard

Differential Revision: D3971633

fbshipit-source-id: e0c9dcb
master
Jeremy Dubreil 8 years ago committed by Facebook Github Bot
parent 3449cbd555
commit db112c9ce1

@ -81,7 +81,7 @@ def prepare_build(args):
temp_files = [infer_cache_dir]
try:
infer = [utils.get_cmd_in_bin_dir('infer')] + infer_options
infer_command = [utils.get_cmd_in_bin_dir('infer')] + infer_options
except subprocess.CalledProcessError as e:
logging.error('Could not find infer')
raise e
@ -90,6 +90,9 @@ def prepare_build(args):
logging.info('Setup Infer analysis mode for Buck: export INFER_ANALYSIS=1')
os.environ['INFER_ANALYSIS'] = '1'
# Export the Infer command as environment variables
os.environ['INFER_JAVA_BUCK_OPTIONS'] = json.dumps(infer_command)
# Create a script to be called by buck
infer_script = None
with tempfile.NamedTemporaryFile(delete=False,
@ -98,7 +101,7 @@ def prepare_build(args):
dir='.') as infer_script:
logging.info('Creating %s' % infer_script.name)
infer_script.file.write(
utils.encode(INFER_SCRIPT.format(sys.executable, infer)))
utils.encode(INFER_SCRIPT.format(sys.executable, infer_command)))
st = os.stat(infer_script.name)
os.chmod(infer_script.name, st.st_mode | stat.S_IEXEC)

Loading…
Cancel
Save