Fix the option -a compile

Summary: public
The option `-a compile` was previously doing the same thing as `-a capture`. This option is very useful to debug the integration with the build systems.

Reviewed By: jvillard

Differential Revision: D2554816

fb-gh-sync-id: 95f32c2
master
jrm 9 years ago committed by facebook-github-bot-7
parent 52f983253a
commit dc470816d1

@ -471,13 +471,6 @@ class Infer:
def compile(self): def compile(self):
return self.javac.run() return self.javac.run()
def capture(self):
javac_status = self.compile()
if javac_status == os.EX_OK:
return self.run_infer_frontend()
else:
return javac_status
def analyze(self): def analyze(self):
logging.info('Starting analysis') logging.info('Starting analysis')
infer_analyze = [ infer_analyze = [
@ -699,22 +692,27 @@ class Infer:
return self.javac.run() return self.javac.run()
else: else:
start_time = time.time() start_time = time.time()
if self.capture() == os.EX_OK:
self.timing['capture'] = utils.elapsed_time(start_time) self.compile()
self.analyze_and_report() if self.args.analyzer == COMPILE:
self.close() return os.EX_OK
elapsed = utils.elapsed_time(start_time)
self.timing['total'] = elapsed self.run_infer_frontend()
self.save_stats() self.timing['capture'] = utils.elapsed_time(start_time)
if self.args.analyzer == CAPTURE:
if not self.args.analyzer in [COMPILE, CAPTURE]: return os.EX_OK
procs_total = self.stats['int']['procedures']
files_total = self.stats['int']['files'] self.analyze_and_report()
procs_str = utils.get_plural('procedure', procs_total) self.close()
files_str = utils.get_plural('file', files_total) self.timing['total'] = utils.elapsed_time(start_time)
print('\nAnalyzed %s in %s' % (procs_str, files_str)) self.save_stats()
return self.stats
else: procs_total = self.stats['int']['procedures']
return dict({}) files_total = self.stats['int']['files']
procs_str = utils.get_plural('procedure', procs_total)
files_str = utils.get_plural('file', files_total)
print('\nAnalyzed %s in %s' % (procs_str, files_str))
return self.stats
# vim: set sw=4 ts=4 et: # vim: set sw=4 ts=4 et:

@ -37,7 +37,7 @@ def run_commands(cmds):
if len(cmds) == 0: if len(cmds) == 0:
return os.EX_NOINPUT return os.EX_NOINPUT
for cmd in cmds: for cmd in cmds:
if not cmd.start(): if cmd.start() != os.EX_OK:
return os.EX_SOFTWARE return os.EX_SOFTWARE
return os.EX_OK return os.EX_OK

Loading…
Cancel
Save