|
|
@ -3,7 +3,8 @@ import subprocess
|
|
|
|
import traceback
|
|
|
|
import traceback
|
|
|
|
import util
|
|
|
|
import util
|
|
|
|
|
|
|
|
|
|
|
|
import utils # this is module located in ../utils.py
|
|
|
|
import inferlib
|
|
|
|
|
|
|
|
|
|
|
|
MODULE_NAME = __name__
|
|
|
|
MODULE_NAME = __name__
|
|
|
|
MODULE_DESCRIPTION = '''Run analysis of code built with a command like:
|
|
|
|
MODULE_DESCRIPTION = '''Run analysis of code built with a command like:
|
|
|
|
javac <options> <source files>
|
|
|
|
javac <options> <source files>
|
|
|
@ -22,23 +23,11 @@ create_argparser = util.base_argparser(MODULE_DESCRIPTION, MODULE_NAME)
|
|
|
|
|
|
|
|
|
|
|
|
class JavacCapture:
|
|
|
|
class JavacCapture:
|
|
|
|
def __init__(self, args, cmd):
|
|
|
|
def __init__(self, args, cmd):
|
|
|
|
self.args = args
|
|
|
|
self.analysis = inferlib.Infer(args, cmd[1:])
|
|
|
|
self.cmd = cmd
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def capture(self):
|
|
|
|
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:
|
|
|
|
try:
|
|
|
|
subprocess.check_call(capture_cmd)
|
|
|
|
self.analysis.start()
|
|
|
|
return os.EX_OK
|
|
|
|
return os.EX_OK
|
|
|
|
except subprocess.CalledProcessError as exc:
|
|
|
|
except subprocess.CalledProcessError as exc:
|
|
|
|
if self.args.debug:
|
|
|
|
if self.args.debug:
|
|
|
|