From 7e1f0fdff9bf69ef5b58348826a825460ab4aa5b Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Tue, 14 Apr 2020 06:48:34 -0700 Subject: [PATCH] [infer-out][7/9] kill --export-changed-functions-output Summary: This is an entry in infer-out/, we want these to be predictable, not user-defined. Reviewed By: ngorogiannis Differential Revision: D20894307 fbshipit-source-id: 332f85969 --- infer/man/man1/infer-full.txt | 3 --- infer/src/backend/mergeCapture.ml | 8 ++++---- infer/src/base/Config.ml | 7 ------- infer/src/base/Config.mli | 2 -- infer/src/base/ResultsDir.ml | 4 +++- infer/src/base/ResultsDirEntryName.ml | 7 ++++++- infer/src/base/ResultsDirEntryName.mli | 1 + infer/src/test_determinator/testDeterminator.ml | 2 +- 8 files changed, 15 insertions(+), 19 deletions(-) diff --git a/infer/man/man1/infer-full.txt b/infer/man/man1/infer-full.txt index 3578f72d7..0b904d9ec 100644 --- a/infer/man/man1/infer-full.txt +++ b/infer/man/man1/infer-full.txt @@ -1346,9 +1346,6 @@ INTERNAL OPTIONS test-determinator. It is used together with the --modified-lines. (Conversely: --no-export-changed-functions) - --export-changed-functions-output path - Name of file for export-changed-functions results - --external-java-packages-reset Set --external-java-packages to the empty list. diff --git a/infer/src/backend/mergeCapture.ml b/infer/src/backend/mergeCapture.ml index dd2bf7c6a..8db319936 100644 --- a/infer/src/backend/mergeCapture.ml +++ b/infer/src/backend/mergeCapture.ml @@ -26,9 +26,9 @@ let merge_global_tenvs infer_deps_file = L.progress "Merging type environments took %a@." Mtime.Span.pp (Mtime_clock.count time0) -let merge_json_results infer_out_src json_file_name = - let main_changed_fs_file = Config.results_dir ^/ json_file_name in - let changed_fs_file = infer_out_src ^/ json_file_name in +let merge_json_results infer_out_src json_entry = + let main_changed_fs_file = ResultsDir.get_path json_entry in + let changed_fs_file = ResultsDirEntryName.get_path ~results_dir:infer_out_src json_entry in let main_json = try YB.from_file main_changed_fs_file |> YBU.to_list with Sys_error _ -> [] in let changed_json = try YB.from_file changed_fs_file |> YBU.to_list with Sys_error _ -> [] in let all_fs = @@ -50,7 +50,7 @@ let merge_all_json_results merge_results results_json_str = let merge_changed_functions () = let merge_changed_functions_json infer_out_src = - merge_json_results infer_out_src Config.export_changed_functions_output + merge_json_results infer_out_src ChangedFunctions in merge_all_json_results merge_changed_functions_json "changed functions" diff --git a/infer/src/base/Config.ml b/infer/src/base/Config.ml index bd531ce58..dee1da0ea 100644 --- a/infer/src/base/Config.ml +++ b/infer/src/base/Config.ml @@ -2179,11 +2179,6 @@ and export_changed_functions = the $(b,--modified-lines)." -and export_changed_functions_output = - CLOpt.mk_path ~long:"export-changed-functions-output" ~default:"changed_functions.json" - "Name of file for export-changed-functions results" - - and scheduler = CLOpt.mk_symbol ~long:"scheduler" ~default:File ~eq:equal_scheduler ~symbols:[("file", File); ("restart", Restart); ("callgraph", SyntacticCallGraph)] @@ -3032,8 +3027,6 @@ and test_determinator_output = !test_determinator_output and export_changed_functions = !export_changed_functions -and export_changed_functions_output = !export_changed_functions_output - and test_filtering = !test_filtering and profiler_samples = !profiler_samples diff --git a/infer/src/base/Config.mli b/infer/src/base/Config.mli index facca7ad3..5d0a90ff8 100644 --- a/infer/src/base/Config.mli +++ b/infer/src/base/Config.mli @@ -600,8 +600,6 @@ val test_determinator_output : string val export_changed_functions : bool -val export_changed_functions_output : string - val test_filtering : bool val testing_mode : bool diff --git a/infer/src/base/ResultsDir.ml b/infer/src/base/ResultsDir.ml index 5b69e395f..d10296a44 100644 --- a/infer/src/base/ResultsDir.ml +++ b/infer/src/base/ResultsDir.ml @@ -201,7 +201,9 @@ let scrub_for_caching () = [ report_json ; costs_report_json ; test_determinator_output - ; export_changed_functions_output ])) + ; (* ChangedFunctions; TODO: this hard-coded string will be deleted in a next diff + when the logic for scrubbing will be entirely in {!ResultsDirEntryName}. *) + "changed_functions.json" ])) && ( List.mem ~equal:String.equal files_to_delete (Filename.basename name) || List.exists ~f:(Filename.check_suffix name) suffixes_to_delete ) in diff --git a/infer/src/base/ResultsDirEntryName.ml b/infer/src/base/ResultsDirEntryName.ml index a94a179ef..02ac04c7d 100644 --- a/infer/src/base/ResultsDirEntryName.ml +++ b/infer/src/base/ResultsDirEntryName.ml @@ -6,7 +6,7 @@ *) open! IStd -type id = Logs | Specs | Temporary [@@deriving enumerate] +type id = ChangedFunctions | Logs | Specs | Temporary [@@deriving enumerate] type cleanup_action = Delete | Keep [@@deriving equal] @@ -22,6 +22,11 @@ type t = e.g., a distributed Buck cache. *) } let of_id = function + | ChangedFunctions -> + { rel_path= "changed_functions.json" + ; kind= File + ; before_incremental_analysis= Delete + ; before_caching_capture= Keep } | Logs -> { rel_path= "logs" ; kind= File diff --git a/infer/src/base/ResultsDirEntryName.mli b/infer/src/base/ResultsDirEntryName.mli index a8c36229a..b15be65a7 100644 --- a/infer/src/base/ResultsDirEntryName.mli +++ b/infer/src/base/ResultsDirEntryName.mli @@ -10,6 +10,7 @@ open! IStd directory you probably want to use {!ResultsDir.Entry} instead of this module. *) type id = + | ChangedFunctions (** results of the clang test determinator *) | Logs (** log file *) | Specs (** directory containing summaries as .specs files *) | Temporary (** directory containing temp files *) diff --git a/infer/src/test_determinator/testDeterminator.ml b/infer/src/test_determinator/testDeterminator.ml index 3639c95c1..6ca12e60b 100644 --- a/infer/src/test_determinator/testDeterminator.ml +++ b/infer/src/test_determinator/testDeterminator.ml @@ -172,7 +172,7 @@ let emit_relevant_methods relevant_methods = (List.map (Procname.Set.elements relevant_methods) ~f:Procname.to_string) in let json = `List (List.map ~f:(fun t -> `String t) cleaned_methods) in - let outpath = Config.results_dir ^/ Config.export_changed_functions_output in + let outpath = ResultsDir.get_path ChangedFunctions in YB.to_file outpath json