Add --Xbuck-no-inline and --Xclang flags to enable jackalope/ios builds.

Reviewed By: jvillard

Differential Revision: D9296445

fbshipit-source-id: 196e527eb
master
Martin Trojer 6 years ago committed by Facebook Github Bot
parent 919d05b5ef
commit 451f8f1efa

@ -843,6 +843,13 @@ and buck_build_args =
"Pass values as command-line arguments to invocations of $(i,`buck build`)" "Pass values as command-line arguments to invocations of $(i,`buck build`)"
and buck_build_args_no_inline =
CLOpt.mk_string_list ~long:"Xbuck-no-inline"
~in_help:InferCommand.[(Capture, manual_buck_flavors)]
"Pass values as command-line arguments to invocations of $(i,`buck build`), don't inline any \
args starting with '@'"
and buck_compilation_database_depth = and buck_compilation_database_depth =
CLOpt.mk_int_opt ~long:"buck-compilation-database-depth" CLOpt.mk_int_opt ~long:"buck-compilation-database-depth"
~in_help:InferCommand.[(Capture, manual_buck_compilation_db)] ~in_help:InferCommand.[(Capture, manual_buck_compilation_db)]
@ -888,6 +895,12 @@ and clang_biniou_file =
~meta:"file" "Specify a file containing the AST of the program, in biniou format" ~meta:"file" "Specify a file containing the AST of the program, in biniou format"
and clang_extra_flags =
CLOpt.mk_string_list ~long:"Xclang"
~in_help:InferCommand.[(Capture, manual_clang)]
"Pass values as command-line arguments to invocations of clang"
and clang_compilation_dbs = ref [] and clang_compilation_dbs = ref []
and clang_frontend_action = and clang_frontend_action =
@ -2457,6 +2470,8 @@ and buck = !buck
and buck_build_args = !buck_build_args and buck_build_args = !buck_build_args
and buck_build_args_no_inline = !buck_build_args_no_inline
and buck_cache_mode = (!buck || !genrule_mode) && not !debug and buck_cache_mode = (!buck || !genrule_mode) && not !debug
and buck_compilation_database = and buck_compilation_database =
@ -2492,6 +2507,8 @@ and check_version = !check_version
and clang_biniou_file = !clang_biniou_file and clang_biniou_file = !clang_biniou_file
and clang_extra_flags = !clang_extra_flags
and clang_ignore_regex = !clang_ignore_regex and clang_ignore_regex = !clang_ignore_regex
and clang_include_to_override_regex = !clang_include_to_override_regex and clang_include_to_override_regex = !clang_include_to_override_regex

@ -246,6 +246,8 @@ val buck : bool
val buck_build_args : string list val buck_build_args : string list
val buck_build_args_no_inline : string list
val buck_cache_mode : bool val buck_cache_mode : bool
val buck_compilation_database : compilation_database_dependencies option val buck_compilation_database : compilation_database_dependencies option
@ -267,6 +269,8 @@ val check_version : string option
val clang_biniou_file : string option val clang_biniou_file : string option
val clang_extra_flags : string list
val clang_frontend_action_string : string val clang_frontend_action_string : string
val clang_ignore_regex : string option val clang_ignore_regex : string option

@ -190,6 +190,7 @@ let mk ~is_driver quoting_style ~prog ~args =
let sanitized_args = let sanitized_args =
filter_and_replace_unsupported_args ~blacklisted_flags:clang_blacklisted_flags filter_and_replace_unsupported_args ~blacklisted_flags:clang_blacklisted_flags
~blacklisted_flags_with_arg args ~blacklisted_flags_with_arg args
@ List.rev Config.clang_extra_flags
in in
{exec= prog; orig_argv= sanitized_args; argv= sanitized_args; quoting_style; is_driver} {exec= prog; orig_argv= sanitized_args; argv= sanitized_args; quoting_style; is_driver}

@ -117,7 +117,7 @@ module Query = struct
let exec expr = let exec expr =
let query = F.asprintf "%a" pp expr in let query = F.asprintf "%a" pp expr in
let cmd = ["buck"; "query"; query] in let cmd = ["buck"; "query"] @ List.rev_append Config.buck_build_args_no_inline [query] in
let tmp_prefix = "buck_query_" in let tmp_prefix = "buck_query_" in
let debug = L.(debug Capture Medium) in let debug = L.(debug Capture Medium) in
Utils.with_process_lines ~debug ~cmd ~tmp_prefix ~f:Fn.id Utils.with_process_lines ~debug ~cmd ~tmp_prefix ~f:Fn.id

@ -21,7 +21,7 @@ let create_cmd (source_file, (compilation_data: CompilationDatabase.compilation_
( source_file ( source_file
, { CompilationDatabase.directory= compilation_data.directory , { CompilationDatabase.directory= compilation_data.directory
; executable= swap_executable compilation_data.executable ; executable= swap_executable compilation_data.executable
; escaped_arguments= ["@" ^ arg_file; "-fsyntax-only"] } ) ; escaped_arguments= ["@" ^ arg_file; "-fsyntax-only"] @ List.rev Config.clang_extra_flags } )
let invoke_cmd (source_file, (cmd: CompilationDatabase.compilation_data)) = let invoke_cmd (source_file, (cmd: CompilationDatabase.compilation_data)) =
@ -74,9 +74,8 @@ let get_compilation_database_files_buck ~prog ~args =
| {command= "build" as command; rev_not_targets; targets} -> | {command= "build" as command; rev_not_targets; targets} ->
let targets_args = Buck.store_args_in_file targets in let targets_args = Buck.store_args_in_file targets in
let build_args = let build_args =
command command :: List.rev_append rev_not_targets (List.rev Config.buck_build_args_no_inline)
:: List.rev_append rev_not_targets @ "--config" :: "*//cxx.pch_enabled=false" :: targets_args
("--config" :: "*//cxx.pch_enabled=false" :: targets_args)
in in
Logging.(debug Linters Quiet) Logging.(debug Linters Quiet)
"Processed buck command is: 'buck %a'@\n" (Pp.seq F.pp_print_string) build_args ; "Processed buck command is: 'buck %a'@\n" (Pp.seq F.pp_print_string) build_args ;
@ -86,7 +85,8 @@ let get_compilation_database_files_buck ~prog ~args =
:: "targets" :: "targets"
:: List.rev_append :: List.rev_append
(Buck.filter_compatible `Targets rev_not_targets) (Buck.filter_compatible `Targets rev_not_targets)
("--show-output" :: targets_args) (List.rev Config.buck_build_args_no_inline)
@ "--show-output" :: targets_args
in in
let on_target_lines = function let on_target_lines = function
| [] -> | [] ->

@ -29,17 +29,24 @@ type mode =
let equal_mode = [%compare.equal : mode] let equal_mode = [%compare.equal : mode]
let pp_mode fmt mode = let pp_mode fmt = function
match mode with | Analyze ->
| Analyze F.fprintf fmt "Analyze driver mode"
| BuckGenrule _ | BuckGenrule prog ->
| BuckCompilationDB _ F.fprintf fmt "BuckGenRule driver mode:@\nprog = '%s'" prog
| ClangCompilationDB _ | BuckCompilationDB (prog, args) ->
| Python _ F.fprintf fmt "BuckCompilationDB driver mode:@\nprog = '%s'@\nargs = %a" prog Pp.cli_args
| PythonCapture (_, _) args
| XcodeXcpretty _ -> | ClangCompilationDB _ ->
(* these are pretty boring, do not log anything *) F.fprintf fmt "ClangCompilationDB driver mode"
() | Python args ->
F.fprintf fmt "Python driver mode:@\nargs = %a" Pp.cli_args args
| PythonCapture (bs, args) ->
F.fprintf fmt "PythonCapture driver mode:@\nbuild system = '%s'@\nargs = %a"
(Config.string_of_build_system bs)
Pp.cli_args args
| XcodeXcpretty (prog, args) ->
F.fprintf fmt "XcodeXcpretty driver mode:@\nprog = '%s'@\nargs = %a" prog Pp.cli_args args
| Javac (_, prog, args) -> | Javac (_, prog, args) ->
F.fprintf fmt "Javac driver mode:@\nprog = '%s'@\nargs = %a" prog Pp.cli_args args F.fprintf fmt "Javac driver mode:@\nprog = '%s'@\nargs = %a" prog Pp.cli_args args
| Maven (prog, args) -> | Maven (prog, args) ->
@ -184,8 +191,7 @@ let capture_with_compilation_database db_files =
CaptureCompilationDatabase.capture_files_in_database compilation_database CaptureCompilationDatabase.capture_files_in_database compilation_database
let capture ~changed_files mode = let capture ~changed_files = function
match mode with
| Analyze -> | Analyze ->
() ()
| BuckCompilationDB (prog, args) -> | BuckCompilationDB (prog, args) ->
@ -271,7 +277,11 @@ let capture ~changed_files mode =
~extra_flavors:[] buck_args ~extra_flavors:[] buck_args
in in
let all_args = List.rev_append rev_not_targets targets in let all_args = List.rev_append rev_not_targets targets in
let updated_buck_cmd = prog :: command :: Buck.store_args_in_file all_args in let updated_buck_cmd =
[prog; command]
@ List.rev_append Config.buck_build_args_no_inline
(Buck.store_args_in_file all_args)
in
Logging.(debug Capture Quiet) Logging.(debug Capture Quiet)
"Processed buck command '%a'@\n" (Pp.seq F.pp_print_string) updated_buck_cmd ; "Processed buck command '%a'@\n" (Pp.seq F.pp_print_string) updated_buck_cmd ;
updated_buck_cmd ) updated_buck_cmd )

Loading…
Cancel
Save