diff --git a/infer/man/man1/infer-capture.txt b/infer/man/man1/infer-capture.txt index 887c27dbd..c15354c47 100644 --- a/infer/man/man1/infer-capture.txt +++ b/infer/man/man1/infer-capture.txt @@ -109,6 +109,10 @@ BUCK COMPILATION DATABASE OPTIONS --buck-compilation-database-depth int Depth of dependencies used by the --buck-compilation-database deps option. By default, all recursive dependencies are captured. + + --buck-targets-blacklist +regex + Skip capture of buck targets matched by the specified regular + expression. BUCK FLAVORS OPTIONS --append-buck-flavors +string Additional Buck flavors to append to targets discovered by the diff --git a/infer/man/man1/infer-full.txt b/infer/man/man1/infer-full.txt index 43b24784b..d558594cf 100644 --- a/infer/man/man1/infer-full.txt +++ b/infer/man/man1/infer-full.txt @@ -116,6 +116,10 @@ OPTIONS --buck-out dir Specify the root directory of buck-out See also infer-capture(1). + --buck-targets-blacklist +regex + Skip capture of buck targets matched by the specified regular + expression. See also infer-capture(1) and infer-run(1). + --bufferoverrun Activates: the buffer overrun analysis (Conversely: --no-bufferoverrun) See also infer-analyze(1). @@ -976,6 +980,9 @@ INTERNAL OPTIONS --buck-out-reset Cancel the effect of --buck-out. + --buck-targets-blacklist-reset + Set --buck-targets-blacklist to the empty list. + --no-capture Deactivates: capture and translate source files into infer's intermediate language for analysis (Conversely: --capture) diff --git a/infer/man/man1/infer-run.txt b/infer/man/man1/infer-run.txt index f698386f8..4edab6a8d 100644 --- a/infer/man/man1/infer-run.txt +++ b/infer/man/man1/infer-run.txt @@ -158,6 +158,10 @@ OPTIONS -- Stop argument processing, use remaining arguments as a build command +BUCK COMPILATION DATABASE OPTIONS + --buck-targets-blacklist +regex + Skip capture of buck targets matched by the specified regular + expression. BUCK FLAVORS OPTIONS --buck-blacklist +regex Skip capture of files matched by the specified regular expression diff --git a/infer/man/man1/infer.txt b/infer/man/man1/infer.txt index 811dc89af..8907645d1 100644 --- a/infer/man/man1/infer.txt +++ b/infer/man/man1/infer.txt @@ -116,6 +116,10 @@ OPTIONS --buck-out dir Specify the root directory of buck-out See also infer-capture(1). + --buck-targets-blacklist +regex + Skip capture of buck targets matched by the specified regular + expression. See also infer-capture(1) and infer-run(1). + --bufferoverrun Activates: the buffer overrun analysis (Conversely: --no-bufferoverrun) See also infer-analyze(1). diff --git a/infer/src/base/Config.ml b/infer/src/base/Config.ml index e1f40d486..9a55ff4f6 100644 --- a/infer/src/base/Config.ml +++ b/infer/src/base/Config.ml @@ -828,6 +828,13 @@ and buck_out = ~meta:"dir" "Specify the root directory of buck-out" +and buck_targets_blacklist = + CLOpt.mk_string_list ~long:"buck-targets-blacklist" + ~in_help: + InferCommand.[(Run, manual_buck_compilation_db); (Capture, manual_buck_compilation_db)] + ~meta:"regex" "Skip capture of buck targets matched by the specified regular expression." + + and capture = CLOpt.mk_bool ~long:"capture" ~default:true "capture and translate source files into infer's intermediate language for analysis" @@ -2548,6 +2555,8 @@ and buck_compilation_database = and buck_out = !buck_out +and buck_targets_blacklist = !buck_targets_blacklist + and bufferoverrun = !bufferoverrun and capture = diff --git a/infer/src/base/Config.mli b/infer/src/base/Config.mli index 137ff7046..d042dc522 100644 --- a/infer/src/base/Config.mli +++ b/infer/src/base/Config.mli @@ -253,6 +253,8 @@ val buck_compilation_database : compilation_database_dependencies option val buck_out : string option +val buck_targets_blacklist : string list + val bufferoverrun : bool val capture : bool diff --git a/infer/src/integration/Buck.ml b/infer/src/integration/Buck.ml index 6af820b90..7d4fd03d7 100644 --- a/infer/src/integration/Buck.ml +++ b/infer/src/integration/Buck.ml @@ -214,6 +214,12 @@ type flavored_arguments = {command: string; rev_not_targets: string list; target let add_flavors_to_buck_arguments ~filter_kind ~dep_depth ~extra_flavors original_buck_args = let expanded_buck_args = inline_argument_files original_buck_args in let command, args = split_buck_command expanded_buck_args in + let buck_targets_blacklist_regexp = + if List.is_empty Config.buck_targets_blacklist then None + else + Some + (Str.regexp ("\\(" ^ String.concat ~sep:"\\)\\|\\(" Config.buck_targets_blacklist ^ "\\)")) + in let rec parse_cmd_args parsed_args = function | [] -> parsed_args @@ -247,6 +253,11 @@ let add_flavors_to_buck_arguments ~filter_kind ~dep_depth ~extra_flavors origina pattern_targets |> List.rev_append alias_targets |> List.rev_append normal_targets |> resolve_pattern_targets ~filter_kind ~dep_depth in + let targets = + Option.value_map ~default:targets + ~f:(fun re -> List.filter ~f:(fun tgt -> not (Str.string_match re tgt 0)) targets) + buck_targets_blacklist_regexp + in match targets with | [] -> L.(die UserError)