Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the watch mode #1837

Merged
1 commit merged into from Feb 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
unreleased
----------

- Fix the watch mode (#1837, fix #1836, @diml)

1.7.0 (12/02/2019)
------------------

Expand Down
1 change: 1 addition & 0 deletions src/build_system.ml
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@ let get_build_system () =
match !t with
| Some t -> t
| None -> Exn.code_error "build system not yet initialized" []
let reset () = t := None
let t = get_build_system

let string_of_paths set =
Expand Down
2 changes: 2 additions & 0 deletions src/build_system.mli
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ val init
-> hook:(hook -> unit)
-> unit

val reset : unit -> unit

type extra_sub_directories_to_keep =
| All
| These of String.Set.t
Expand Down
1 change: 1 addition & 0 deletions src/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ let init_build_system ?only_packages ?external_lib_deps_mode w =
| Rule_started -> incr rule_total
| Rule_completed -> incr rule_done
in
Build_system.reset ();
Build_system.init ~contexts:w.contexts ~file_tree:w.conf.file_tree ~hook;
Scheduler.set_status_line_generator gen_status_line;
Gen_rules.gen w.conf
Expand Down
10 changes: 10 additions & 0 deletions src/memo/memo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,16 @@ module Cached_value = struct
t.calculated_at <- Run.current ();
Some t.data
end

(* We don't use this version of [get] yet as all the dependencies
are not yet properly specified. *)
let _ = get

let get t =
if Run.is_current t.calculated_at then
Fiber.return (Some t.data)
else
Fiber.return None
end

let ser_input (type a) (node : (a, _) Dep_node.t) =
Expand Down