Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn about project conditional blocks #9515

Merged
merged 2 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/cabal-package-description-file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2426,6 +2426,8 @@ Configuration Flags
negated value. However, if the flag is manual, then the default
value (which can be overridden by commandline flags) will be used.

.. _conditional-blocks:

Conditional Blocks
^^^^^^^^^^^^^^^^^^

Expand Down
29 changes: 22 additions & 7 deletions doc/cabal-project-description-file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,28 @@ directories when there is none in the current directory.
Conditionals and imports
------------------------

As of ``cabal-install`` version 3.8, cabal supports conditional logic
and imports in ``cabal.project`` files. :ref:`conditions` in cabal
may case on operating system, architecture, and
compiler (i.e. there is no support for a notion of custom flags in
project files). Imports may specify local filepaths or remote urls,
and may reference either cabal.project files or v1-style cabal.config
freeze files. As a usage example:
As of ``cabal-install`` version 3.8, cabal supports conditional logic and
imports in ``cabal.project`` files.

.. warning::

While :ref:`conditional blocks<conditional-blocks>` can appear anywhere
within component or common sections of a package, their placement within a
project is restricted. Conditions may only be introduced at the top level
of a project.

Of the :ref:`condition tests<conditions>`, only packages can test for
flags. Projects can test for operating system, architecture, compiler and
the boolean constants.

- :samp:`os({name})`
- :samp:`arch({name})`
- :samp:`impl({compiler})`
- ``true``
- ``false``

Imports may specify local filepaths or remote urls, and may reference either
cabal.project files or v1-style cabal.config freeze files. As a usage example:

::

Expand Down
Loading