Simplify Build_system.eval_glob
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
This commit is contained in:
parent
02ed099693
commit
d94a7fe869
|
@ -1578,15 +1578,13 @@ let on_load_dir t ~dir ~f =
|
||||||
p.lazy_generators <- f :: lazy_generators
|
p.lazy_generators <- f :: lazy_generators
|
||||||
|
|
||||||
let eval_glob t ~dir re =
|
let eval_glob t ~dir re =
|
||||||
let targets = targets_of t ~dir |> Path.Set.to_list |> List.map ~f:Path.basename in
|
Path.Set.fold (targets_of t ~dir) ~init:[] ~f:(fun path acc ->
|
||||||
let files =
|
let fn = Path.basename path in
|
||||||
match File_tree.find_dir t.file_tree dir with
|
if Re.execp re fn then
|
||||||
| None -> targets
|
fn :: acc
|
||||||
| Some d ->
|
else
|
||||||
String.Set.union (String.Set.of_list targets) (File_tree.Dir.files d)
|
acc)
|
||||||
|> String.Set.to_list
|
|> List.rev
|
||||||
in
|
|
||||||
List.filter files ~f:(Re.execp re)
|
|
||||||
|
|
||||||
module Alias = struct
|
module Alias = struct
|
||||||
include Alias0
|
include Alias0
|
||||||
|
|
Loading…
Reference in New Issue