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
|
@ -12,7 +12,8 @@ type 'a t =
|
||||||
| Target of Path.t
|
| Target of Path.t
|
||||||
| Path of Path.t
|
| Path of Path.t
|
||||||
| Paths of Path.t list
|
| Paths of Path.t list
|
||||||
| Hidden_deps of Path.t list
|
| Hidden_deps of Path.t list
|
||||||
|
| Hidden_targets of Path.t list
|
||||||
| Dyn of ('a -> nothing t)
|
| Dyn of ('a -> nothing t)
|
||||||
|
|
||||||
let rec add_deps ts set =
|
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 ->
|
List.fold_left ts ~init:acc ~f:(fun acc t ->
|
||||||
match t with
|
match t with
|
||||||
| Target fn -> fn :: acc
|
| Target fn -> fn :: acc
|
||||||
|
| Hidden_targets fns -> List.rev_append fns acc
|
||||||
| S ts
|
| S ts
|
||||||
| Concat (_, ts) -> add_targets ts acc
|
| Concat (_, ts) -> add_targets ts acc
|
||||||
| _ -> acc)
|
| _ -> acc)
|
||||||
|
@ -51,7 +53,7 @@ let expand ~dir ts x =
|
||||||
List.map fns ~f:(Path.reach ~from:dir)
|
List.map fns ~f:(Path.reach ~from:dir)
|
||||||
| S ts -> List.concat_map ts ~f:loop_dyn
|
| S ts -> List.concat_map ts ~f:loop_dyn
|
||||||
| Concat (sep, ts) -> [String.concat ~sep (loop_dyn (S ts))]
|
| 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
|
| Dyn _ -> assert false
|
||||||
| Hidden_deps l ->
|
| Hidden_deps l ->
|
||||||
dyn_deps := Pset.union !dyn_deps (Pset.of_list 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))]
|
| Concat (sep, ts) -> [String.concat ~sep (loop (S ts))]
|
||||||
| Target fn -> [Path.reach fn ~from:dir]
|
| Target fn -> [Path.reach fn ~from:dir]
|
||||||
| Dyn f -> loop_dyn (f x)
|
| Dyn f -> loop_dyn (f x)
|
||||||
| Hidden_deps _ -> []
|
| Hidden_deps _ | Hidden_targets _ -> []
|
||||||
in
|
in
|
||||||
let l = List.concat_map ts ~f:loop in
|
let l = List.concat_map ts ~f:loop in
|
||||||
(l, !dyn_deps)
|
(l, !dyn_deps)
|
||||||
|
|
|
@ -38,7 +38,8 @@ type 'a t =
|
||||||
| Target of Path.t
|
| Target of Path.t
|
||||||
| Path of Path.t
|
| Path of Path.t
|
||||||
| Paths of Path.t list
|
| Paths of Path.t list
|
||||||
| Hidden_deps of Path.t list
|
| Hidden_deps of Path.t list
|
||||||
|
| Hidden_targets of Path.t list
|
||||||
(** Register dependencies but produce no argument *)
|
(** Register dependencies but produce no argument *)
|
||||||
| Dyn of ('a -> nothing t)
|
| Dyn of ('a -> nothing t)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue