From e34e36983534da124bf6fd23e5018b3fc15d33c4 Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Mon, 21 Mar 2016 20:54:36 -0700 Subject: [PATCH] Complete command-line support for reactive mode with buck on iOS. Reviewed By: sblackshear Differential Revision: D3080674 fb-gh-sync-id: 226e740 shipit-source-id: 226e740 --- infer/lib/python/inferlib/analyze.py | 6 ++++++ infer/src/backend/inferanalyze.ml | 2 +- infer/src/backend/mergeCapture.ml | 11 +++++------ 3 files changed, 12 insertions(+), 7 deletions(-) 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 ())