diff --git a/infer/lib/python/inferlib/analyze.py b/infer/lib/python/inferlib/analyze.py index ea72bd5f3..909ff079c 100644 --- a/infer/lib/python/inferlib/analyze.py +++ b/infer/lib/python/inferlib/analyze.py @@ -68,6 +68,9 @@ base_group.add_argument('-ic', '--changed-only', base_group.add_argument('-r', '--reactive', action='store_true', help='''Analyze in reactive propagation mode starting from changed files.''') +base_group.add_argument('-m', '--merge', action='store_true', + help='''merge the captured results directories specified + in the dependency file.''') base_group.add_argument('-c', '--continue', action='store_true', dest='continue_capture', help='''Continue the capture for the reactive @@ -320,6 +323,9 @@ class AnalyzerWrapper(object): if self.args.continue_capture: infer_options.append('-continue') + if self.args.merge: + infer_options.append('-merge') + if self.args.specs_dirs: infer_options += self.args.specs_dirs diff --git a/infer/src/backend/inferanalyze.ml b/infer/src/backend/inferanalyze.ml index 59b980c0d..4862ddb76 100644 --- a/infer/src/backend/inferanalyze.ml +++ b/infer/src/backend/inferanalyze.ml @@ -164,7 +164,7 @@ let arg_desc = None, " activate the eradicate checker for java annotations" ; - "-merge_captured", + "-merge", Arg.Unit MergeCapture.merge_captured_targets, None, "merge the captured results directories specified in the dependency file" diff --git a/infer/src/backend/mergeCapture.ml b/infer/src/backend/mergeCapture.ml index 858237574..909520c89 100644 --- a/infer/src/backend/mergeCapture.ml +++ b/infer/src/backend/mergeCapture.ml @@ -14,9 +14,9 @@ module F = Format (** Flag to control whether the timestamp of symbolic links is used to determine whether a captured directory needs to be merged. *) -let check_timestamp_of_symlinks = false +let check_timestamp_of_symlinks = true -let buck_out = ref (Filename.concat (Sys.getcwd ()) "buck-out") +let buck_out () = Filename.concat (Filename.dirname !Config.results_dir) "buck-out" let infer_deps () = Filename.concat !Config.results_dir "infer-deps.txt" @@ -80,7 +80,7 @@ let should_link ~target ~target_results_dir ~stats infer_out_src infer_out_dst = if debug >= 2 then L.stderr "file:%s time_orig:%f time_link:%f@." file time_orig time_link; - time_link >= time_orig in + time_link > time_orig in let symlinks_up_to_date captured_file = if Sys.is_directory captured_file then let contents = Array.to_list (Sys.readdir captured_file) in @@ -130,7 +130,7 @@ let process_merge_file deps_file = let process_line line = match Str.split_delim (Str.regexp (Str.quote "\t")) line with | target :: _ :: target_results_dir :: _ -> - let infer_out_src = Filename.concat (Filename.dirname !buck_out) target_results_dir in + let infer_out_src = Filename.concat (Filename.dirname (buck_out ())) target_results_dir in if should_link ~target ~target_results_dir ~stats infer_out_src infer_out_dst then slink ~stats infer_out_src infer_out_dst | _ -> @@ -144,5 +144,4 @@ let process_merge_file deps_file = let merge_captured_targets () = - process_merge_file (infer_deps ()); - exit 0 + process_merge_file (infer_deps ())