Revive support for --no-cache when analyzing Buck-based projects

Summary:
public
I previously forgot to keep this feature when deleting BuckAnalyze.

Reviewed By: sblackshear

Differential Revision: D2850869

fb-gh-sync-id: d23f1ca
master
jrm 9 years ago committed by facebook-github-bot-7
parent d1cf7b7177
commit ec2a1e2130

@ -453,12 +453,15 @@ class Wrapper:
def __init__(self, infer_args, buck_cmd): def __init__(self, infer_args, buck_cmd):
self.timer = utils.Timer(logging.info) self.timer = utils.Timer(logging.info)
self.infer_args = infer_args self.infer_args = infer_args
self.buck_args = parse_buck_command(buck_cmd) buck_args = parse_buck_command(buck_cmd)
self.timer.start('Computing library targets') self.timer.start('Computing library targets')
self.targets = get_normalized_targets( buck_cmd_without_targets = [p for p in buck_cmd
self.buck_args.targets, if p not in buck_args.targets]
self.normalized_targets = get_normalized_targets(
buck_args.targets,
self.infer_args.verbose) self.infer_args.verbose)
self.timer.stop('%d targets computed', len(self.targets)) self.buck_cmd = buck_cmd_without_targets + self.normalized_targets
self.timer.stop('%d targets computed', len(self.normalized_targets))
def run(self): def run(self):
temp_files = [] temp_files = []
@ -474,18 +477,14 @@ class Wrapper:
temp_files += temp_files2 temp_files += temp_files2
self.timer.stop('Build prepared') self.timer.stop('Build prepared')
if len(self.targets) == 0: if len(self.normalized_targets) == 0:
logging.info('Nothing to analyze') logging.info('Nothing to analyze')
else: else:
self.timer.start('Running buck...') self.timer.start('Running buck...')
buck_cmd = ['buck', 'build'] javac_config = ['--config', 'tools.javac=' + infer_script]
if self.buck_args.verbose is not None: buck_cmd = self.buck_cmd + javac_config
buck_cmd += ['--verbose', str(self.buck_args.verbose)]
buck_cmd += ['--config', 'tools.javac=' + infer_script]
buck_cmd += self.targets
subprocess.check_call(buck_cmd) subprocess.check_call(buck_cmd)
self.timer.stop('Buck finished') self.timer.stop('Buck finished')
self.timer.start('Collecting results...') self.timer.start('Collecting results...')
collect_results(self.infer_args, start_time) collect_results(self.infer_args, start_time)
self.timer.stop('Done') self.timer.stop('Done')

Loading…
Cancel
Save