diff --git a/infer/src/integration/Buck.ml b/infer/src/integration/Buck.ml index 87b58a352..7d6c929ff 100644 --- a/infer/src/integration/Buck.ml +++ b/infer/src/integration/Buck.ml @@ -127,3 +127,12 @@ let store_targets_in_file buck_targets = L.(debug Capture Quiet) "Buck targets options stored in file '%s'@\n" file ; Printf.sprintf "@%s" file + +let filter_compatible subcommand args = + match subcommand with + | `Targets -> + let blacklist = "--keep-going" in + List.filter args ~f:(fun arg -> not (String.equal blacklist arg)) + | _ -> + args + diff --git a/infer/src/integration/Buck.mli b/infer/src/integration/Buck.mli index c0f1f2031..98b31aeb4 100644 --- a/infer/src/integration/Buck.mli +++ b/infer/src/integration/Buck.mli @@ -33,3 +33,6 @@ val inline_argument_files : string list -> string list val store_targets_in_file : string list -> string (** Given a list of buck targets, stores them in a file and returns the file name *) + +val filter_compatible : [> `Targets] -> string list -> string list +(** keep only the options compatible with the given Buck subcommand *) diff --git a/infer/src/integration/CaptureCompilationDatabase.ml b/infer/src/integration/CaptureCompilationDatabase.ml index c9e1fd50d..68b617f08 100644 --- a/infer/src/integration/CaptureCompilationDatabase.ml +++ b/infer/src/integration/CaptureCompilationDatabase.ml @@ -111,7 +111,8 @@ let get_compilation_database_files_buck ~prog ~args = (String.concat ~sep:" " build_args) ; Process.create_process_and_wait ~prog ~args:build_args ; let buck_targets_shell = - List.append [prog; "targets"; "--show-output"; targets_in_file] no_targets_no_build + Buck.filter_compatible `Targets no_targets_no_build + |> List.append [prog; "targets"; "--show-output"; targets_in_file] |> Utils.shell_escape_command in let output, exit_or_signal =