diff --git a/infer/lib/python/inferlib/bucklib.py b/infer/lib/python/inferlib/bucklib.py index 82d2761ea..4a264c565 100644 --- a/infer/lib/python/inferlib/bucklib.py +++ b/infer/lib/python/inferlib/bucklib.py @@ -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)