Add Arg_spec.Hidden_targets
Same as Hidden_deps: allows to declare targets than don't appear on the command line.
This commit is contained in:
parent
d9a90b4f29
commit
bd7f793792
|
@ -13,6 +13,7 @@ type 'a t =
|
|||
| Path of Path.t
|
||||
| Paths of Path.t list
|
||||
| Hidden_deps of Path.t list
|
||||
| Hidden_targets of Path.t list
|
||||
| Dyn of ('a -> nothing t)
|
||||
|
||||
let rec add_deps ts set =
|
||||
|
@ -29,6 +30,7 @@ let rec add_targets ts acc =
|
|||
List.fold_left ts ~init:acc ~f:(fun acc t ->
|
||||
match t with
|
||||
| Target fn -> fn :: acc
|
||||
| Hidden_targets fns -> List.rev_append fns acc
|
||||
| S ts
|
||||
| Concat (_, ts) -> add_targets ts acc
|
||||
| _ -> acc)
|
||||
|
@ -51,7 +53,7 @@ let expand ~dir ts x =
|
|||
List.map fns ~f:(Path.reach ~from:dir)
|
||||
| S ts -> List.concat_map ts ~f:loop_dyn
|
||||
| Concat (sep, ts) -> [String.concat ~sep (loop_dyn (S ts))]
|
||||
| Target _ -> die "Target not allowed under Dyn"
|
||||
| Target _ | Hidden_targets _ -> die "Target not allowed under Dyn"
|
||||
| Dyn _ -> assert false
|
||||
| Hidden_deps l ->
|
||||
dyn_deps := Pset.union !dyn_deps (Pset.of_list l);
|
||||
|
@ -66,7 +68,7 @@ let expand ~dir ts x =
|
|||
| Concat (sep, ts) -> [String.concat ~sep (loop (S ts))]
|
||||
| Target fn -> [Path.reach fn ~from:dir]
|
||||
| Dyn f -> loop_dyn (f x)
|
||||
| Hidden_deps _ -> []
|
||||
| Hidden_deps _ | Hidden_targets _ -> []
|
||||
in
|
||||
let l = List.concat_map ts ~f:loop in
|
||||
(l, !dyn_deps)
|
||||
|
|
|
@ -39,6 +39,7 @@ type 'a t =
|
|||
| Path of Path.t
|
||||
| Paths of Path.t list
|
||||
| Hidden_deps of Path.t list
|
||||
| Hidden_targets of Path.t list
|
||||
(** Register dependencies but produce no argument *)
|
||||
| Dyn of ('a -> nothing t)
|
||||
|
||||
|
|
Loading…
Reference in New Issue