Less Path.Set.t -> Path.t list conversions
This commit is contained in:
parent
30c59cc476
commit
b5fad14f16
|
@ -34,7 +34,7 @@ module Repr = struct
|
|||
| Contents : Path.t -> ('a, string) t
|
||||
| Lines_of : Path.t -> ('a, string list) t
|
||||
| Vpath : 'a Vspec.t -> (unit, 'a) t
|
||||
| Dyn_paths : ('a, Path.t list) t -> ('a, 'a) t
|
||||
| Dyn_paths : ('a, Path.Set.t) t -> ('a, 'a) t
|
||||
| Record_lib_deps : lib_deps -> ('a, 'a) t
|
||||
| Fail : fail -> (_, _) t
|
||||
| Memo : 'a memo -> (unit, 'a) t
|
||||
|
@ -135,7 +135,8 @@ let paths ps = Paths (Pset.of_list ps)
|
|||
let path_set ps = Paths ps
|
||||
let paths_glob ~loc ~dir re = Paths_glob (ref (G_unevaluated (loc, dir, re)))
|
||||
let vpath vp = Vpath vp
|
||||
let dyn_paths t = Dyn_paths t
|
||||
let dyn_paths t = Dyn_paths (t >>^ Path.Set.of_list)
|
||||
let dyn_path_set t = Dyn_paths t
|
||||
let paths_for_rule ps = Paths_for_rule ps
|
||||
|
||||
let catch t ~on_error = Catch (t, on_error)
|
||||
|
|
|
@ -71,6 +71,7 @@ val files_recursively_in
|
|||
|
||||
(** Record dynamic dependencies *)
|
||||
val dyn_paths : ('a, Path.t list) t -> ('a, 'a) t
|
||||
val dyn_path_set : ('a, Path.Set.t) t -> ('a, 'a) t
|
||||
|
||||
val vpath : 'a Vspec.t -> (unit, 'a) t
|
||||
|
||||
|
@ -189,7 +190,7 @@ module Repr : sig
|
|||
| Contents : Path.t -> ('a, string) t
|
||||
| Lines_of : Path.t -> ('a, string list) t
|
||||
| Vpath : 'a Vspec.t -> (unit, 'a) t
|
||||
| Dyn_paths : ('a, Path.t list) t -> ('a, 'a) t
|
||||
| Dyn_paths : ('a, Path.Set.t) t -> ('a, 'a) t
|
||||
| Record_lib_deps : lib_deps -> ('a, 'a) t
|
||||
| Fail : fail -> (_, _) t
|
||||
| Memo : 'a memo -> (unit, 'a) t
|
||||
|
|
|
@ -302,7 +302,7 @@ module Dir_status = struct
|
|||
|
||||
type alias =
|
||||
{ mutable deps : Pset.t
|
||||
; mutable dyn_deps : (unit, Path.t list) Build.t
|
||||
; mutable dyn_deps : (unit, Pset.t) Build.t
|
||||
; mutable actions : alias_action list
|
||||
}
|
||||
|
||||
|
@ -458,7 +458,7 @@ module Build_exec = struct
|
|||
Option.value_exn file.data
|
||||
| Dyn_paths t ->
|
||||
let fns = exec dyn_deps t x in
|
||||
dyn_deps := Pset.union !dyn_deps (Pset.of_list fns);
|
||||
dyn_deps := Pset.union !dyn_deps fns;
|
||||
x
|
||||
| Record_lib_deps _ -> x
|
||||
| Fail { fail } -> fail ()
|
||||
|
@ -880,9 +880,9 @@ and load_dir_step2_exn t ~dir ~collector ~lazy_generators =
|
|||
~context:None
|
||||
(Build.path_set deps >>>
|
||||
dyn_deps >>>
|
||||
Build.dyn_paths (Build.arr (fun x -> x))
|
||||
Build.dyn_path_set (Build.arr (fun x -> x))
|
||||
>>^ (fun dyn_deps ->
|
||||
let deps = Pset.union deps (Pset.of_list dyn_deps) in
|
||||
let deps = Pset.union deps dyn_deps in
|
||||
Action.with_stdout_to path
|
||||
(Action.digest_files (Pset.to_list deps)))
|
||||
>>>
|
||||
|
@ -1523,7 +1523,7 @@ module Alias = struct
|
|||
let x =
|
||||
{ Dir_status.
|
||||
deps = Pset.empty
|
||||
; dyn_deps = Build.return []
|
||||
; dyn_deps = Build.return Pset.empty
|
||||
; actions = []
|
||||
}
|
||||
in
|
||||
|
@ -1533,14 +1533,14 @@ module Alias = struct
|
|||
|
||||
let add_deps build_system t ?dyn_deps deps =
|
||||
let def = get_alias_def build_system t in
|
||||
def.deps <- Pset.union def.deps (Pset.of_list deps);
|
||||
def.deps <- Pset.union def.deps deps;
|
||||
match dyn_deps with
|
||||
| None -> ()
|
||||
| Some build ->
|
||||
let open Build.O in
|
||||
def.dyn_deps <-
|
||||
Build.fanout def.dyn_deps build >>^ fun (a, b) ->
|
||||
List.rev_append a b
|
||||
Pset.union a b
|
||||
|
||||
let add_action build_system t ~context ?(locks=[]) ~stamp action =
|
||||
let def = get_alias_def build_system t in
|
||||
|
|
|
@ -149,8 +149,8 @@ module Alias : sig
|
|||
val add_deps
|
||||
: build_system
|
||||
-> t
|
||||
-> ?dyn_deps:(unit, Path.t list) Build.t
|
||||
-> Path.t list
|
||||
-> ?dyn_deps:(unit, Path.Set.t) Build.t
|
||||
-> Path.Set.t
|
||||
-> unit
|
||||
|
||||
(** [add_action store alias ~stamp action] arrange things so that
|
||||
|
|
|
@ -708,17 +708,18 @@ module Gen(P : Install_rules.Params) = struct
|
|||
|
||||
List.iter Cm_kind.all ~f:(fun cm_kind ->
|
||||
let files =
|
||||
Module.Name.Map.fold modules ~init:[] ~f:(fun m acc ->
|
||||
Module.Name.Map.fold modules ~init:Path.Set.empty ~f:(fun m acc ->
|
||||
match Module.cm_file m ~obj_dir cm_kind with
|
||||
| None -> acc
|
||||
| Some fn -> fn :: acc)
|
||||
| Some fn -> Path.Set.add acc fn)
|
||||
in
|
||||
SC.Libs.setup_file_deps_alias sctx ~dir lib ~ext:(Cm_kind.ext cm_kind)
|
||||
files);
|
||||
SC.Libs.setup_file_deps_group_alias sctx ~dir lib ~exts:[".cmi"; ".cmx"];
|
||||
SC.Libs.setup_file_deps_alias sctx ~dir lib ~ext:".h"
|
||||
(List.map lib.install_c_headers ~f:(fun header ->
|
||||
Path.relative dir (header ^ ".h")));
|
||||
Path.relative dir (header ^ ".h"))
|
||||
|> Path.Set.of_list);
|
||||
|
||||
let top_sorted_modules =
|
||||
Ocamldep.Dep_graph.top_closed_implementations dep_graphs.impl
|
||||
|
|
|
@ -242,7 +242,7 @@ module Gen(P : Install_params) = struct
|
|||
let files = Install.files entries in
|
||||
SC.add_alias_deps sctx
|
||||
(Alias.package_install ~context:ctx ~pkg:package)
|
||||
(Path.Set.to_list files)
|
||||
files
|
||||
~dyn_deps:
|
||||
(Build_system.package_deps (SC.build_system sctx) files
|
||||
>>^ fun packages ->
|
||||
|
@ -251,7 +251,8 @@ module Gen(P : Install_params) = struct
|
|||
|> List.map ~f:(fun pkg ->
|
||||
Build_system.Alias.package_install
|
||||
~context:(SC.context sctx) ~pkg
|
||||
|> Build_system.Alias.stamp_file));
|
||||
|> Build_system.Alias.stamp_file)
|
||||
|> Path.Set.of_list);
|
||||
SC.add_rule sctx
|
||||
~mode:(if promote_install_file then
|
||||
Promote_but_delete_on_clean
|
||||
|
@ -314,7 +315,7 @@ module Gen(P : Install_params) = struct
|
|||
let path = Path.append ctx.build_dir src_path in
|
||||
let install_alias = Alias.install ~dir:path in
|
||||
let install_file = Path.relative path install_fn in
|
||||
SC.add_alias_deps sctx install_alias [install_file])
|
||||
SC.add_alias_deps sctx install_alias (Path.Set.singleton install_file))
|
||||
|
||||
let init () =
|
||||
init_meta ();
|
||||
|
|
15
src/odoc.ml
15
src/odoc.ml
|
@ -210,7 +210,8 @@ module Gen (S : sig val sctx : SC.t end) = struct
|
|||
compile_module ~dir ~obj_dir ~includes ~dep_graphs
|
||||
~doc_dir ~pkg_or_lnu)
|
||||
in
|
||||
Dep.setup_deps (Lib lib) (List.map modules_and_odoc_files ~f:snd)
|
||||
Dep.setup_deps (Lib lib) (List.map modules_and_odoc_files ~f:snd
|
||||
|> Path.Set.of_list)
|
||||
|
||||
let setup_css_rule () =
|
||||
SC.add_rule sctx
|
||||
|
@ -337,13 +338,13 @@ module Gen (S : sig val sctx : SC.t end) = struct
|
|||
:: List.map ~f:(fun lib -> Dep.html_alias (Lib lib)) libs
|
||||
) ~f:(fun alias ->
|
||||
SC.add_alias_deps sctx alias
|
||||
[ css_file
|
||||
; toplevel_index
|
||||
]
|
||||
(Path.Set.of_list [ css_file
|
||||
; toplevel_index
|
||||
])
|
||||
);
|
||||
List.combine odocs html_files
|
||||
|> List.iter ~f:(fun (odoc, html) ->
|
||||
SC.add_alias_deps sctx odoc.html_alias [html]
|
||||
SC.add_alias_deps sctx odoc.html_alias (Path.Set.singleton html)
|
||||
);
|
||||
end
|
||||
|
||||
|
@ -387,6 +388,7 @@ module Gen (S : sig val sctx : SC.t end) = struct
|
|||
|> Lib.Set.to_list
|
||||
|> List.map ~f:(fun lib -> Dep.html_alias (Lib lib)))
|
||||
|> List.map ~f:Build_system.Alias.stamp_file
|
||||
|> Path.Set.of_list
|
||||
)
|
||||
|
||||
let pkg_odoc (pkg : Package.t) = Paths.odocs (Pkg pkg.name)
|
||||
|
@ -449,7 +451,7 @@ module Gen (S : sig val sctx : SC.t end) = struct
|
|||
~doc_dir:(Paths.odocs (Pkg pkg.name))
|
||||
~includes:(Build.arr (fun _ -> Arg_spec.As []))
|
||||
) in
|
||||
Dep.setup_deps (Pkg pkg.name) odocs
|
||||
Dep.setup_deps (Pkg pkg.name) (Path.Set.of_list odocs)
|
||||
|
||||
let init ~modules_by_lib ~mlds_of_dir =
|
||||
let docs_by_package =
|
||||
|
@ -529,6 +531,7 @@ module Gen (S : sig val sctx : SC.t end) = struct
|
|||
))
|
||||
|> List.map ~f:(fun (lib : Lib.t) ->
|
||||
Build_system.Alias.stamp_file (Dep.alias (Lib lib)))
|
||||
|> Path.Set.of_list
|
||||
)
|
||||
|
||||
end
|
||||
|
|
|
@ -303,7 +303,8 @@ module Libs = struct
|
|||
~ext:(String.concat exts ~sep:"-and-")
|
||||
(List.map exts ~f:(fun ext ->
|
||||
Alias.stamp_file
|
||||
(lib_files_alias ~dir ~name:(Library.best_name lib) ~ext)))
|
||||
(lib_files_alias ~dir ~name:(Library.best_name lib) ~ext))
|
||||
|> Path.Set.of_list)
|
||||
|
||||
let file_deps t ~ext =
|
||||
Build.dyn_paths (Build.arr (fun libs ->
|
||||
|
|
|
@ -98,8 +98,8 @@ val add_rules
|
|||
val add_alias_deps
|
||||
: t
|
||||
-> Build_system.Alias.t
|
||||
-> ?dyn_deps:(unit, Path.t list) Build.t
|
||||
-> Path.t list
|
||||
-> ?dyn_deps:(unit, Path.Set.t) Build.t
|
||||
-> Path.Set.t
|
||||
-> unit
|
||||
val add_alias_action
|
||||
: t
|
||||
|
@ -152,7 +152,7 @@ module Libs : sig
|
|||
-> dir:Path.t
|
||||
-> ext:string
|
||||
-> Library.t
|
||||
-> Path.t list
|
||||
-> Path.Set.t
|
||||
-> unit
|
||||
|
||||
(** Setup an alias that depend on all files with the given extensions.
|
||||
|
|
Loading…
Reference in New Issue