Update documentation for new binding names

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
Rudi Grinberg 2018-07-10 01:14:02 +07:00
parent 77800e669e
commit 03f134567d
2 changed files with 23 additions and 24 deletions

View File

@ -22,7 +22,7 @@ Stanzas
(rule
(targets foo.ml)
(deps generator/gen.exe)
(action (run %{<} -o %{@})))
(action (run %{deps} -o %{targets})))
The following sections describe the available stanzas and their meaning.
@ -459,7 +459,7 @@ For instance:
(rule
(targets b
(deps a
(action (copy %{<} %{@})))))
(action (copy %{deps} %{targets})))))
In this example it is obvious by inspecting the action what the
dependencies and targets are. When this is the case you can use the
@ -495,7 +495,7 @@ ocamllex
(rule
(targets <name>.ml)
(deps <name>.mll)
(action (chdir %{root} (run %{bin:ocamllex} -q -o %{<}))))
(action (chdir %{root} (run %{bin:ocamllex} -q -o %{targets} %{deps}))))
To use a different rule mode, use the long form:
@ -515,7 +515,7 @@ ocamlyacc
(rule
(targets <name>.ml <name>.mli)
(deps <name>.mly)
(action (chdir %{root} (run %{bin:ocamlyacc} %{<}))))
(action (chdir %{root} (run %{bin:ocamlyacc} %{deps}))))
To use a different rule mode, use the long form:
@ -866,9 +866,8 @@ Dune supports the following variables:
In addition, ``(action ...)`` fields support the following special variables:
- ``@`` expands to the list of target
- ``<`` expands to the first dependency, or the empty string if there are no
dependencies
- ``targets`` expands to the list of target
- ``deps`` expands to the list of dependencies
- ``^`` expands to the list of dependencies, separated by spaces
- ``dep:<path>`` expands to ``<path>`` (and adds ``<path>`` as a dependency of
the action)
@ -909,7 +908,7 @@ In addition, ``(action ...)`` fields support the following special variables:
The ``%{<kind>:...}`` forms are what allows you to write custom rules that work
transparently whether things are installed or not.
Note that aliases are ignored by both ``%{<}`` and ``%{^}``.
Note that aliases are ignored by ``%{deps}``
The intent of this last form is to reliably read a list of strings
generated by an OCaml program via:
@ -920,13 +919,13 @@ generated by an OCaml program via:
#. Expansion of lists
Forms that expands to list of items, such as ``%{cc}``, ``%{^}``,
``%{@}`` or ``%{read-lines:...}``, are suitable to be used in, say,
Forms that expands to list of items, such as ``%{cc}``, ``%{deps}``,
``%{targets}`` or ``%{read-lines:...}``, are suitable to be used in, say,
``(run <prog> <arguments>)``. For instance in:
.. code:: scheme
(run foo %{^})
(run foo %{deps})
if there are two dependencies ``a`` and ``b``, the produced command
will be equivalent to the shell command:
@ -940,7 +939,7 @@ you have to quote the variable as in:
.. code:: scheme
(run foo "%{^}")
(run foo "%{deps}")
which is equivalent to the following shell command:
@ -949,7 +948,7 @@ which is equivalent to the following shell command:
$ foo "a b"
(the items of the list are concatenated with space).
Note that, since ``%{^}`` is a list of items, the first one may be
Note that, since ``%{deps}`` is a list of items, the first one may be
used as a program name, for instance:
.. code:: scheme
@ -957,7 +956,7 @@ used as a program name, for instance:
(rule
(targets result.txt)
(deps foo.exe (glob_files *.txt))
(action (run %{^})))
(action (run %{deps})))
Here is another example:
@ -966,7 +965,7 @@ Here is another example:
(rule
(targets foo.exe)
(deps foo.c)
(action (run %{cc} -o %{@} %{<} -lfoolib)))
(action (run %{cc} -o %{targets} %{deps} -lfoolib)))
Library dependencies
@ -1052,7 +1051,7 @@ you had setup a rule for every file of the form:
(rule
(targets file.pp.ml)
(deps file.ml)
(action (with-stdout-to %{@} (chdir %{root} <action>))))
(action (with-stdout-to %{targets} (chdir %{root} <action>))))
The equivalent of a ``-pp <command>`` option passed to the OCaml compiler is
``(system "<command> %{input-file}")``.
@ -1105,8 +1104,8 @@ For instance:
.. code:: scheme
(preprocess (per_module
(((action (run ./pp.sh X=1 %{<})) (foo bar)))
(((action (run ./pp.sh X=2 %{<})) (baz)))))
(((action (run ./pp.sh X=1 %{input-file})) (foo bar)))
(((action (run ./pp.sh X=2 %{input-file})) (baz)))))
.. _deps-field:
@ -1310,7 +1309,7 @@ To understand why this is important, let's consider this dune file living in
(rule
(targets blah.ml)
(deps blah.mll)
(action (run ocamllex -o %{@} %{<})))
(action (run ocamllex -o %{targets} %{deps})))
Here the command that will be executed is:
@ -1334,7 +1333,7 @@ of your project. What you should write instead is:
(rule
(targets blah.ml)
(deps blah.mll)
(action (chdir %{root} (run ocamllex -o %{@} %{<}))))
(action (chdir %{root} (run ocamllex -o %{targets} %{deps}))))
Locks
-----
@ -1357,13 +1356,13 @@ same lock:
(name runtest)
(deps foo)
(locks m)
(action (run test.exe %{<})))
(action (run test.exe %{deps})))
(alias
(name runtest)
(deps bar)
(locks m)
(action (run test.exe %{<})))
(action (run test.exe %{deps})))
Dune will make sure that the executions of ``test.exe foo`` and
``test.exe bar`` are serialized.
@ -1383,7 +1382,7 @@ simply use an absolute filename:
(name runtest)
(deps foo)
(locks /tcp-port/1042)
(action (run test.exe %{<})))
(action (run test.exe %{deps})))
.. _ocaml-syntax:

View File

@ -307,7 +307,7 @@ The backend for such a framework looks like this:
(library
((name simple_tests)
(inline_tests.backend
((generate_runner (run sed "s/(\\*TEST:\\(.*\\)\\*)/let () = \\1;;/" ${impl-files}))
((generate_runner (run sed "s/(\\*TEST:\\(.*\\)\\*)/let () = \\1;;/" %{impl-files}))
))))
Now all you have to do is write ``(inline_tests ((backend