This commit is contained in:
swrup 2025-11-11 02:07:51 +01:00
parent aa2ff7b2f0
commit 2f3113f55d
11742 changed files with 1223940 additions and 0 deletions

View file

@ -0,0 +1,9 @@
@all
====
This alias corresponds to every known file target in a directory.
Since version 2.0 of the dune language, JS targets of executables are no longer
included in the `all` alias by default. To get back the old behavior of
including the JS targets in `all`, one can add the ``js`` target to the
executable's ``modes`` field.

View file

@ -0,0 +1,11 @@
@check
======
This alias corresponds to the set of targets necessary for development tools to
work correctly. For example, it will build ``*.cmi``, ``*.cmt``, and ``*.cmti``
files so that Merlin and ``ocaml-lsp-server`` can be used in the project.
It is also useful in the development loop because it will catch compilation
errors without executing expensive operations such as linking executables.
.. seealso:: :doc:`ocaml-index` for a fast feedback loop that
also indexes the project.

View file

@ -0,0 +1,27 @@
@default
========
This alias corresponds to the default argument for ``dune build``: ``dune
build`` is equivalent to ``dune build @@default`` (``@@`` indicates a
:doc:`non-recursive alias <../aliases>`). Similarly, ``dune build dir`` is
equivalent to ``dune build @@dir/default``.
When a directory doesn't explicitly define what the ``default`` alias means via
an :doc:`/reference/dune/alias` stanza, the following implicit definition is
assumed:
.. code:: dune
(alias
(name default)
(deps (alias_rec all)))
But if such a stanza is present in the ``dune`` file in a directory, it will be
used instead. For example, if the following is present in ``tests/dune``,
``dune build tests`` will run tests there:
.. code:: dune
(alias
(name default)
(deps (alias_rec runtest)))

View file

@ -0,0 +1,6 @@
@doc-json
=========
This alias builds documentation for public libraries as JSON files. These are
produced by ``odoc``'s option ``--as-json`` and can be consumed by external
tools.

View file

@ -0,0 +1,4 @@
@doc-private
============
This alias builds documentation for all libraries, both public & private.

View file

@ -0,0 +1,6 @@
@doc
====
This alias builds documentation for public libraries as HTML pages.
.. seealso:: :doc:`/documentation`

View file

@ -0,0 +1,9 @@
@empty
======
The `empty` alias contains no targets.
As of Dune language version 3.20, user-defined :doc:`rule <../dune/rule>` and
:doc:`alias <../dune/alias>` stanzas are no longer permitted to extend the
`empty` alias.

View file

@ -0,0 +1,24 @@
@fmt
====
This alias is used by formatting rules: when it is built, code formatters will
be executed (using :doc:`promotion </concepts/promotion>`).
``dune fmt`` is a shortcut for ``dune build @fmt --auto-promote``.
It is possible to build on top of this convention. If some actions are manually
attached to the ``fmt`` alias, they will be executed by ``dune fmt``.
Example:
.. code:: dune
(rule
(with-stdout-to
data.json.formatted
(run jq . %{dep:data.json})))
(rule
(alias fmt)
(action
(diff data.json data.json.formatted)))

View file

@ -0,0 +1,6 @@
@install
========
Building this alias will create the ``*.install`` files used by the :doc:`opam
integration </explanation/opam-integration>`. In turn, these depend on
installable files.

View file

@ -0,0 +1,4 @@
@lint
=====
This alias runs linting tools.

View file

@ -0,0 +1,9 @@
@ocaml-index
============
This alias corresponds to the set of targets necessary for development tools to
provide project-wide queries such as "get all references of this value". These
targets are indexes built using the required `ocaml-index` binary. Since this
alias also includes the ``*.cmi``, ``*.cmt``, and ``*.cmti`` files usually built
by ``check``, it can be used in most projects as a replacement to get a fast
feedback loop while maintaining the indexes up-to-date.

View file

@ -0,0 +1,23 @@
@pkg-install
============
This alias is only relevant when using Dune with *package management* (see
:doc:`/tutorials/dune-package-management/index`). Running ``dune build
@pkg-install`` will fetch the dependencies described in the ``depends`` field
of your ``dune-project`` (see :doc:`/reference/dune-project/package`) and build
them. It will not build your project.
Indeed, if you need to build the project, you need to use the regular ``dune
build`` command. Note that if the dependencies have not been already fetch and
downloaded, ``dune build`` will **also** take care of getting and building them.
.. note::
``dune build @pkg-install`` is particularly useful when you are building
projects using per-layer caching systems, e.g., Docker images. Using this
alias, you will be able to cache the dependencies building stage as they
change less regularly.
If you are building the ``@pkg-install`` alias in a repository where package
management is not activated, the command will fail.
.. seealso:: :doc:`/explanation/package-management`

View file

@ -0,0 +1,10 @@
@runtest
========
Actions that run tests are attached to this alias. For example this convention
is used by the ``(test)`` stanza.
``dune runtest`` is a shortcut for ``dune build @runtest`` but is also able to
run individual tests.
.. seealso:: :doc:`/tests`