From 262bb4171d5bc4523828cc342c404892dc036707 Mon Sep 17 00:00:00 2001 From: Mehdi Bouaziz Date: Wed, 15 Nov 2017 10:10:48 -0800 Subject: [PATCH] [buck] Non compilation-database do not support _test targets Summary: When refactoring `Buck.ml` I took the list of accepted kinds that was used for compilation database. However `#infer-capture-all` flavor is not supported by `cxx_test` targets. Reviewed By: dulmarod Differential Revision: D6335543 fbshipit-source-id: db3a5f4 --- infer/src/integration/Buck.ml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/infer/src/integration/Buck.ml b/infer/src/integration/Buck.ml index 8064d9d63..58a672d6d 100644 --- a/infer/src/integration/Buck.ml +++ b/infer/src/integration/Buck.ml @@ -133,7 +133,10 @@ let parameters_with_argument = ["--build-report"; "--config"; "-j"; "--num-threads"; "--out"; "-v"; "--verbose"] -let accepted_buck_kinds_pattern = "(apple|cxx)_(binary|library|test)" +let get_accepted_buck_kinds_pattern () = + if Option.is_some Config.buck_compilation_database then "(apple|cxx)_(binary|library|test)" + else "(apple|cxx)_(binary|library)" + let max_command_line_length = 50 @@ -142,8 +145,8 @@ let die_if_empty f = function [] -> f L.(die UserError) | l -> l let resolve_pattern_targets ~filter_kind ~dep_depth targets = targets |> List.rev_map ~f:Query.target |> Query.set |> (match dep_depth with None -> Fn.id | Some depth -> Query.deps ?depth) - |> (if filter_kind then Query.kind ~pattern:accepted_buck_kinds_pattern else Fn.id) |> Query.exec - |> die_if_empty (fun die -> die "*** buck query returned no targets.") + |> (if filter_kind then Query.kind ~pattern:(get_accepted_buck_kinds_pattern ()) else Fn.id) + |> Query.exec |> die_if_empty (fun die -> die "*** buck query returned no targets.") let resolve_alias_targets aliases =