| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
BuildEnv.Build
Description
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 -> SymbolicPath CWD (Dir Project) -> CabalFilesContents -> IO CabalPlanBinary
- fetchPlan :: Verbosity -> Cabal -> SymbolicPath CWD (Dir Project) -> Maybe IndexState -> SymbolicPath Project (Dir Fetch) -> CabalPlan -> IO ()
- buildPlan :: Verbosity -> SymbolicPath CWD (Dir Project) -> Paths ForPrep -> Paths ForBuild -> Maybe (SymbolicPath Project (Dir Logs)) -> BuildStrategy -> Bool -> Maybe [UnitId] -> (ConfiguredUnit -> UnitArgs) -> CabalPlan -> IO ()
- data CabalFilesContents = CabalFilesContents {
- cabalContents :: !Text
- projectContents :: !Text
- cabalFileContentsFromPackages :: UnitSpecs -> Text
- cabalProjectContentsFromPackages :: SymbolicPath CWD (Dir Project) -> UnitSpecs -> PkgSpecs -> AllowNewer -> Maybe IndexState -> IO Text
Computing, fetching and building plans
computePlan :: TempDirPermanence -> Verbosity -> Compiler -> Cabal -> SymbolicPath CWD (Dir Project) -> 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.
Arguments
| :: Verbosity | |
| -> Cabal | |
| -> SymbolicPath CWD (Dir Project) | |
| -> Maybe IndexState | |
| -> SymbolicPath Project (Dir Fetch) | Directory in which to put the sources. |
| -> CabalPlan | |
| -> IO () |
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).
Arguments
| :: Verbosity | |
| -> SymbolicPath CWD (Dir Project) | Working directory. Used to compute relative paths for local packages, and to choose a logging directory. |
| -> Paths ForPrep | |
| -> Paths ForBuild | |
| -> Maybe (SymbolicPath Project (Dir Logs)) | event log directory |
| -> 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.
Constructors
| CabalFilesContents | |
Fields
| |
cabalFileContentsFromPackages :: UnitSpecs -> Text Source #
The contents of a dummy Cabal file with dependencies on the specified units (without any constraints).
cabalProjectContentsFromPackages :: SymbolicPath CWD (Dir Project) -> UnitSpecs -> PkgSpecs -> AllowNewer -> Maybe IndexState -> IO Text Source #
The contents of a dummy cabal.project file, specifying
package constraints, flags and allow-newer.