Rename %{^} to %{deps}

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
Rudi Grinberg 2018-07-06 13:57:22 +07:00
parent a317fb0606
commit 13c12e9def
4 changed files with 15 additions and 9 deletions

View File

@ -801,7 +801,7 @@ module Action = struct
(t, acc) (t, acc)
let expand_step2 ~dir ~dynamic_expansions ~deps_written_by_user ~map_exe t = let expand_step2 ~dir ~dynamic_expansions ~deps_written_by_user ~map_exe t =
U.Partial.expand t ~dir ~map_exe ~f:(fun var _syntax_version -> U.Partial.expand t ~dir ~map_exe ~f:(fun var syntax_version ->
let key = String_with_vars.Var.full_name var in let key = String_with_vars.Var.full_name var in
let loc = String_with_vars.Var.loc var in let loc = String_with_vars.Var.loc var in
match String.Map.find dynamic_expansions key with match String.Map.find dynamic_expansions key with
@ -817,7 +817,13 @@ module Action = struct
[Value.String ""] [Value.String ""]
| dep :: _ -> | dep :: _ ->
[Path dep]) [Path dep])
| "^" -> Some (Value.L.paths deps_written_by_user) | "^" ->
if syntax_version < (1, 0) then
Some (Value.L.paths deps_written_by_user)
else
Loc.fail loc "Variable %%{^} has been renamed to %%{deps}"
| "deps" when syntax_version >= (1, 0) ->
Some (Value.L.paths deps_written_by_user)
| _ -> None) | _ -> None)
let run sctx ~loc ?(extra_vars=String.Map.empty) let run sctx ~loc ?(extra_vars=String.Map.empty)

View File

@ -1,4 +1,4 @@
(alias (alias
(name print-merlins) (name print-merlins)
(deps lib/.merlin exe/.merlin) (deps lib/.merlin exe/.merlin)
(action (run ./sanitize-dot-merlin/sanitize_dot_merlin.exe %{^}))) (action (run ./sanitize-dot-merlin/sanitize_dot_merlin.exe %{deps})))

View File

@ -1,17 +1,17 @@
;; Test for %{^} with globs in rules ;; Test for %{deps} with globs in rules
(rule (rule
(targets result expected) (targets result expected)
(deps dune (glob_files *.txt)) (deps dune (glob_files *.txt))
(action (progn (action (progn
(with-stdout-to result (echo %{^})) (with-stdout-to result (echo %{deps}))
(with-stdout-to expected (echo "dune a.txt b.txt c.txt"))))) (with-stdout-to expected (echo "dune a.txt b.txt c.txt")))))
(rule (rule
(targets result2 expected2) (targets result2 expected2)
(deps (source_tree sub-tree)) (deps (source_tree sub-tree))
(action (progn (action (progn
(with-stdout-to result2 (echo %{^})) (with-stdout-to result2 (echo %{deps}))
(with-stdout-to expected2 (echo "sub-tree/a sub-tree/dir/b"))))) (with-stdout-to expected2 (echo "sub-tree/a sub-tree/dir/b")))))
(alias (alias
@ -31,7 +31,7 @@
(alias (alias
(name runtest) (name runtest)
(deps dune dune-plop) (deps dune dune-plop)
(action (run diff -u %{^}))) (action (run diff -u %{deps})))
;; For some tests in subdirs ;; For some tests in subdirs

View File

@ -21,13 +21,13 @@
(rule (rule
(targets static.exe) (targets static.exe)
(deps test.exe%{ext_obj} static.c) (deps test.exe%{ext_obj} static.c)
(action (run %{CC} -o %{targets} -I %{ocaml_where} -I . %{^} (action (run %{CC} -o %{targets} -I %{ocaml_where} -I . %{deps}
%{ocaml-config:native_c_libraries}))) %{ocaml-config:native_c_libraries})))
(rule (rule
(targets static.bc) (targets static.bc)
(deps test.bc%{ext_obj} static.c) (deps test.bc%{ext_obj} static.c)
(action (run %{CC} -o %{targets} -I %{ocaml_where} -I . %{^} (action (run %{CC} -o %{targets} -I %{ocaml_where} -I . %{deps}
%{ocaml-config:bytecomp_c_libraries}))) %{ocaml-config:bytecomp_c_libraries})))
(rule (rule