|
@@ -28,6 +28,7 @@ type context = {
|
|
type server_message =
|
|
type server_message =
|
|
| AddedDirectory of string
|
|
| AddedDirectory of string
|
|
| FoundDirectories of (string * float ref) list
|
|
| FoundDirectories of (string * float ref) list
|
|
|
|
+ | ChangedDirectories of (string * float) list
|
|
| ModulePathChanged of (module_def * float * string)
|
|
| ModulePathChanged of (module_def * float * string)
|
|
| NotCached of module_def
|
|
| NotCached of module_def
|
|
| Parsed of (string * string)
|
|
| Parsed of (string * string)
|
|
@@ -207,6 +208,7 @@ let rec wait_loop process_params verbose accept =
|
|
let kind,data = match message with
|
|
let kind,data = match message with
|
|
| AddedDirectory dir -> "addedDirectory",JString dir
|
|
| AddedDirectory dir -> "addedDirectory",JString dir
|
|
| FoundDirectories dirs -> "foundDirectories",JInt (List.length dirs)
|
|
| FoundDirectories dirs -> "foundDirectories",JInt (List.length dirs)
|
|
|
|
+ | ChangedDirectories dirs -> "changedDirectories",JArray (List.map (fun (s,_) -> JString s) dirs)
|
|
| ModulePathChanged(m,time,file) -> "modulePathChanged",module_path m
|
|
| ModulePathChanged(m,time,file) -> "modulePathChanged",module_path m
|
|
| NotCached m -> "notCached",module_path m
|
|
| NotCached m -> "notCached",module_path m
|
|
| Parsed(ffile,_) -> "parsed",JString ffile
|
|
| Parsed(ffile,_) -> "parsed",JString ffile
|
|
@@ -219,6 +221,8 @@ let rec wait_loop process_params verbose accept =
|
|
) else (fun message -> match message with
|
|
) else (fun message -> match message with
|
|
| AddedDirectory dir -> print_endline (Printf.sprintf "%sadded directory %s" (sign_string com) dir)
|
|
| AddedDirectory dir -> print_endline (Printf.sprintf "%sadded directory %s" (sign_string com) dir)
|
|
| FoundDirectories dirs -> print_endline (Printf.sprintf "%sfound %i directories" (sign_string com) (List.length dirs));
|
|
| FoundDirectories dirs -> print_endline (Printf.sprintf "%sfound %i directories" (sign_string com) (List.length dirs));
|
|
|
|
+ | ChangedDirectories dirs ->
|
|
|
|
+ print_endline (Printf.sprintf "%schanged directories: [%s]" (sign_string com) (String.concat ", " (List.map (fun (s,_) -> "\"" ^ s ^ "\"") dirs)))
|
|
| ModulePathChanged(m,time,file) ->
|
|
| ModulePathChanged(m,time,file) ->
|
|
print_endline (Printf.sprintf "%smodule path might have changed: %s\n\twas: %2.0f %s\n\tnow: %2.0f %s"
|
|
print_endline (Printf.sprintf "%smodule path might have changed: %s\n\twas: %2.0f %s\n\tnow: %2.0f %s"
|
|
(sign_string com) (s_type_path m.m_path) m.m_extra.m_time m.m_extra.m_file time file);
|
|
(sign_string com) (s_type_path m.m_path) m.m_extra.m_time m.m_extra.m_file time file);
|
|
@@ -293,7 +297,7 @@ let rec wait_loop process_params verbose accept =
|
|
let dirs = try
|
|
let dirs = try
|
|
(* Next, get all directories from the cache and filter the ones that haven't changed. *)
|
|
(* Next, get all directories from the cache and filter the ones that haven't changed. *)
|
|
let all_dirs = CompilationServer.find_directories cs sign in
|
|
let all_dirs = CompilationServer.find_directories cs sign in
|
|
- List.fold_left (fun acc (dir,time) ->
|
|
|
|
|
|
+ let dirs = List.fold_left (fun acc (dir,time) ->
|
|
try
|
|
try
|
|
let time' = stat dir in
|
|
let time' = stat dir in
|
|
if !time < time' then begin
|
|
if !time < time' then begin
|
|
@@ -313,7 +317,9 @@ let rec wait_loop process_params verbose accept =
|
|
CompilationServer.remove_directory cs sign dir;
|
|
CompilationServer.remove_directory cs sign dir;
|
|
if verbose then process_server_message com "" (RemovedDirectory dir);
|
|
if verbose then process_server_message com "" (RemovedDirectory dir);
|
|
acc
|
|
acc
|
|
- ) [] all_dirs
|
|
|
|
|
|
+ ) [] all_dirs in
|
|
|
|
+ if verbose then process_server_message com "" (ChangedDirectories dirs);
|
|
|
|
+ dirs
|
|
with Not_found ->
|
|
with Not_found ->
|
|
(* There were no directories in the cache, so this must be a new context. Let's add
|
|
(* There were no directories in the cache, so this must be a new context. Let's add
|
|
an empty list to make sure no crazy recursion happens. *)
|
|
an empty list to make sure no crazy recursion happens. *)
|