From db112c9ce1c3ff2d9c8a013a6981b62f61055e5f Mon Sep 17 00:00:00 2001 From: Jeremy Dubreil Date: Thu, 6 Oct 2016 09:56:10 -0700 Subject: [PATCH] [infer][java] Export the Infer command as environment variables Reviewed By: sblackshear, jvillard Differential Revision: D3971633 fbshipit-source-id: e0c9dcb --- infer/lib/python/inferlib/bucklib.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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)