[infer][java] avoid converting javac command lines from bash to python as some buck options are incorectly parsed otherwise

Summary:
Buck is creating javac compilation commands with arguments of the form:

  -Opt={"list": ["pif", "paf", "pouf"]}

While converting command lines from bash to python, these option gets split into

  ['-Opt={"list":', '["pif",', '"paf",', '"pouf"]}']

instead of:

  ['-Opt={"list": ["pif", "paf", "pouf"]}']

which create the compilation to fail when running Infer even though the original files are compiling correctly.
master
Jeremy Dubreil 9 years ago
parent 7002d0d24c
commit 743c73012d

@ -45,8 +45,12 @@ INFER_REPORT = os.path.join(utils.BUCK_INFER_OUT, utils.CSV_REPORT_FILENAME)
INFER_STATS = os.path.join(utils.BUCK_INFER_OUT, utils.STATS_FILENAME) INFER_STATS = os.path.join(utils.BUCK_INFER_OUT, utils.STATS_FILENAME)
INFER_SCRIPT = """\ INFER_SCRIPT = """\
#!/bin/sh #!/usr/bin/env {0}
{0} {1} -- javac $@ import subprocess
import sys
cmd = ['{0}'] + {1} + ['--', 'javac'] + sys.argv[1:]
subprocess.check_call(cmd)
""" """
LOCAL_CONFIG = """\ LOCAL_CONFIG = """\
@ -82,8 +86,7 @@ def prepare_build(args):
temp_files = [infer_cache_dir] temp_files = [infer_cache_dir]
try: try:
infer = utils.get_cmd_in_bin_dir('infer') + ' ' +\ infer = [utils.get_cmd_in_bin_dir('infer')] + infer_options
' '.join(infer_options)
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
logging.error('Could not find infer') logging.error('Could not find infer')
raise e raise e
@ -100,7 +103,7 @@ def prepare_build(args):
infer_script = None infer_script = None
with tempfile.NamedTemporaryFile(delete=False, with tempfile.NamedTemporaryFile(delete=False,
prefix='infer_', prefix='infer_',
suffix='.sh', suffix='.py',
dir='.') as infer_script: dir='.') as infer_script:
logging.info('Creating %s' % infer_script.name) logging.info('Creating %s' % infer_script.name)
infer_script.file.write( infer_script.file.write(

Loading…
Cancel
Save