Fail if incremental analysis is set without changed files

Summary:
It doesn't make sense to use incremental analysis without specifying changed files. This is a possible source of future bugs.

This commit causes infer to die if incremental analysis is used without changed files.

 ---

Previously:

I think this code is currently a bit brittle because the CI shadow builds sometimes use `--incremental-analysis` because they are called with the same command as the diff analysis.

I am worried that in the future the shadow builds could be broken by this, although everything looks like it works right now. This diff would prevent breaking smoke builds in future because the shadow builds don't set changed-files (afaik).

However, possibly this is not the right place to fix the problem. It might be better to change the CI, I'm not sure.

Reviewed By: mityal

Differential Revision: D16829192

fbshipit-source-id: 5ee1ce9d0
master
Phoebe Nichols 5 years ago committed by Facebook Github Bot
parent 7efc9285cb
commit e45526ea02

@ -172,7 +172,11 @@ let main ~changed_files =
Summary.OnDisk.reset_all ~filter:(Lazy.force Filtering.procedures_filter) () ;
L.progress "Done@." )
else if Config.incremental_analysis then
Option.iter ~f:invalidate_changed_procedures changed_files
match changed_files with
| Some cf ->
invalidate_changed_procedures cf
| None ->
L.die InternalError "Incremental analysis enabled without specifying changed files"
else DB.Results_dir.clean_specs_dir () ;
let source_files = get_source_files_to_analyze ~changed_files in
(* empty all caches to minimize the process heap to have less work to do when forking *)

Loading…
Cancel
Save