|
|
@ -64,28 +64,31 @@ let run_compilation_database compilation_database should_capture_file =
|
|
|
|
Process.run_jobs_in_parallel ~fail_on_failed_job jobs_stack
|
|
|
|
Process.run_jobs_in_parallel ~fail_on_failed_job jobs_stack
|
|
|
|
(run_compilation_file compilation_database) job_to_string
|
|
|
|
(run_compilation_file compilation_database) job_to_string
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let buck_targets_in_file buck_targets =
|
|
|
|
|
|
|
|
let file = Filename.temp_file "buck_targets_" ".txt" in
|
|
|
|
|
|
|
|
let write_args outc = Out_channel.output_string outc (String.concat ~sep:"\n" buck_targets) in
|
|
|
|
|
|
|
|
Utils.with_file_out file ~f:write_args |> ignore ;
|
|
|
|
|
|
|
|
L.(debug Capture Quiet) "Buck targets options stored in file %s@\n" file ;
|
|
|
|
|
|
|
|
Printf.sprintf "@%s" file
|
|
|
|
|
|
|
|
|
|
|
|
(** Computes the compilation database files. *)
|
|
|
|
(** Computes the compilation database files. *)
|
|
|
|
let get_compilation_database_files_buck ~prog ~args =
|
|
|
|
let get_compilation_database_files_buck ~prog ~args =
|
|
|
|
let args =
|
|
|
|
let targets, no_targets = List.partition_tf ~f:Buck.is_target_string args in
|
|
|
|
|
|
|
|
let targets =
|
|
|
|
match Config.buck_compilation_database with
|
|
|
|
match Config.buck_compilation_database with
|
|
|
|
| Some `Deps
|
|
|
|
| Some `Deps
|
|
|
|
-> let targets, no_targets = Buck.get_dependency_targets args in
|
|
|
|
-> Buck.get_dependency_targets_and_add_flavors targets
|
|
|
|
no_targets @ targets
|
|
|
|
|
|
|
|
| _
|
|
|
|
| _
|
|
|
|
-> args
|
|
|
|
-> Buck.add_flavors_to_buck_command targets
|
|
|
|
in
|
|
|
|
in
|
|
|
|
match Buck.add_flavors_to_buck_command args with
|
|
|
|
match no_targets with
|
|
|
|
| build :: args_with_flavor
|
|
|
|
| "build" :: _
|
|
|
|
-> (
|
|
|
|
-> (
|
|
|
|
let build_args = build :: "--config" :: "*//cxx.pch_enabled=false" :: args_with_flavor in
|
|
|
|
let targets_in_file = buck_targets_in_file targets in
|
|
|
|
|
|
|
|
let build_args = no_targets @ ["--config"; "*//cxx.pch_enabled=false"; targets_in_file] in
|
|
|
|
Process.create_process_and_wait ~prog ~args:build_args ;
|
|
|
|
Process.create_process_and_wait ~prog ~args:build_args ;
|
|
|
|
(* The option --keep-going is not accepted in the command buck targets *)
|
|
|
|
|
|
|
|
let args_with_flavor_no_keep_going =
|
|
|
|
|
|
|
|
List.filter ~f:(fun s -> not (String.equal s "--keep-going")) args_with_flavor
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
let buck_targets_shell =
|
|
|
|
let buck_targets_shell =
|
|
|
|
prog :: "targets" :: "--show-output" :: args_with_flavor_no_keep_going
|
|
|
|
[prog; "targets"; "--show-output"; targets_in_file] |> Utils.shell_escape_command
|
|
|
|
|> Utils.shell_escape_command
|
|
|
|
|
|
|
|
in
|
|
|
|
in
|
|
|
|
let output, exit_or_signal =
|
|
|
|
let output, exit_or_signal =
|
|
|
|
Utils.with_process_in buck_targets_shell In_channel.input_lines
|
|
|
|
Utils.with_process_in buck_targets_shell In_channel.input_lines
|
|
|
|