[infer][java] call inferlib programmatically instead of calling inferJ from the command line

Summary:
@public
This should simplify the process of passing around command line arguments

Test Plan: Infer CI. No functional change intended
master
jrm 10 years ago
parent d2e2bbf6a5
commit 843e600bb1

@ -16,7 +16,7 @@ current_directory = os.getcwd()
parser.add_argument('-version', action='store_true')
parser.add_argument('-cp', '-classpath', type=str, dest='classpath')
parser.add_argument('-bootclasspath', type=str)
parser.add_argument('-d', dest='classes_out')
parser.add_argument('-d', dest='classes_out', default=current_directory)
class CompilerCall:

@ -3,7 +3,8 @@ import subprocess
import traceback
import util
import utils # this is module located in ../utils.py
import inferlib
MODULE_NAME = __name__
MODULE_DESCRIPTION = '''Run analysis of code built with a command like:
javac <options> <source files>
@ -22,23 +23,11 @@ create_argparser = util.base_argparser(MODULE_DESCRIPTION, MODULE_NAME)
class JavacCapture:
def __init__(self, args, cmd):
self.args = args
self.cmd = cmd
self.analysis = inferlib.Infer(args, cmd[1:])
def capture(self):
# run inferJ only in capture mode
# pass all the frontend args (if any)
capture_cmd = [utils.get_cmd_in_bin_dir('inferJ')]
capture_cmd += ['--out', self.args.infer_out]
capture_cmd += ['--analyzer', self.args.analyzer]
if self.args.no_filtering:
capture_cmd.append('--no-filtering')
if self.args.debug:
capture_cmd.append('-g')
capture_cmd += self.cmd
try:
subprocess.check_call(capture_cmd)
self.analysis.start()
return os.EX_OK
except subprocess.CalledProcessError as exc:
if self.args.debug:

Loading…
Cancel
Save