diff --git a/src/build.ml b/src/build.ml index d30b712f..7a5ad6e5 100644 --- a/src/build.ml +++ b/src/build.ml @@ -26,7 +26,7 @@ module Repr = struct | Fanout : ('a, 'b) t * ('a, 'c) t -> ('a, 'b * 'c) t | Paths : Path.Set.t -> ('a, 'a) t | Paths_for_rule : Path.Set.t -> ('a, 'a) t - | Paths_glob : glob_state ref -> ('a, Path.t list) t + | Paths_glob : glob_state ref -> ('a, Path.Set.t) t (* The reference gets decided in Build_interpret.deps *) | If_file_exists : Path.t * ('a, 'b) if_file_exists_state ref -> ('a, 'b) t | Contents : Path.t -> ('a, string) t @@ -55,7 +55,7 @@ module Repr = struct and glob_state = | G_unevaluated of Loc.t * Path.t * Re.re - | G_evaluated of Path.t list + | G_evaluated of Path.Set.t let get_if_file_exists_exn state = match !state with diff --git a/src/build.mli b/src/build.mli index bb13b950..0112e6d6 100644 --- a/src/build.mli +++ b/src/build.mli @@ -59,7 +59,7 @@ val path_set : Path.Set.t -> ('a, 'a) t (** Evaluate a glob and record all the matched files as dependencies of the action produced by the build arrow. *) -val paths_glob : loc:Loc.t -> dir:Path.t -> Re.re -> ('a, Path.t list) t +val paths_glob : loc:Loc.t -> dir:Path.t -> Re.re -> ('a, Path.Set.t) t (* CR-someday diml: rename to [source_files_recursively_in] *) (** Compute the set of source of all files present in the sub-tree @@ -193,7 +193,7 @@ module Repr : sig | Fanout : ('a, 'b) t * ('a, 'c) t -> ('a, 'b * 'c) t | Paths : Path.Set.t -> ('a, 'a) t | Paths_for_rule : Path.Set.t -> ('a, 'a) t - | Paths_glob : glob_state ref -> ('a, Path.t list) t + | Paths_glob : glob_state ref -> ('a, Path.Set.t) t | If_file_exists : Path.t * ('a, 'b) if_file_exists_state ref -> ('a, 'b) t | Contents : Path.t -> ('a, string) t | Lines_of : Path.t -> ('a, string list) t @@ -221,10 +221,10 @@ module Repr : sig and glob_state = | G_unevaluated of Loc.t * Path.t * Re.re - | G_evaluated of Path.t list + | G_evaluated of Path.Set.t val get_if_file_exists_exn : ('a, 'b) if_file_exists_state ref -> ('a, 'b) t - val get_glob_result_exn : glob_state ref -> Path.t list + val get_glob_result_exn : glob_state ref -> Path.Set.t end val repr : ('a, 'b) t -> ('a, 'b) Repr.t diff --git a/src/build_interpret.ml b/src/build_interpret.ml index 2272c691..a4e7de9f 100644 --- a/src/build_interpret.ml +++ b/src/build_interpret.ml @@ -66,7 +66,7 @@ let static_deps t ~all_targets ~file_tree = | Paths_glob state -> begin match !state with | G_evaluated l -> - { acc with action_deps = Path.Set.union acc.action_deps (Path.Set.of_list l) } + { acc with action_deps = Path.Set.union acc.action_deps l } | G_unevaluated (loc, dir, re) -> let targets = all_targets ~dir in let result = @@ -87,7 +87,7 @@ let static_deps t ~all_targets ~file_tree = (* diml: we should probably warn in this case as well *) () end; - state := G_evaluated (Path.Set.to_list result); + state := G_evaluated result; let action_deps = Path.Set.union result acc.action_deps in { acc with action_deps } end diff --git a/src/super_context.ml b/src/super_context.ml index bbc2f7b1..d9ff5648 100644 --- a/src/super_context.ml +++ b/src/super_context.ml @@ -484,6 +484,7 @@ module Deps = struct | Ok re -> let dir = Path.parent_exn path in Build.paths_glob ~loc ~dir (Re.compile re) + >>^ Path.Set.to_list | Error (_pos, msg) -> Loc.fail loc "invalid glob: %s" msg end