Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
computePlan
computes a Cabal plan by generating pkg.cabal
and
cabal.project
files with the given dependencies, constraints, flags...,
calling cabal build --dry-run
to compute a build plan, and parsing
the resulting plan.json
file.
fetchPlan
calls cabal unpack
to fetch all packages in the given plan.
buildPlan
builds each unit in the build plan from source,
using buildUnit
. This can be done either asynchronously or sequentially
in dependency order, depending on the BuildStrategy
.
buildPlan
can also be used to output a shell script containing
build instructions, with the Script
BuildStrategy
.
Synopsis
- computePlan :: TempDirPermanence -> Verbosity -> Compiler -> Cabal -> CabalFilesContents -> IO CabalPlanBinary
- fetchPlan :: Verbosity -> Cabal -> FilePath -> CabalPlan -> IO ()
- buildPlan :: Verbosity -> FilePath -> Paths ForPrep -> Paths ForBuild -> BuildStrategy -> Bool -> Maybe [UnitId] -> (ConfiguredUnit -> UnitArgs) -> CabalPlan -> IO ()
- data CabalFilesContents = CabalFilesContents {
- cabalContents :: !Text
- projectContents :: !Text
- cabalFileContentsFromPackages :: UnitSpecs -> Text
- cabalProjectContentsFromPackages :: FilePath -> UnitSpecs -> PkgSpecs -> AllowNewer -> Text
Computing, fetching and building plans
computePlan :: TempDirPermanence -> Verbosity -> Compiler -> Cabal -> CabalFilesContents -> IO CabalPlanBinary Source #
Query cabal
to obtain a build plan for the given packages,
by reading the output plan.json
of a cabal build --dry-run
invocation.
Use cabalFileContentsFromPackages
and cabalProjectContentsFromPackages
to generate the cabal
file contents from a collection of packages with
constraints and flags.
See also parseCabalDotConfigPkgs
and
parseSeedFile
for other ways of obtaining this information.
Use parsePlanBinary
to convert the returned CabalPlanBinary
into
a CabalPlan
.
Fetch the sources of a CabalPlan
, calling cabal get
on each
package and putting it into the correspondingly named and versioned
subfolder of the specified directory (e.g. pkg-name-1.2.3
).
:: Verbosity | |
-> FilePath | Working directory. Used to compute relative paths for local packages, and to choose a logging directory. |
-> Paths ForPrep | |
-> Paths ForBuild | |
-> BuildStrategy | |
-> Bool |
This function will fail if this argument is |
-> Maybe [UnitId] |
|
-> (ConfiguredUnit -> UnitArgs) | Extra arguments for each unit in the build plan. |
-> CabalPlan | Build plan to execute. |
-> IO () |
Build a CabalPlan
. This will install all the packages in the plan
by running their Setup
scripts. Libraries will be registered
into a local package database at installDir/package.conf
.
Generating pkg.cabal
and cabal.project
files.
data CabalFilesContents Source #
The file contents of the Cabal files of a Cabal project:
pkg.cabal
and cabal.project
.
CabalFilesContents | |
|
cabalFileContentsFromPackages :: UnitSpecs -> Text Source #
The contents of a dummy Cabal file with dependencies on the specified units (without any constraints).
cabalProjectContentsFromPackages :: FilePath -> UnitSpecs -> PkgSpecs -> AllowNewer -> Text Source #
The contents of a dummy cabal.project
file, specifying
package constraints, flags and allow-newer.