Skip to content

Commit 3330167

Browse files
committed
Add docs for project buildonly fields
- Remove redundant "configuration" from section titles - JSON in uppercase
1 parent 670955a commit 3330167

1 file changed

Lines changed: 214 additions & 81 deletions

File tree

doc/cabal-project-description-file.rst

Lines changed: 214 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -323,12 +323,14 @@ The :ref:`VCS fields<vcs-fields>` of ``source-repository-package`` are:
323323

324324
Run command in the checked out repository, prior sdisting.
325325

326-
Global configuration options
327-
----------------------------
326+
Global options
327+
--------------
328328

329329
The following top-level configuration options are not specific to any
330-
package, and thus apply globally:
330+
package, and thus apply globally.
331331

332+
Verbosity options
333+
^^^^^^^^^^^^^^^^^
332334

333335
.. cfg-field:: verbose: nat
334336
-v[n], --verbose[=n]
@@ -342,6 +344,18 @@ package, and thus apply globally:
342344
The command line variant of this field is ``--verbose=2``; a short
343345
form ``-v2`` is also supported.
344346

347+
.. cfg-field:: build-timings: boolean
348+
--build-timings
349+
350+
Log timing information to stdout, in the following format::
351+
352+
[build-timings] configure aeson-2.2.3.0 0.042s
353+
[build-timings] build aeson-2.2.3.0 3.284s
354+
[build-timings] install aeson-2.2.3.0 0.123s
355+
356+
Job and concurrency options
357+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
358+
345359
.. cfg-field:: jobs: nat or $ncpus
346360
-j[NUM], --jobs[=NUM], --jobs=$ncpus
347361
:synopsis: Number of builds running in parallel.
@@ -384,15 +398,8 @@ package, and thus apply globally:
384398

385399
The command line variant of this field is ``--keep-going``.
386400

387-
.. option:: --builddir=DIR
388-
389-
Specifies the name of the directory where build products for
390-
build will be stored; defaults to ``dist-newstyle``. If a
391-
relative name is specified, this directory is resolved relative
392-
to the root of the project (i.e., where the ``cabal.project``
393-
file lives.)
394-
395-
This option can only be specified from the command line.
401+
Project options
402+
^^^^^^^^^^^^^^^
396403

397404
.. _cmdoption-project-dir:
398405
.. option:: --project-dir=DIR
@@ -447,7 +454,35 @@ package, and thus apply globally:
447454
this flag will be ignored if either of the ``--project-dir`` or
448455
``--project-file`` flags are also set.
449456

450-
.. option:: --store-dir=DIR
457+
Environment options
458+
-------------------
459+
460+
.. cfg-field:: offline: boolean
461+
--offline
462+
--no-offline
463+
:synopsis: Disable package downloads from the network.
464+
465+
:default: ``False``
466+
467+
If ``True``, Cabal refuses to download packages from remote repositories.
468+
469+
The command line variant of this field is ``--offline``.
470+
471+
.. cfg-field:: package-env: environment name or filepath
472+
--package-env=ENV
473+
--env=ENV
474+
:synopsis: Package environment file to create or modify.
475+
476+
:default: unset
477+
478+
Set the package environment file that may be modified by
479+
``cabal install --lib``.
480+
481+
The command line variants of this field are ``--package-env=ENV`` and
482+
``--env=ENV``.
483+
484+
.. cfg-field:: store-dir: filepath
485+
--store-dir=DIR
451486

452487
Specifies the name of the directory of the global package store.
453488

@@ -511,16 +546,8 @@ package, and thus apply globally:
511546
The command line variant of this flag is ``--package-db=DB`` which can be
512547
specified multiple times.
513548

514-
.. option:: --build-timings
515-
516-
Log timing information to stdout, in the following format::
517-
518-
[build-timings] configure aeson-2.2.3.0 0.042s
519-
[build-timings] build aeson-2.2.3.0 3.284s
520-
[build-timings] install aeson-2.2.3.0 0.123s
521-
522-
Solver configuration options
523-
----------------------------
549+
Solver options
550+
--------------
524551

525552
The following settings control the behavior of the dependency solver:
526553

@@ -808,8 +835,154 @@ The following settings control the behavior of the dependency solver:
808835

809836
.. _package-configuration-options:
810837

811-
Package configuration options
812-
-----------------------------
838+
Build options
839+
-------------
840+
841+
.. cfg-field:: builddir: directory
842+
--builddir=DIR
843+
844+
Specifies the name of the directory where build products for
845+
build will be stored; defaults to ``dist-newstyle``. If a
846+
relative name is specified, this directory is resolved relative
847+
to the root of the project (i.e., where the ``cabal.project``
848+
file lives.)
849+
850+
This option can only be specified from the command line.
851+
852+
.. cfg-field:: build-info: boolean
853+
--enable-build-info
854+
--disable-build-info
855+
:synopsis: Whether build information for each individual component should be
856+
written in a machine readable format.
857+
858+
:default: ``False``
859+
860+
Enable generation of build information for Cabal components. Contains very
861+
detailed information on how to build an individual component, such as
862+
compiler version, modules of a component and how to compile the component.
863+
864+
The output format is in JSON, and the exact location can be discovered from
865+
``plan.json``, where it is identified by ``build-info`` within the items in
866+
the ``install-plan``.
867+
Note, that this field in ``plan.json`` can be ``null``, if and only if
868+
``build-type: Custom`` is set, and the ``Cabal`` version is too
869+
old (i.e. ``< 3.7``).
870+
If the field is missing entirely, the component is not a local one, thus,
871+
no ``build-info`` exists for that particular component within the
872+
``install-plan``.
873+
874+
.. note::
875+
The format and fields of the generated build information is currently experimental,
876+
in the future we might add or remove fields, depending on the needs of other tooling.
877+
878+
.. cfg-field:: logs-dir: directory
879+
--logs-dir=DIR
880+
:synopsis: Directory to store build logs.
881+
882+
:default: ``~/.cabal/logs``
883+
884+
:strike:`The location where build logs for packages are stored.`
885+
Not implemented yet.
886+
887+
The command line variant of this flag is ``--logs-dir=DIR``.
888+
889+
.. cfg-field:: build-summary: template filepath
890+
--build-summary=TEMPLATE
891+
:synopsis: Build summaries location.
892+
893+
:default: ``~/.cabal/logs/build.log``
894+
895+
:strike:`The file to save build summaries.` Not implemented yet.
896+
897+
Valid variables which can be used in the path are ``$pkgid``,
898+
``$compiler``, ``$os`` and ``$arch``.
899+
900+
The command line variant of this flag is
901+
``--build-summary=TEMPLATE``.
902+
903+
.. cfg-field:: build-log: template filepath
904+
--build-log=TEMPLATE
905+
:synopsis: Build log location template.
906+
907+
:default: unset
908+
909+
Log all builds to file. Valid variables which can be used in the path are
910+
``$pkgid``, ``$compiler``, ``$os`` and ``$arch``.
911+
912+
The command line variant of this flag is ``--build-log=TEMPLATE``.
913+
914+
.. cfg-field:: remote-build-reporting: none, anonymous, or detailed
915+
--remote-build-reporting=LEVEL
916+
:synopsis: Build report level for remote reporting.
917+
918+
:default: ``none``
919+
920+
Generate build reports to send to a remote server.
921+
922+
The command line variant of this flag is
923+
``--remote-build-reporting=LEVEL``.
924+
925+
Install options
926+
---------------
927+
928+
.. cfg-field:: overwrite-policy: always, never, or prompt
929+
--overwrite-policy=POLICY
930+
:synopsis: How to handle existing executable links.
931+
932+
:default: ``never``
933+
934+
Controls what ``cabal install`` does when an executable already exists in
935+
the target installation directory.
936+
937+
The command line variant of this field is
938+
``--overwrite-policy=POLICY``.
939+
940+
.. cfg-field:: install-method: copy or symlink
941+
--install-method=METHOD
942+
:synopsis: How to install executables.
943+
944+
:default: platform dependent
945+
946+
Controls whether executables are installed by copying or by creating
947+
symlinks.
948+
949+
The command line variant of this field is ``--install-method=METHOD``.
950+
951+
.. cfg-field:: installdir: directory
952+
--installdir=DIR
953+
:synopsis: Target directory for installed executables.
954+
955+
:default: platform dependent
956+
957+
Where ``cabal install`` places installed executables (by symlinking or
958+
copying, depending on :cfg-field:`install-method`).
959+
960+
The command line variant of this field is ``--installdir=DIR``.
961+
962+
.. cfg-field:: symlink-bindir: directory
963+
--symlink-bindir=DIR
964+
:synopsis: Add symlinks to installed executables into this directory.
965+
966+
:default: unset
967+
968+
This is a legacy option. Prefer :cfg-field:`installdir` for current
969+
``cabal install`` workflows.
970+
971+
The command line variant of this field is ``--symlink-bindir=DIR``.
972+
973+
.. cfg-field:: lib: boolean
974+
--lib
975+
:synopsis: Install libraries instead of executables.
976+
977+
:default: ``False``
978+
979+
For ``cabal install``, install libraries from target packages (rather than
980+
executable components).
981+
982+
The command line variant of this field is ``--lib``.
983+
984+
Package options
985+
---------------
813986

814987
Package options affect the building of specific packages. There are three
815988
ways a package option can be specified:
@@ -1745,8 +1918,8 @@ built. On the other hand, the following snippet:
17451918

17461919
will apply ``-Werror`` to all packages, local and remote.
17471920

1748-
Advanced global configuration options
1749-
-------------------------------------
1921+
Advanced global options
1922+
-----------------------
17501923

17511924
.. cfg-section:: None
17521925

@@ -1766,32 +1939,6 @@ Advanced global configuration options
17661939
the ``-package-env -`` option that allows ignoring the package
17671940
environment files).
17681941

1769-
.. cfg-field:: build-info: True, False
1770-
--enable-build-info
1771-
--disable-build-info
1772-
:synopsis: Whether build information for each individual component should be
1773-
written in a machine readable format.
1774-
1775-
:default: ``False``
1776-
1777-
Enable generation of build information for Cabal components. Contains very
1778-
detailed information on how to build an individual component, such as
1779-
compiler version, modules of a component and how to compile the component.
1780-
1781-
The output format is in json, and the exact location can be discovered from
1782-
``plan.json``, where it is identified by ``build-info`` within the items in
1783-
the ``install-plan``.
1784-
Note, that this field in ``plan.json`` can be ``null``, if and only if
1785-
``build-type: Custom`` is set, and the ``Cabal`` version is too
1786-
old (i.e. ``< 3.7``).
1787-
If the field is missing entirely, the component is not a local one, thus,
1788-
no ``build-info`` exists for that particular component within the
1789-
``install-plan``.
1790-
1791-
.. note::
1792-
The format and fields of the generated build information is currently experimental,
1793-
in the future we might add or remove fields, depending on the needs of other tooling.
1794-
17951942
.. _cmdoption-http-transport:
17961943
.. cfg-field:: http-transport: curl, wget, powershell, or plain-http
17971944
--http-transport=transport
@@ -1837,34 +1984,6 @@ Advanced global configuration options
18371984
The command line variant of this flag is
18381985
``--remote-repo-cache=DIR``.
18391986

1840-
.. cfg-field:: logs-dir: directory
1841-
--logs-dir=DIR
1842-
:synopsis: Directory to store build logs.
1843-
1844-
:default: ``~/.cabal/logs``
1845-
1846-
:strike:`The location where build logs for packages are stored.`
1847-
Not implemented yet.
1848-
1849-
The command line variant of this flag is ``--logs-dir=DIR``.
1850-
1851-
.. cfg-field:: build-summary: template filepath
1852-
--build-summary=TEMPLATE
1853-
:synopsis: Build summaries location.
1854-
1855-
:default: ``~/.cabal/logs/build.log``
1856-
1857-
:strike:`The file to save build summaries.` Not implemented yet.
1858-
1859-
Valid variables which can be used in the path are ``$pkgid``,
1860-
``$compiler``, ``$os`` and ``$arch``.
1861-
1862-
The command line variant of this flag is
1863-
``--build-summary=TEMPLATE``.
1864-
1865-
Undocumented fields: ``root-cmd``, ``symlink-bindir``, ``build-log``,
1866-
``remote-build-reporting``, ``report-planning-failure``, ``offline``.
1867-
18681987
Advanced solver options
18691988
^^^^^^^^^^^^^^^^^^^^^^^
18701989

@@ -2026,4 +2145,18 @@ Most users generally won't need these.
20262145
The primary use case of picking the oldest package is to help users in
20272146
establishing lower bounds of upstream dependencies.
20282147

2148+
Specialised logging options
2149+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
2150+
2151+
.. cfg-field:: report-planning-failure: boolean
2152+
--report-planning-failure
2153+
:synopsis: Report dependency solving failures.
2154+
2155+
:default: ``False``
2156+
2157+
Generate build reports when the dependency solver fails. This is used by
2158+
the Hackage build bot.
2159+
2160+
The command line variant of this field is ``--report-planning-failure``.
2161+
20292162
.. include:: references.inc

0 commit comments

Comments
 (0)