Fix static dependencies
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
parent
2a71439c3e
commit
972406a0dc
|
@ -845,24 +845,11 @@ module Action = struct
|
|||
match targets_written_by_user with
|
||||
| Infer -> Loc.fail loc "You cannot use %s with inferred rules." var
|
||||
| Alias -> Loc.fail loc "You cannot use %s in aliases." var
|
||||
| Static l -> Some (Value.L.paths l)
|
||||
| Static l -> Some (Value.L.dirs l) (* XXX hack to signal no dep *)
|
||||
in
|
||||
let expand var syntax_version =
|
||||
let expand_form s var syntax_version =
|
||||
let loc = String_with_vars.Var.loc var in
|
||||
let key = String_with_vars.Var.full_name var in
|
||||
match String_with_vars.Var.destruct var with
|
||||
| Single var_name ->
|
||||
begin match expand_var_no_root sctx ~syntax_version ~var with
|
||||
| None -> String.Map.find extra_vars key
|
||||
| Some Targets -> targets loc var_name
|
||||
| Some v ->
|
||||
let exp = Var.Kind.to_value_no_deps_or_targets ~scope v in
|
||||
Option.iter exp ~f:(fun v ->
|
||||
acc.sdeps <- Path.Set.union
|
||||
(Path.Set.of_list (Value.L.deps_only v)) acc.sdeps);
|
||||
exp
|
||||
end
|
||||
| Pair (_, s)->
|
||||
begin match expand_form sctx ~syntax_version ~var with
|
||||
| Some Var.Form.Exe -> Some (path_exp (map_exe (Path.relative dir s)))
|
||||
| Some Dep -> Some (path_exp (Path.relative dir s))
|
||||
|
@ -953,6 +940,25 @@ module Action = struct
|
|||
String_with_vars.Var.fail var ~f:(sprintf "Unknown form: %s")
|
||||
end
|
||||
in
|
||||
let expand var syntax_version =
|
||||
let loc = String_with_vars.Var.loc var in
|
||||
let key = String_with_vars.Var.full_name var in
|
||||
let res =
|
||||
match String_with_vars.Var.destruct var with
|
||||
| Single var_name ->
|
||||
begin match expand_var_no_root sctx ~syntax_version ~var with
|
||||
| None -> String.Map.find extra_vars key
|
||||
| Some Targets -> targets loc var_name
|
||||
| Some v -> Var.Kind.to_value_no_deps_or_targets v ~scope
|
||||
end
|
||||
| Pair (_, s) -> expand_form s var syntax_version
|
||||
in
|
||||
Option.iter res ~f:(fun v ->
|
||||
acc.sdeps <- Path.Set.union
|
||||
(Path.Set.of_list (Value.L.deps_only v)) acc.sdeps
|
||||
);
|
||||
res
|
||||
in
|
||||
let t = U.partial_expand t ~dir ~map_exe ~f:expand in
|
||||
(t, acc)
|
||||
|
||||
|
|
|
@ -35,4 +35,6 @@ module L = struct
|
|||
let strings = List.map ~f:(fun x -> String x)
|
||||
|
||||
let paths = List.map ~f:(fun x -> Path x)
|
||||
|
||||
let dirs = List.map ~f:(fun x -> Dir x)
|
||||
end
|
||||
|
|
|
@ -16,6 +16,8 @@ module L : sig
|
|||
|
||||
val deps_only : t list -> Path.t list
|
||||
|
||||
val dirs : Path.t list -> t list
|
||||
|
||||
val concat : t list -> dir:Path.t -> string
|
||||
|
||||
val to_strings : t list -> dir:Path.t -> string list
|
||||
|
|
Loading…
Reference in New Issue