Update doc
This commit is contained in:
parent
4e7cb253e1
commit
419df111bf
|
@ -536,12 +536,10 @@ Jbuilder supports the following variables:
|
||||||
|
|
||||||
In addition, ``(action ...)`` fields support the following special variables:
|
In addition, ``(action ...)`` fields support the following special variables:
|
||||||
|
|
||||||
- ``@`` expands to the list of target, separated by spaces
|
- ``@`` expands to the list of target
|
||||||
- ``!@`` same as ``@`` but with a split semantic (see below)
|
|
||||||
- ``<`` expands to the first dependency, or the empty string if there are no
|
- ``<`` expands to the first dependency, or the empty string if there are no
|
||||||
dependencies
|
dependencies
|
||||||
- ``^`` expands to the list of dependencies, separated by spaces
|
- ``^`` expands to the list of dependencies
|
||||||
- ``!^`` same as ``^`` but with a split semantic (see below)
|
|
||||||
- ``path:<path>`` expands to ``<path>``
|
- ``path:<path>`` expands to ``<path>``
|
||||||
- ``exe:<path>`` is the same as ``<path>``, except when cross-compiling, in
|
- ``exe:<path>`` is the same as ``<path>``, except when cross-compiling, in
|
||||||
which case it will expand to ``<path>`` from the host build context
|
which case it will expand to ``<path>`` from the host build context
|
||||||
|
@ -564,18 +562,37 @@ In addition, ``(action ...)`` fields support the following special variables:
|
||||||
- it is available locally and is not optional
|
- it is available locally and is not optional
|
||||||
- it is available locally and all its library dependencies are
|
- it is available locally and all its library dependencies are
|
||||||
available
|
available
|
||||||
|
|
||||||
- ``version:<package>`` expands to the version of the given
|
- ``version:<package>`` expands to the version of the given
|
||||||
package. Note that this is only supported for packages that are
|
package. Note that this is only supported for packages that are
|
||||||
being defined in the current scope
|
being defined in the current scope
|
||||||
|
- ``read:<path>`` expands to the contents of the given file
|
||||||
|
- ``read-lines:<path>`` expands to the list of lines in the given
|
||||||
|
file
|
||||||
|
- ``read-strings:<path>`` expands to the list of lines in the given
|
||||||
|
file, unescaped using OCaml lexical convention
|
||||||
|
|
||||||
The ``${<kind>:...}`` forms are what allows you to write custom rules that work
|
The ``${<kind>:...}`` forms are what allows you to write custom rules that work
|
||||||
transparently whether things are installed or not.
|
transparently whether things are installed or not.
|
||||||
|
|
||||||
Note that aliases are ignored by both ``${<}`` and ``${^}``.
|
Note that aliases are ignored by both ``${<}`` and ``${^}``.
|
||||||
|
|
||||||
Moreover ``${^}`` and ``${@}`` will always expand to a single
|
The intent of this last form is to reliably read a list of strings
|
||||||
string. For instance in:
|
generated by an OCaml program via:
|
||||||
|
|
||||||
|
.. code:: ocaml
|
||||||
|
|
||||||
|
List.iter (fun s -> print_string (String.escaped s)) l
|
||||||
|
|
||||||
|
#. Expansion of lists
|
||||||
|
|
||||||
|
Forms that expands to list of items, such as ``${^}``, ``${@}`` or
|
||||||
|
``${read-lines:...}`` will always expand to a single string where
|
||||||
|
elements are separated by spaces. Inside ``(run <prog> <arguments>)``
|
||||||
|
forms you can however split the items as several arguments by
|
||||||
|
prefixing the variable with ``!``. Such forms can only be used as a
|
||||||
|
whole atom, i.e. they can't be used inside a quoted atom.
|
||||||
|
|
||||||
|
For instance in:
|
||||||
|
|
||||||
.. code:: scheme
|
.. code:: scheme
|
||||||
|
|
||||||
|
@ -588,11 +605,8 @@ command will be equivalent to the shell command:
|
||||||
|
|
||||||
$ foo "a b"
|
$ foo "a b"
|
||||||
|
|
||||||
In order to *split* them, you can use ``${!^}`` and ``${!@}``. These
|
However, if you replace ``${^}`` by ``${!^}`` in the previous example
|
||||||
two forms are only available in ``(run ...)`` forms and can only be
|
the command produced would be equivalent to this shell command:
|
||||||
used as a whole atom, i.e. they can't be used inside a quoted
|
|
||||||
atom. Replacing ``${^}`` by ``${!^}`` in the previous example would
|
|
||||||
produce a command equivalent to this shell command:
|
|
||||||
|
|
||||||
.. code:: shell
|
.. code:: shell
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue