Some cleanup and renaming

Reviewed By: sblackshear

Differential Revision: D3273230

fb-gh-sync-id: 6a50949
fbshipit-source-id: 6a50949
master
Jeremy Dubreil 9 years ago committed by Facebook Github Bot 2
parent f60b17d8b9
commit 6dfd1a317e

@ -348,9 +348,6 @@ class AnalyzerWrapper(object):
elif self.args.project_root:
infer_options += ['-project_root', self.args.project_root]
if self.args.analyzer in [config.ANALYZER_CHECKERS,
config.ANALYZER_TRACING]:
os.environ['INFER_ONDEMAND'] = 'Y'
infer_options = map(utils.decode_or_not, infer_options)
infer_options_str = ' '.join(infer_options)

@ -77,8 +77,7 @@ def prepare_build(args):
infer_cache_dir = os.path.join(args.infer_out, 'cache')
if not os.path.isdir(infer_cache_dir):
os.mkdir(infer_cache_dir)
infer_options.append('--infer_cache')
infer_options.append(infer_cache_dir)
infer_options += ['--infer_cache', infer_cache_dir]
temp_files = [infer_cache_dir]
try:

@ -50,6 +50,8 @@ let proc_stats_filename = "proc_stats.json"
let global_tenv_filename = "global.tenv"
let specs_files_suffix = ".specs"
(** Name of the infer configuration file *)
let inferconfig_file = ".inferconfig"
@ -85,7 +87,7 @@ struct
let entries = Zip.entries zip_channel in
let extract_entry entry =
let dest_file = Filename.concat dest_dir (Filename.basename entry.Zip.filename) in
if Filename.check_suffix entry.Zip.filename ".specs"
if Filename.check_suffix entry.Zip.filename specs_files_suffix
then Zip.copy_entry_to_file zip_channel entry dest_file in
List.iter extract_entry entries;
Zip.close_in zip_channel
@ -118,6 +120,7 @@ let zip_channel zip_library =
(** list of the zip files to search for specs files *)
let zip_libraries : zip_library list ref = ref []
let zip_models : zip_library list ref = ref []
let add_zip_library zip_filename =
if !JarCache.infer_cache != None
@ -126,10 +129,23 @@ let add_zip_library zip_filename =
else
(* The order matters, the jar files should be added following the order *)
(* specs files should be searched in them *)
zip_libraries := !zip_libraries @ [{ zip_filename = zip_filename; zip_channel = Zip.open_in zip_filename; models = false }]
let zip_library = {
zip_filename = zip_filename;
zip_channel = Zip.open_in zip_filename;
models = false
} in
zip_libraries := zip_library :: !zip_libraries
let add_models zip_filename =
zip_libraries := !zip_libraries @ [{ zip_filename = zip_filename; zip_channel = Zip.open_in zip_filename; models = true }]
let zip_library = {
zip_filename = zip_filename;
zip_channel = Zip.open_in zip_filename;
models = true
} in
zip_models := zip_library :: !zip_models
let get_zip_libraries () =
(IList.rev !zip_models) @ (IList.rev !zip_libraries)
let project_root : string option ref = ref None

@ -244,7 +244,7 @@ let print_usage_exit err_s =
let load_specfiles () =
let specs_files_in_dir dir =
let is_specs_file fname =
not (Sys.is_directory fname) && Filename.check_suffix fname ".specs" in
not (Sys.is_directory fname) && Filename.check_suffix fname Config.specs_files_suffix in
let all_filenames = Array.to_list (Sys.readdir dir) in
let all_filepaths = IList.map (fun fname -> Filename.concat dir fname) all_filenames in
IList.filter is_specs_file all_filepaths in
@ -1032,7 +1032,7 @@ module AnalysisResults = struct
(* parse command-line arguments, and find spec files specified there *)
let args = ref [] in
let f arg =
if not (Filename.check_suffix arg ".specs") && arg <> "."
if not (Filename.check_suffix arg Config.specs_files_suffix) && arg <> "."
then print_usage_exit "arguments must be .specs files"
else args := arg::!args in
Arg.parse "INFERPRINT_ARGS" arg_desc f usage;
@ -1044,7 +1044,9 @@ module AnalysisResults = struct
IList.append (if !args = ["."] then begin
let arr = Sys.readdir "." in
let all_files = Array.to_list arr in
IList.filter (fun fname -> (Filename.check_suffix fname ".specs")) all_files
IList.filter
(fun fname -> (Filename.check_suffix fname Config.specs_files_suffix))
all_files
end
else !args) (load_specfiles ())

@ -515,7 +515,7 @@ let add_summary (proc_name : Procname.t) (summary: summary) : unit =
let specs_filename pname =
let pname_file = Procname.to_filename pname in
pname_file ^ ".specs"
pname_file ^ Config.specs_files_suffix
(** path to the .specs file for the given procedure in the current results directory *)
let res_dir_specs_filename pname =
@ -613,7 +613,7 @@ let load_summary_to_spec_table proc_name =
| None ->
(* search on models, libzips, and libs *)
if load_summary_models (specs_models_filename proc_name) then true
else if load_summary_ziplibs !Config.zip_libraries then true
else if load_summary_ziplibs (Config.get_zip_libraries ()) then true
else load_summary_libs (specs_library_filenames proc_name)
| Some summ ->

@ -52,7 +52,7 @@ let collect_specs_filenames jar_filename =
let zip_channel = Zip.open_in jar_filename in
let collect set e =
let filename = e.Zip.filename in
if not (Filename.check_suffix filename ".specs") then set
if not (Filename.check_suffix filename Config.specs_files_suffix) then set
else
let proc_filename = (Filename.chop_extension (Filename.basename filename)) in
StringSet.add proc_filename set in

Loading…
Cancel
Save