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)
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 loc = String_with_vars.Var.loc var in
match String.Map.find dynamic_expansions key with
@ -817,7 +817,13 @@ module Action = struct
[Value.String ""]
| 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)
let run sctx ~loc ?(extra_vars=String.Map.empty)

View File

@ -1,4 +1,4 @@
(alias
(name print-merlins)
(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
(targets result expected)
(deps dune (glob_files *.txt))
(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")))))
(rule
(targets result2 expected2)
(deps (source_tree sub-tree))
(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")))))
(alias
@ -31,7 +31,7 @@
(alias
(name runtest)
(deps dune dune-plop)
(action (run diff -u %{^})))
(action (run diff -u %{deps})))
;; For some tests in subdirs

View File

@ -21,13 +21,13 @@
(rule
(targets static.exe)
(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})))
(rule
(targets static.bc)
(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})))
(rule