Commit d4f80a50 authored by Duncan Coutts's avatar Duncan Coutts

Add documentation for 'all-packages'

In the user guide, changelog and add a few code comments.
parent 32ff1cac
...@@ -861,7 +861,7 @@ The following settings control the behavior of the dependency solver: ...@@ -861,7 +861,7 @@ The following settings control the behavior of the dependency solver:
Package configuration options Package configuration options
----------------------------- -----------------------------
Package options affect the building of specific packages. There are two Package options affect the building of specific packages. There are three
ways a package option can be specified: ways a package option can be specified:
- They can be specified at the top-level, in which case they apply only - They can be specified at the top-level, in which case they apply only
...@@ -871,6 +871,11 @@ ways a package option can be specified: ...@@ -871,6 +871,11 @@ ways a package option can be specified:
apply to the build of the package, whether or not it is local or apply to the build of the package, whether or not it is local or
external. external.
- They can be specified inside an ``all-packages`` stanza, in which case they
apply to all packages, local ones from the project and also external
dependencies.
For example, the following options specify that :cfg-field:`optimization` For example, the following options specify that :cfg-field:`optimization`
should be turned off for all local packages, and that ``bytestring`` (possibly should be turned off for all local packages, and that ``bytestring`` (possibly
an external dependency) should be built with ``-fno-state-hack``:: an external dependency) should be built with ``-fno-state-hack``::
......
...@@ -1083,6 +1083,9 @@ packageRepoSectionDescr = ...@@ -1083,6 +1083,9 @@ packageRepoSectionDescr =
} }
} }
-- | The definitions of all the fields that can appear in the @package pkgfoo@
-- and @all-packages@ sections of the @cabal.project@-format files.
--
packageSpecificOptionsFieldDescrs :: [FieldDescr LegacyPackageConfig] packageSpecificOptionsFieldDescrs :: [FieldDescr LegacyPackageConfig]
packageSpecificOptionsFieldDescrs = packageSpecificOptionsFieldDescrs =
legacyPackageConfigFieldDescrs legacyPackageConfigFieldDescrs
...@@ -1102,6 +1105,10 @@ packageSpecificOptionsFieldDescrs = ...@@ -1102,6 +1105,10 @@ packageSpecificOptionsFieldDescrs =
) )
programLocationsFieldDescrs programLocationsFieldDescrs
-- | The definition of the @all-packages@ sections of the
-- @cabal.project@-format files. This is the one that applies to all packages
-- used anywhere by the project, locally or as dependencies.
--
allPackagesOptionsSectionDescr :: SectionDescr LegacyProjectConfig allPackagesOptionsSectionDescr :: SectionDescr LegacyProjectConfig
allPackagesOptionsSectionDescr = allPackagesOptionsSectionDescr =
SectionDescr { SectionDescr {
...@@ -1120,6 +1127,9 @@ allPackagesOptionsSectionDescr = ...@@ -1120,6 +1127,9 @@ allPackagesOptionsSectionDescr =
sectionEmpty = mempty sectionEmpty = mempty
} }
-- | The definition of the @package pkgfoo@ sections of the @cabal.project@-format
-- files. This section is per-package name.
--
packageSpecificOptionsSectionDescr :: SectionDescr LegacyProjectConfig packageSpecificOptionsSectionDescr :: SectionDescr LegacyProjectConfig
packageSpecificOptionsSectionDescr = packageSpecificOptionsSectionDescr =
SectionDescr { SectionDescr {
......
...@@ -1763,6 +1763,9 @@ elaborateInstallPlan verbosity platform compiler compilerprogdb pkgConfigDB ...@@ -1763,6 +1763,9 @@ elaborateInstallPlan verbosity platform compiler compilerprogdb pkgConfigDB
lookupPerPkgOption :: (Package pkg, Monoid m) lookupPerPkgOption :: (Package pkg, Monoid m)
=> pkg -> (PackageConfig -> m) -> m => pkg -> (PackageConfig -> m) -> m
lookupPerPkgOption pkg f = lookupPerPkgOption pkg f =
-- This is where we merge the options from the project config that
-- apply to all packages, all project local packages, and to specific
-- named packages
global `mappend` local `mappend` perpkg global `mappend` local `mappend` perpkg
where where
global = f allPackagesConfig global = f allPackagesConfig
......
...@@ -46,6 +46,8 @@ ...@@ -46,6 +46,8 @@
* Added support for '--enable-tests' and '--enable-benchmarks' to * Added support for '--enable-tests' and '--enable-benchmarks' to
'cabal fetch' (#4948). 'cabal fetch' (#4948).
* Removed support for building cabal-install with GHC < 7.10. * Removed support for building cabal-install with GHC < 7.10.
* New 'all-packages' section in 'cabal.project' files that applies
options to all packages, not just those local to the project.
2.0.0.1 Mikhail Glushenkov <mikhail.glushenkov@gmail.com> December 2017 2.0.0.1 Mikhail Glushenkov <mikhail.glushenkov@gmail.com> December 2017
* Support for GHC's numeric -g debug levels (#4673). * Support for GHC's numeric -g debug levels (#4673).
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment