[config][easy] make Config.temp_file_dir relative and rename

Summary: This makes it similar to the other dir names in infer-out/.

Reviewed By: ngorogiannis

Differential Revision: D20795359

fbshipit-source-id: 88729d26d
master
Jules Villard 5 years ago committed by Facebook GitHub Bot
parent cfe4c62e47
commit 44ebe59b99

@ -232,6 +232,8 @@ let starvation_issues_dir_name = "starvation_issues"
let test_determinator_results = "test_determinator_results"
let temp_dir_name = "tmp"
(** Enable detailed tracing information during array abstraction *)
let trace_absarray = false
@ -3035,8 +3037,6 @@ and custom_symbols =
and symops_per_iteration = !symops_per_iteration
and temp_file_dir = !results_dir ^/ "tmp"
and keep_going = !keep_going
and test_determinator = !test_determinator
@ -3106,6 +3106,8 @@ let is_checker_enabled c =
let captured_dir = results_dir ^/ captured_dir_name
let temp_dir = results_dir ^/ temp_dir_name
let clang_frontend_action_string =
let text = if capture then ["translating"] else [] in
let text = if is_checker_enabled Linters then "linting" :: text else text in

@ -128,8 +128,6 @@ val pp_version : Format.formatter -> unit -> unit
val proc_stats_filename : string
val procnames_locks_dir : string
val property_attributes : string
val racerd_issues_dir_name : string
@ -251,9 +249,6 @@ val capture : bool
val capture_blacklist : string option
val captured_dir : string
(** directory where the results of the capture phase are stored *)
val censor_report : ((bool * Str.regexp) * (bool * Str.regexp) * string) list
val changed_files_index : string option
@ -324,8 +319,6 @@ val dotty_cfg_libs : bool
val dump_duplicate_symbols : bool
val dynamic_dispatch : bool
val eradicate_condition_redundant : bool
val eradicate_field_over_annotated : bool
@ -625,12 +618,6 @@ val threadsafe_aliases : Yojson.Basic.t
val topl_properties : string list
val toplevel_results_dir : string
(** In some integrations, eg Buck, infer subprocesses started by the build system (started by the
toplevel infer process) will have their own results directory; this points to the results
directory of the toplevel infer process, which can be useful for, eg, storing debug info. In
other cases this is equal to {!results_dir}. *)
val trace_error : bool
val trace_events : bool
@ -666,17 +653,24 @@ val write_html_whitelist_regex : string list
val xcode_developer_dir : string option
val xcpretty : bool
(** {2 Global variables with initial values specified by command-line options} *)
val temp_file_dir : string
(** {2 Configuration values derived from command-line options} *)
val clang_compilation_dbs : [`Escaped of string | `Raw of string] list ref
val dynamic_dispatch : bool
(** {2 Command Line Interface Documentation} *)
val captured_dir : string
(** directory where the results of the capture phase are stored *)
val print_usage_exit : unit -> 'a
val procnames_locks_dir : string
(** {2 Miscellanous} *)
val temp_dir : string
(** directory inside {!results_dir} to put temporary files *)
val toplevel_results_dir : string
(** In some integrations, eg Buck, infer subprocesses started by the build system (started by the
toplevel infer process) will have their own results directory; this points to the results
directory of the toplevel infer process, which can be useful for, eg, storing debug info. In
other cases this is equal to {!results_dir}. *)
val is_in_custom_symbols : string -> string -> bool
(** Does named symbol match any prefix in the named custom symbol list? *)
@ -685,3 +679,11 @@ val java_package_is_external : string -> bool
(** Check if a Java package is external to the repository *)
val execution_id : Int64.t
(** {2 Global variables with initial values specified by command-line options} *)
val clang_compilation_dbs : [`Escaped of string | `Raw of string] list ref
(** {2 Command Line Interface Documentation} *)
val print_usage_exit : unit -> 'a

@ -64,7 +64,7 @@ let create_results_dir () =
L.die UserError "ERROR: %s@\nPlease remove '%s' and try again" error Config.results_dir
) ;
Unix.mkdir_p Config.results_dir ;
Unix.mkdir_p Config.temp_file_dir ;
Unix.mkdir_p Config.temp_dir ;
List.iter ~f:Unix.mkdir_p results_dir_dir_markers ;
prepare_logging_and_db () ;
()

@ -325,7 +325,7 @@ let rec exceed_length ~max = function
let store_args_in_file args =
if exceed_length ~max:max_command_line_length args then (
let file = Filename.temp_file ~in_dir:Config.temp_file_dir "buck_targets" ".txt" in
let file = Filename.temp_file ~in_dir:Config.temp_dir "buck_targets" ".txt" in
let write_args outc = Out_channel.output_string outc (String.concat ~sep:"\n" args) in
let () = Utils.with_file_out file ~f:write_args in
L.(debug Capture Quiet) "Buck targets options stored in file '%s'@\n" file ;
@ -381,7 +381,7 @@ let capture_buck_args =
let run_buck_build prog buck_build_args =
L.debug Capture Verbose "%s %s@." prog (List.to_string ~f:Fn.id buck_build_args) ;
let buck_output_file = Filename.temp_file ~in_dir:Config.temp_file_dir "buck_output" ".log" in
let buck_output_file = Filename.temp_file ~in_dir:Config.temp_dir "buck_output" ".log" in
let infer_args =
Option.fold (Sys.getenv CommandLineOption.args_env_var) ~init:"--fcp-syntax-only"
~f:(fun acc arg -> Printf.sprintf "%s%c%s" acc CommandLineOption.env_var_sep arg)

@ -23,7 +23,7 @@ let write_infer_deps infile =
let run_buck_capture cmd =
let buck_output_file = Filename.temp_file ~in_dir:Config.temp_file_dir "buck_output" ".log" in
let buck_output_file = Filename.temp_file ~in_dir:Config.temp_dir "buck_output" ".log" in
let shell_cmd =
List.map ~f:Escape.escape_shell cmd
|> String.concat ~sep:" "

@ -125,7 +125,7 @@ let get_compilation_database_files_buck db_deps ~prog ~args =
(** Compute the compilation database files. *)
let get_compilation_database_files_xcodebuild ~prog ~args =
let tmp_file = Filename.temp_file ~in_dir:Config.temp_file_dir "cdb" ".json" in
let tmp_file = Filename.temp_file ~in_dir:Config.temp_dir "cdb" ".json" in
let xcodebuild_prog, xcodebuild_args = (prog, prog :: args) in
let xcpretty_prog = "xcpretty" in
let xcpretty_args =

@ -28,7 +28,7 @@ let quote style =
let mk_arg_file prefix style args =
let file = Filename.temp_file prefix ~in_dir:Config.temp_file_dir ".txt" in
let file = Filename.temp_file prefix ~in_dir:Config.temp_dir ".txt" in
let write_args outc =
List.iter
~f:(fun arg ->

@ -59,7 +59,7 @@ let capture ~prog ~args =
else
let javac_data = parse_gradle_line ~line:content in
let tmpfile, oc =
Core.Filename.open_temp_file ~in_dir:Config.temp_file_dir "gradle_files" ""
Core.Filename.open_temp_file ~in_dir:Config.temp_dir "gradle_files" ""
in
List.iter javac_data.files ~f:(fun file ->
Out_channel.output_string oc (normalize file ^ "\n") ) ;
@ -69,7 +69,7 @@ let capture ~prog ~args =
| None ->
seen
in
let gradle_output_file = Filename.temp_file ~in_dir:Config.temp_file_dir "gradle_output" ".log" in
let gradle_output_file = Filename.temp_file ~in_dir:Config.temp_dir "gradle_output" ".log" in
let shell_cmd =
List.map ~f:Escape.escape_shell (prog :: "--debug" :: args)
|> String.concat ~sep:" "

@ -30,7 +30,7 @@ let compile compiler build_prog build_args =
in
(* Pass non-special args via a file to avoid exceeding the command line size limit. *)
let args_file =
let file = Filename.temp_file ~in_dir:Config.temp_file_dir "javac_args" "" in
let file = Filename.temp_file ~in_dir:Config.temp_dir "javac_args" "" in
let quoted_file_args =
List.map file_args ~f:(fun arg ->
if String.contains arg '\'' then arg else F.sprintf "'%s'" arg )
@ -41,7 +41,7 @@ let compile compiler build_prog build_args =
let cli_file_args = cli_args @ ["@" ^ args_file] in
let args = prog_args @ cli_file_args in
L.(debug Capture Quiet) "Current working directory: '%s'@." (Sys.getcwd ()) ;
let verbose_out_file = Filename.temp_file ~in_dir:Config.temp_file_dir "javac" ".out" in
let verbose_out_file = Filename.temp_file ~in_dir:Config.temp_dir "javac" ".out" in
let try_run cmd error_k =
let shell_cmd = List.map ~f:Escape.escape_shell cmd |> String.concat ~sep:" " in
let shell_cmd_redirected = Printf.sprintf "%s 2>'%s'" shell_cmd verbose_out_file in

Loading…
Cancel
Save