Distribution.Types.LocalBuildInfo

Cabal-2.2.0.1: A framework for packaging Haskell software

Safe Haskell | None
Language | Haskell2010

Distribution.Types.LocalBuildInfo

Contents

- The type
- Convenience accessors
- Build targets of the `LocalBuildInfo`.
- Functions you SHOULD NOT USE (yet), but are defined here to
- Backwards compatibility.

Synopsis

- data LocalBuildInfo = LocalBuildInfo {
  - configFlags :: ConfigFlags
  - flagAssignment :: FlagAssignment
  - componentEnabledSpec :: ComponentRequestedSpec
  - extraConfigArgs :: [String]
  - installDirTemplates :: InstallDirTemplates
  - compiler :: Compiler
  - hostPlatform :: Platform
  - buildDir :: FilePath
  - cabalFilePath :: Maybe FilePath
  - componentGraph :: Graph ComponentLocalBuildInfo
  - componentNameMap :: Map ComponentName [ComponentLocalBuildInfo]
  - installedPkgs :: InstalledPackageIndex
  - pkgDescrFile :: Maybe FilePath
  - localPkgDescr :: PackageDescription
  - withPrograms :: ProgramDb
  - withPackageDB :: PackageDBStack
  - withVanillaLib :: Bool
  - withProfLib :: Bool
  - withSharedLib :: Bool
  - withStaticLib :: Bool
  - withDynExe :: Bool
  - withProfExe :: Bool
  - withProfLibDetail :: ProfDetailLevel
  - withProfExeDetail :: ProfDetailLevel
  - withOptimization :: OptimisationLevel
  - withDebugInfo :: DebugInfoLevel
  - withGHCiLib :: Bool
  - splitSections :: Bool
  - splitObjs :: Bool
  - stripExes :: Bool
  - stripLibs :: Bool
  - exeCoverage :: Bool
  - libCoverage :: Bool
  - progPrefix :: PathTemplate
  - progSuffix :: PathTemplate
  - relocatable :: Bool
  }
- localComponentId :: LocalBuildInfo -> ComponentId
- localUnitId :: LocalBuildInfo -> UnitId
- localCompatPackageKey :: LocalBuildInfo -> String
- localPackage :: LocalBuildInfo -> PackageId
- componentNameCLBIs :: LocalBuildInfo -> ComponentName -> [ComponentLocalBuildInfo]
- componentNameTargets' :: PackageDescription -> LocalBuildInfo -> ComponentName -> [TargetInfo]
- unitIdTarget' :: PackageDescription -> LocalBuildInfo -> UnitId -> Maybe TargetInfo
- allTargetsInBuildOrder' :: PackageDescription -> LocalBuildInfo -> [TargetInfo]
- withAllTargetsInBuildOrder' :: PackageDescription -> LocalBuildInfo -> (TargetInfo -> IO ()) -> IO ()
- neededTargetsInBuildOrder' :: PackageDescription -> LocalBuildInfo -> [UnitId] -> [TargetInfo]
- withNeededTargetsInBuildOrder' :: PackageDescription -> LocalBuildInfo -> [UnitId] -> (TargetInfo -> IO ()) -> IO ()
- testCoverage :: LocalBuildInfo -> Bool
- componentNameTargets :: LocalBuildInfo -> ComponentName -> [TargetInfo]
- unitIdTarget :: LocalBuildInfo -> UnitId -> Maybe TargetInfo
- allTargetsInBuildOrder :: LocalBuildInfo -> [TargetInfo]
- withAllTargetsInBuildOrder :: LocalBuildInfo -> (TargetInfo -> IO ()) -> IO ()
- neededTargetsInBuildOrder :: LocalBuildInfo -> [UnitId] -> [TargetInfo]
- withNeededTargetsInBuildOrder :: LocalBuildInfo -> [UnitId] -> (TargetInfo -> IO ()) -> IO ()
- componentsConfigs :: LocalBuildInfo -> [(ComponentName, ComponentLocalBuildInfo, [ComponentName])]
- externalPackageDeps :: LocalBuildInfo -> [(UnitId, MungedPackageId)]

# The type

data LocalBuildInfo #

Data cached after configuration step. See also `ConfigFlags`.

Constructors

LocalBuildInfo |
Fields configFlags :: ConfigFlags Options passed to the configuration step. Needed to re-run configuration when .cabal is out of date flagAssignment :: FlagAssignment The final set of flags which were picked for this package componentEnabledSpec :: ComponentRequestedSpec What components were enabled during configuration, and why. extraConfigArgs :: [String] Extra args on the command line for the configuration step. Needed to re-run configuration when .cabal is out of date installDirTemplates :: InstallDirTemplates The installation directories for the various different kinds of files TODO: inplaceDirTemplates :: InstallDirs FilePath compiler :: Compiler The compiler we're building with hostPlatform :: Platform The platform we're building for buildDir :: FilePath Where to build the package. cabalFilePath :: Maybe FilePath Path to the cabal file, if given during configuration. componentGraph :: Graph ComponentLocalBuildInfo All the components to build, ordered by topological sort, and with their INTERNAL dependencies over the intrapackage dependency graph. TODO: this is assumed to be short; otherwise we want some sort of ordered map. componentNameMap :: Map ComponentName [ComponentLocalBuildInfo] A map from component name to all matching components. These coincide with `componentGraph` installedPkgs :: InstalledPackageIndex All the info about the installed packages that the current package depends on (directly or indirectly). The copy saved on disk does NOT include internal dependencies (because we just don't have enough information at this point to have an `InstalledPackageInfo` for an internal dep), but we will often update it with the internal dependencies; see for example `build`. (This admonition doesn't apply for per-component builds.) pkgDescrFile :: Maybe FilePath the filename containing the .cabal file, if available localPkgDescr :: PackageDescription WARNING WARNING WARNING Be VERY careful about using this function; we haven't deprecated it but using it could introduce subtle bugs related to `HookedBuildInfo`. In principle, this is supposed to contain the resolved package description, that does not contain any conditionals. However, it MAY NOT contain the description wtih a `HookedBuildInfo` applied to it; see `HookedBuildInfo` for the whole sordid saga. As much as possible, Cabal library should avoid using this parameter. withPrograms :: ProgramDb Location and args for all programs withPackageDB :: PackageDBStack What package database to use, global/user withVanillaLib :: Bool Whether to build normal libs. withProfLib :: Bool Whether to build profiling versions of libs. withSharedLib :: Bool Whether to build shared versions of libs. withStaticLib :: Bool Whether to build static versions of libs (with all other libs rolled in) withDynExe :: Bool Whether to link executables dynamically withProfExe :: Bool Whether to build executables for profiling. withProfLibDetail :: ProfDetailLevel Level of automatic profile detail. withProfExeDetail :: ProfDetailLevel Level of automatic profile detail. withOptimization :: OptimisationLevel Whether to build with optimization (if available). withDebugInfo :: DebugInfoLevel Whether to emit debug info (if available). withGHCiLib :: Bool Whether to build libs suitable for use with GHCi. splitSections :: Bool Use -split-sections with GHC, if available splitObjs :: Bool Use -split-objs with GHC, if available stripExes :: Bool Whether to strip executables during install stripLibs :: Bool Whether to strip libraries during install exeCoverage :: Bool Whether to enable executable program coverage libCoverage :: Bool Whether to enable library program coverage progPrefix :: PathTemplate Prefix to be prepended to installed executables progSuffix :: PathTemplate Suffix to be appended to installed executables relocatable :: Bool

Instances

Read LocalBuildInfo # |
Instance details Defined in Distribution.Types.LocalBuildInfo Methods readsPrec :: Int -> ReadS LocalBuildInfo Source # readList :: ReadS [LocalBuildInfo] Source # readPrec :: ReadPrec LocalBuildInfo Source # readListPrec :: ReadPrec [LocalBuildInfo] Source #
Show LocalBuildInfo # |
Instance details Defined in Distribution.Types.LocalBuildInfo Methods showsPrec :: Int -> LocalBuildInfo -> ShowS Source # show :: LocalBuildInfo -> String Source # showList :: [LocalBuildInfo] -> ShowS Source #
Generic LocalBuildInfo # |
Instance details Defined in Distribution.Types.LocalBuildInfo Associated Types type Rep LocalBuildInfo :: * -> * Source # Methods from :: LocalBuildInfo -> Rep LocalBuildInfo x Source # to :: Rep LocalBuildInfo x -> LocalBuildInfo Source #
Binary LocalBuildInfo # |
Instance details Defined in Distribution.Types.LocalBuildInfo Methods put :: LocalBuildInfo -> Put Source # get :: Get LocalBuildInfo Source # putList :: [LocalBuildInfo] -> Put Source #
type Rep LocalBuildInfo # |
Instance details Defined in Distribution.Types.LocalBuildInfo type Rep LocalBuildInfo = D1 (MetaData "LocalBuildInfo" "Distribution.Types.LocalBuildInfo" "Cabal-2.2.0.1" False) (C1 (MetaCons "LocalBuildInfo" PrefixI True) (((((S1 (MetaSel (Just "configFlags") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ConfigFlags) :*: S1 (MetaSel (Just "flagAssignment") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 FlagAssignment)) :*: (S1 (MetaSel (Just "componentEnabledSpec") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ComponentRequestedSpec) :*: S1 (MetaSel (Just "extraConfigArgs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [String]))) :*: ((S1 (MetaSel (Just "installDirTemplates") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 InstallDirTemplates) :*: S1 (MetaSel (Just "compiler") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Compiler)) :*: (S1 (MetaSel (Just "hostPlatform") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Platform) :*: (S1 (MetaSel (Just "buildDir") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 FilePath) :*: S1 (MetaSel (Just "cabalFilePath") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe FilePath)))))) :*: (((S1 (MetaSel (Just "componentGraph") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Graph ComponentLocalBuildInfo)) :*: S1 (MetaSel (Just "componentNameMap") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Map ComponentName [ComponentLocalBuildInfo]))) :*: (S1 (MetaSel (Just "installedPkgs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 InstalledPackageIndex) :*: S1 (MetaSel (Just "pkgDescrFile") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe FilePath)))) :*: ((S1 (MetaSel (Just "localPkgDescr") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 PackageDescription) :*: S1 (MetaSel (Just "withPrograms") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ProgramDb)) :*: (S1 (MetaSel (Just "withPackageDB") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 PackageDBStack) :*: (S1 (MetaSel (Just "withVanillaLib") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool) :*: S1 (MetaSel (Just "withProfLib") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)))))) :*: ((((S1 (MetaSel (Just "withSharedLib") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool) :*: S1 (MetaSel (Just "withStaticLib") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)) :*: (S1 (MetaSel (Just "withDynExe") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool) :*: S1 (MetaSel (Just "withProfExe") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool))) :*: ((S1 (MetaSel (Just "withProfLibDetail") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ProfDetailLevel) :*: S1 (MetaSel (Just "withProfExeDetail") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ProfDetailLevel)) :*: (S1 (MetaSel (Just "withOptimization") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 OptimisationLevel) :*: (S1 (MetaSel (Just "withDebugInfo") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 DebugInfoLevel) :*: S1 (MetaSel (Just "withGHCiLib") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool))))) :*: (((S1 (MetaSel (Just "splitSections") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool) :*: S1 (MetaSel (Just "splitObjs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)) :*: (S1 (MetaSel (Just "stripExes") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool) :*: S1 (MetaSel (Just "stripLibs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool))) :*: ((S1 (MetaSel (Just "exeCoverage") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool) :*: S1 (MetaSel (Just "libCoverage") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)) :*: (S1 (MetaSel (Just "progPrefix") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 PathTemplate) :*: (S1 (MetaSel (Just "progSuffix") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 PathTemplate) :*: S1 (MetaSel (Just "relocatable") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool))))))))

# Convenience accessors

localComponentId :: LocalBuildInfo -> ComponentId #

Extract the `ComponentId` from the public library component of a `LocalBuildInfo` if it exists, or make a fake component ID based on the package ID.

localUnitId :: LocalBuildInfo -> UnitId #

Extract the `UnitId` from the library component of a `LocalBuildInfo` if it exists, or make a fake unit ID based on the package ID.

localCompatPackageKey :: LocalBuildInfo -> String #

Extract the compatibility package key from the public library component of a `LocalBuildInfo` if it exists, or make a fake package key based on the package ID.

localPackage :: LocalBuildInfo -> PackageId #

Extract the `PackageIdentifier` of a `LocalBuildInfo`. This is a "safe" use of `localPkgDescr`

# Build targets of the `LocalBuildInfo`.

componentNameCLBIs :: LocalBuildInfo -> ComponentName -> [ComponentLocalBuildInfo] #

Return all `ComponentLocalBuildInfo`s associated with `ComponentName`. In the presence of Backpack there may be more than one!

componentNameTargets' :: PackageDescription -> LocalBuildInfo -> ComponentName -> [TargetInfo] #

Return all `TargetInfo`s associated with `ComponentName`. In the presence of Backpack there may be more than one! Has a prime because it takes a `PackageDescription` argument which may disagree with `localPkgDescr` in `LocalBuildInfo`.

unitIdTarget' :: PackageDescription -> LocalBuildInfo -> UnitId -> Maybe TargetInfo #

allTargetsInBuildOrder' :: PackageDescription -> LocalBuildInfo -> [TargetInfo] #

Return the list of default `TargetInfo`s associated with a configured package, in the order they need to be built. Has a prime because it takes a `PackageDescription` argument which may disagree with `localPkgDescr` in `LocalBuildInfo`.

withAllTargetsInBuildOrder' :: PackageDescription -> LocalBuildInfo -> (TargetInfo -> IO ()) -> IO () #

Execute `f` for every `TargetInfo` in the package, respecting the build dependency order. (TODO: We should use Shake!) Has a prime because it takes a `PackageDescription` argument which may disagree with `localPkgDescr` in `LocalBuildInfo`.

neededTargetsInBuildOrder' :: PackageDescription -> LocalBuildInfo -> [UnitId] -> [TargetInfo] #

Return the list of all targets needed to build the `uids`, in the order they need to be built. Has a prime because it takes a `PackageDescription` argument which may disagree with `localPkgDescr` in `LocalBuildInfo`.

withNeededTargetsInBuildOrder' :: PackageDescription -> LocalBuildInfo -> [UnitId] -> (TargetInfo -> IO ()) -> IO () #

Execute `f` for every `TargetInfo` needed to build `uid`s, respecting the build dependency order. Has a prime because it takes a `PackageDescription` argument which may disagree with `localPkgDescr` in `LocalBuildInfo`.

testCoverage :: LocalBuildInfo -> Bool #

Is coverage enabled for test suites? In practice, this requires library and executable profiling to be enabled.

# Functions you SHOULD NOT USE (yet), but are defined here to

componentNameTargets :: LocalBuildInfo -> ComponentName -> [TargetInfo] #

Warning: By using this function, you may be introducing a bug where you retrieve a `Component` which does not have `HookedBuildInfo` applied to it. See the documentation for `HookedBuildInfo` for an explanation of the issue. If you have a `PakcageDescription` handy (NOT from the `LocalBuildInfo`), try using the primed version of the function, which takes it as an extra argument.

unitIdTarget :: LocalBuildInfo -> UnitId -> Maybe TargetInfo #

Warning: By using this function, you may be introducing a bug where you retrieve a `Component` which does not have `HookedBuildInfo` applied to it. See the documentation for `HookedBuildInfo` for an explanation of the issue. If you have a `PakcageDescription` handy (NOT from the `LocalBuildInfo`), try using the primed version of the function, which takes it as an extra argument.

allTargetsInBuildOrder :: LocalBuildInfo -> [TargetInfo] #

Warning: By using this function, you may be introducing a bug where you retrieve a `Component` which does not have `HookedBuildInfo` applied to it. See the documentation for `HookedBuildInfo` for an explanation of the issue. If you have a `PakcageDescription` handy (NOT from the `LocalBuildInfo`), try using the primed version of the function, which takes it as an extra argument.

withAllTargetsInBuildOrder :: LocalBuildInfo -> (TargetInfo -> IO ()) -> IO () #

Warning: By using this function, you may be introducing a bug where you retrieve a `Component` which does not have `HookedBuildInfo` applied to it. See the documentation for `HookedBuildInfo` for an explanation of the issue. If you have a `PakcageDescription` handy (NOT from the `LocalBuildInfo`), try using the primed version of the function, which takes it as an extra argument.

neededTargetsInBuildOrder :: LocalBuildInfo -> [UnitId] -> [TargetInfo] #

Warning: By using this function, you may be introducing a bug where you retrieve a `Component` which does not have `HookedBuildInfo` applied to it. See the documentation for `HookedBuildInfo` for an explanation of the issue. If you have a `PakcageDescription` handy (NOT from the `LocalBuildInfo`), try using the primed version of the function, which takes it as an extra argument.

withNeededTargetsInBuildOrder :: LocalBuildInfo -> [UnitId] -> (TargetInfo -> IO ()) -> IO () #

Warning: By using this function, you may be introducing a bug where you retrieve a `Component` which does not have `HookedBuildInfo` applied to it. See the documentation for `HookedBuildInfo` for an explanation of the issue. If you have a `PakcageDescription` handy (NOT from the `LocalBuildInfo`), try using the primed version of the function, which takes it as an extra argument.

# Backwards compatibility.

componentsConfigs :: LocalBuildInfo -> [(ComponentName, ComponentLocalBuildInfo, [ComponentName])] #

Deprecated: Use `componentGraph` instead; you can get a list of `ComponentLocalBuildInfo` with `toList`. There's not a good way to get the list of `ComponentName`s the `ComponentLocalBuildInfo` depends on because this query doesn't make sense; the graph is indexed by `UnitId` not `ComponentName`. Given a `UnitId` you can lookup the `ComponentLocalBuildInfo` (`getCLBI`) and then get the `ComponentName` ('componentLocalName]). To be removed in Cabal 3.0

externalPackageDeps :: LocalBuildInfo -> [(UnitId, MungedPackageId)] #

Deprecated: You almost certainly don't want this function, which agglomerates the dependencies of ALL enabled components. If you're using this to write out information on your dependencies, read off the dependencies directly from the actual component in question. To be removed in Cabal 3.0

External package dependencies for the package as a whole. This is the union of the individual `componentPackageDeps`, less any internal deps.