[buck][clang] config options

Summary: New inferconfig flags which will pass through to buck config flags. Purpose is to allow using a buck target to distribute and use infer binaries as a buck toolchain.

Reviewed By: martintrojer

Differential Revision: D29485801

fbshipit-source-id: 86169cdae
master
Nikos Gorogiannis 4 years ago committed by Facebook GitHub Bot
parent c4eddcb179
commit a46bd3f55a

@ -133,6 +133,12 @@ BUCK OPTIONS
Activates: Buck integration for clang-based targets
(C/C++/Objective-C/Objective-C++). (Conversely: --no-buck-clang)
--buck-clang-use-toolchain-config
Activates: Suppress setting buck config values for the infer
binary and other values in the buck-clang-flavor integration and
instead rely on buck toolchain configuration options. (Conversely:
--no-buck-clang-use-toolchain-config)
--buck-compilation-database { no-deps | deps }
Buck integration using the compilation database, with or without
dependencies. Only includes clang targets, as per Buck's

@ -149,6 +149,12 @@ OPTIONS
(C/C++/Objective-C/Objective-C++). (Conversely: --no-buck-clang)
See also infer-capture(1).
--buck-clang-use-toolchain-config
Activates: Suppress setting buck config values for the infer
binary and other values in the buck-clang-flavor integration and
instead rely on buck toolchain configuration options. (Conversely:
--no-buck-clang-use-toolchain-config) See also infer-capture(1).
--buck-compilation-database { no-deps | deps }
Buck integration using the compilation database, with or without
dependencies. Only includes clang targets, as per Buck's

@ -149,6 +149,12 @@ OPTIONS
(C/C++/Objective-C/Objective-C++). (Conversely: --no-buck-clang)
See also infer-capture(1).
--buck-clang-use-toolchain-config
Activates: Suppress setting buck config values for the infer
binary and other values in the buck-clang-flavor integration and
instead rely on buck toolchain configuration options. (Conversely:
--no-buck-clang-use-toolchain-config) See also infer-capture(1).
--buck-compilation-database { no-deps | deps }
Buck integration using the compilation database, with or without
dependencies. Only includes clang targets, as per Buck's

@ -324,11 +324,13 @@ let initial_command =
match InferCommand.of_exe_name exe_basename with Some _ as command -> command | None -> None
let bin_dir =
let infer_binary =
(* Resolve symlinks to get to the real executable, which is located in [bin_dir]. *)
Filename.dirname (Utils.realpath Sys.executable_name)
Utils.realpath Sys.executable_name
let bin_dir = Filename.dirname infer_binary
let fcp_dir =
bin_dir ^/ Filename.parent_dir_name ^/ Filename.parent_dir_name ^/ "facebook-clang-plugins"
@ -786,6 +788,13 @@ and buck_build_args_no_inline_rev =
args starting with '@'. Only valid for $(b,--buck-clang)."
and buck_clang_use_toolchain_config =
CLOpt.mk_bool ~long:"buck-clang-use-toolchain-config" ~default:false
~in_help:InferCommand.[(Capture, manual_buck)]
"Suppress setting buck config values for the infer binary and other values in the \
buck-clang-flavor integration and instead rely on buck toolchain configuration options."
and buck_compilation_database_depth =
CLOpt.mk_int_opt ~long:"buck-compilation-database-depth"
~in_help:InferCommand.[(Capture, manual_buck)]
@ -2914,6 +2923,8 @@ and buck_build_args_no_inline = RevList.to_list !buck_build_args_no_inline_rev
and buck_cache_mode = (!buck || !genrule_mode) && not !debug
and buck_clang_use_toolchain_config = !buck_clang_use_toolchain_config
and buck_java_heap_size_gb = !buck_java_heap_size_gb
and buck_java_flavor_suppress_config = !buck_java_flavor_suppress_config

@ -179,6 +179,8 @@ val buck_build_args_no_inline : string list
val buck_cache_mode : bool
val buck_clang_use_toolchain_config : bool
val buck_java_flavor_suppress_config : bool
val buck_java_heap_size_gb : int option
@ -333,6 +335,8 @@ val genrule_mode : bool
val get_linter_doc_url : linter_id:string -> string option
val global_tenv : bool
val help_checker : Checker.t list
val help_issue_type : IssueType.t list
@ -341,7 +345,8 @@ val hoisting_report_only_expensive : bool
val html : bool
val global_tenv : bool
val infer_binary : string
(** absolute canonicalized path to the current executable *)
val icfg_dotty_outfile : string option

@ -128,19 +128,20 @@ let config =
in
let get_java_flavor_config () =
if Config.buck_java_flavor_suppress_config then []
else
[ "infer_java.version=" ^ Version.versionString
; Printf.sprintf "infer_java.binary=%s/infer" Config.bin_dir ]
else ["infer_java.version=" ^ Version.versionString; "infer_java.binary=" ^ Config.infer_binary]
in
let get_flavors_config () =
let get_clang_flavor_config () =
[ "client.id=infer.clang"
; Printf.sprintf "*//infer.infer_bin=%s" Config.bin_dir
; Printf.sprintf "*//infer.clang_compiler=%s" clang_path
; Printf.sprintf "*//infer.clang_plugin=%s" Config.clang_plugin_path
; "*//cxx.pch_enabled=false"
; (* Infer doesn't support C++ modules yet (T35656509) *)
"*//cxx.modules_default=false"
; "*//cxx.modules=false" ]
@ ( if Config.buck_clang_use_toolchain_config then []
else
[ "*//infer.infer_bin=" ^ Config.bin_dir
; "*//infer.binary=" ^ Config.infer_binary
; "*//infer.clang_compiler=" ^ clang_path
; "*//infer.clang_plugin=" ^ Config.clang_plugin_path ] )
@ ( match Config.xcode_developer_dir with
| Some d ->
[Printf.sprintf "apple.xcode_developer_dir=%s" d]
@ -158,7 +159,7 @@ let config =
| JavaFlavor ->
get_java_flavor_config ()
| ClangFlavors ->
get_flavors_config ()
get_clang_flavor_config ()
| ClangCompilationDB _ ->
[]
in

Loading…
Cancel
Save