Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Setup.hs script policy
Handling for Setup.hs scripts is a bit tricky, part of it lives in the solver phase, and part in the elaboration phase. We keep the helper functions for both phases together here so at least you can see all of it in one place.
There are four major cases for Setup.hs handling:
build-type
Custom with acustom-setup
sectionbuild-type
Custom without acustom-setup
sectionbuild-type
not Custom withcabal-version > $our-cabal-version
build-type
not Custom withcabal-version <= $our-cabal-version
It's also worth noting that packages specifying cabal-version: >= 1.23
or later that have build-type
Custom will always have a custom-setup
section. Therefore in case 2, the specified cabal-version
will always be
less than 1.23.
In cases 1 and 2 we obviously have to build an external Setup.hs script, while in case 4 we can use the internal library API.
Since: 3.12.0.0
Synopsis
- mkDefaultSetupDeps :: Compiler -> Platform -> PackageDescription -> Maybe [Dependency]
- packageSetupScriptStyle :: PackageDescription -> SetupScriptStyle
- packageSetupScriptSpecVersion :: SetupScriptStyle -> PackageDescription -> Graph NonSetupLibDepSolverPlanPackage -> ComponentDeps [SolverId] -> Version
- newtype NonSetupLibDepSolverPlanPackage = NonSetupLibDepSolverPlanPackage {}
Documentation
mkDefaultSetupDeps :: Compiler -> Platform -> PackageDescription -> Maybe [Dependency] Source #
Part of our Setup.hs handling policy is implemented by getting the solver
to work out setup dependencies for packages. The solver already handles
packages that explicitly specify setup dependencies, but we can also tell
the solver to treat other packages as if they had setup dependencies.
That's what this function does, it gets called by planPackages
for all
packages that don't already have setup dependencies.
The dependencies we want to add is different for each SetupScriptStyle
.
Note in addition to adding setup dependencies, we also use
addSetupCabalMinVersionConstraint
(in planPackages
) to require
Cabal >= 1.20
for Setup scripts.
Since: 3.12.0.0
packageSetupScriptStyle :: PackageDescription -> SetupScriptStyle Source #
Work out the SetupScriptStyle
given the package description.
Since: 3.12.0.0
packageSetupScriptSpecVersion :: SetupScriptStyle -> PackageDescription -> Graph NonSetupLibDepSolverPlanPackage -> ComponentDeps [SolverId] -> Version Source #
Work out which version of the Cabal we will be using to talk to the Setup.hs interface for this package.
This depends somewhat on the SetupScriptStyle
but most cases are a result
of what the solver picked for us, based on the explicit setup deps or the
ones added implicitly by mkDefaultSetupDeps
.
Since: 3.12.0.0
newtype NonSetupLibDepSolverPlanPackage Source #
A newtype for SolverPlanPackage
for which the
dependency graph considers only dependencies on libraries which are
NOT from setup dependencies. Used to compute the set
of packages needed for profiling and dynamic libraries.
Since: 3.12.0.0