[refactoring] Move read_config_changed_files from Driver to SourceFile

Reviewed By: ezgicicek

Differential Revision: D28707935

fbshipit-source-id: 3e6f24c6b
master
Sungkeun Cho 4 years ago committed by Facebook GitHub Bot
parent f624fc1197
commit 11ea6f9ab1

@ -276,6 +276,19 @@ let changed_sources_from_changed_files changed_files =
with _exn -> changed_files_set ) with _exn -> changed_files_set )
let read_config_changed_files () =
match Config.changed_files_index with
| None ->
None
| Some index -> (
match Utils.read_file index with
| Ok lines ->
Some (changed_sources_from_changed_files lines)
| Error error ->
L.external_error "Error reading the changed files index '%s': %s@." index error ;
None )
module SQLite = struct module SQLite = struct
type nonrec t = t type nonrec t = t

@ -20,9 +20,9 @@ module Hash : Caml.Hashtbl.S with type key = t
val is_invalid : t -> bool val is_invalid : t -> bool
(** Is the source file the invalid source file? *) (** Is the source file the invalid source file? *)
val changed_sources_from_changed_files : string list -> Set.t val read_config_changed_files : unit -> Set.t option
(** Set of files read from --changed-files-index file, None if option not specified NOTE: it may (** return the list of changed files as read from Config.changed_files_index. NOTE: it may include
include extra source_files if --changed-files-index contains paths to header files *) extra source_files if --changed-files-index contains paths to header files. *)
val invalid : string -> t val invalid : string -> t
(** Invalid source file *) (** Invalid source file *)

@ -15,7 +15,7 @@ module L = Logging
let run driver_mode = let run driver_mode =
let open Driver in let open Driver in
run_prologue driver_mode ; run_prologue driver_mode ;
let changed_files = read_config_changed_files () in let changed_files = SourceFile.read_config_changed_files () in
InferAnalyze.invalidate_changed_procedures changed_files ; InferAnalyze.invalidate_changed_procedures changed_files ;
capture driver_mode ~changed_files ; capture driver_mode ~changed_files ;
analyze_and_report driver_mode ~changed_files ; analyze_and_report driver_mode ~changed_files ;

@ -466,16 +466,3 @@ let run_epilogue () =
let run_epilogue () = let run_epilogue () =
GCStats.log ~name:"main_process_full" Analysis (GCStats.get ~since:ProgramStart) ; GCStats.log ~name:"main_process_full" Analysis (GCStats.get ~since:ProgramStart) ;
ScubaLogging.execute_with_time_logging "run_epilogue" run_epilogue ScubaLogging.execute_with_time_logging "run_epilogue" run_epilogue
let read_config_changed_files () =
match Config.changed_files_index with
| None ->
None
| Some index -> (
match Utils.read_file index with
| Ok lines ->
Some (SourceFile.changed_sources_from_changed_files lines)
| Error error ->
L.external_error "Error reading the changed files index '%s': %s@." index error ;
None )

@ -46,7 +46,3 @@ val analyze_and_report :
val run_epilogue : unit -> unit val run_epilogue : unit -> unit
(** cleanup infer-out/ for Buck, generate stats, and generally post-process the results of a run *) (** cleanup infer-out/ for Buck, generate stats, and generally post-process the results of a run *)
val read_config_changed_files : unit -> SourceFile.Set.t option
(** return the list of changed files as read from Config.changed_files_index and passed to
SourceFile.changed_sources_from_changed_files *)

Loading…
Cancel
Save