Skip to content

Commit

Permalink
Record change and document variants
Browse files Browse the repository at this point in the history
Signed-off-by: Lucas Pluvinage <lucas.pluvinage@gmail.com>
  • Loading branch information
TheLortex committed May 23, 2019
1 parent 7c1dfca commit 5790f9b
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
unreleased
----------

- Redesign of the library variant feature according to the #2134 proposal. The
set of variants is now computed when the virtual library is installed.
Introducing a new `external_variant` stanza. (#2169, @TheLortex, review by
@diml)

- Restricted the set of variables available for expansion in the destination
filename of `install` stanza to simplify implementation and avoid dependency
cycles. (#2073, @aalekseyev, @diml)
Expand Down
17 changes: 17 additions & 0 deletions doc/dune-files.rst
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,23 @@ run this toplevel with:
$ dune exec ./tt.exe
external_variant
-----------------

The ``external_variant`` allow to declare a tagged implementation that does not
live inside the virtual library project.

.. code:: scheme
(external_variant
(variant foo)
(implementation lib-foo)
(virtual_library vlib))
This will add `lib-foo` to the list of known implementations of `vlib`. For more
details see :ref:`dune-variants`


Common items
============

Expand Down
19 changes: 18 additions & 1 deletion doc/variants.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@ implementation for every virtual library that we've used:
clock_unix ;; leaving this dependency will make dune loudly complain
calendar))
.. _dune-variants:

Variants
========

This feature is still under development and may change with new dune
releases. You need to write ``(using library_variants 0.1)`` in your
releases. You need to write ``(using library_variants 0.2)`` in your
``dune-project`` file to unlock it.

When building a binary, implementations can be selected using a set of variants
Expand Down Expand Up @@ -108,6 +110,21 @@ implementation would have the following configuration:
(implements time)
(variant js))
Since dune 1.11.0, the list of available variants is computed while building
the virtual library. This means only variant implementations that are part of
the same project are implicitely taken into account. It's possible to declare
an external implementation by using the `external_variant` stanza in the
virtual library scope.

.. code:: scheme
(external_variant
(variant foo)
(implementation lib-foo)
(virtual_library vlib))
This will add `lib-foo` to the list of known implementations of `vlib`.

Default implementation
======================

Expand Down

0 comments on commit 5790f9b

Please sign in to comment.