stack
LicenseBSD-3-Clause
Safe HaskellNone
LanguageGHC2024

Stack.Package

Description

Dealing with Cabal.

Synopsis

Documentation

readDotBuildinfo :: MonadIO m => Path Abs File -> m HookedBuildInfo Source #

Read package.buildinfo ancillary files produced by some Setup.hs hooks. The file includes Cabal file syntax to be merged into the package description derived from the package's Cabal file.

NOTE: not to be confused with BuildInfo, an Stack-internal datatype.

resolvePackage :: PackageConfig -> GenericPackageDescription -> Package Source #

Resolve a parsed Cabal file into a Package, which contains all of the info needed for Stack to build the Package given the current configuration.

data Package Source #

Some package info.

Constructors

Package 

Fields

Instances

Instances details
Show Package Source # 
Instance details

Defined in Stack.Types.Package

Eq Package Source #

Compares the package name.

Instance details

Defined in Stack.Types.Package

Methods

(==) :: Package -> Package -> Bool #

(/=) :: Package -> Package -> Bool #

Ord Package Source #

Compares the package name.

Instance details

Defined in Stack.Types.Package

data PackageConfig Source #

Package build configuration

Constructors

PackageConfig 

Fields

Instances

Instances details
Show PackageConfig Source # 
Instance details

Defined in Stack.Types.Package

buildLogPath :: (MonadReader env m, HasBuildConfig env, MonadThrow m) => Package -> Maybe String -> m (Path Abs File) Source #

Path for the package's build log.

packageDependencies :: PackageDescription -> Map PackageName VersionRange Source #

Get all dependencies of the package (buildable targets only).

hasBuildableMainLibrary :: Package -> Bool Source #

Check if the package has a main library that is buildable.

packageUnknownTools :: Package -> Set Text Source #

Aggregate all unknown tools from all components. Mostly meant for build tools specified in the legacy manner (build-tools:) that failed the hard-coded lookup. See unknownTools for more information.

getPackageOpts :: (HasEnvConfig env, MonadReader env m, MonadThrow m, MonadUnliftIO m) => Package -> InstallMap -> InstalledMap -> [PackageName] -> [PackageName] -> Path Abs File -> m (Map NamedComponent (Map ModuleName (Path Abs File)), Map NamedComponent [DotCabalPath], Map NamedComponent BuildInfoOpts) Source #

This is an action used to collect info needed for "stack ghci". This info isn't usually needed, so computation of it is deferred.

processPackageDepsEither :: (Monad m, Monoid a, Monoid b) => Package -> (PackageName -> DepValue -> m (Either a b)) -> m (Either a b) Source #

Iterate/fold on all the package dependencies, components, setup deps and all.

listOfPackageDeps :: Package -> [PackageName] Source #

List all package's dependencies in a "free" context through the identity monad.

setOfPackageDeps :: Package -> Set PackageName Source #

The set of package's dependencies.

topSortPackageComponent Source #

Arguments

:: Package 
-> Target 
-> Bool

Include directTarget or not. False here means we won't include the actual targets in the result, only their deps. Using it with False here only in GHCi

-> Seq NamedComponent 

This implements a topological sort on all targeted components for the build and their dependencies. It's only targeting internal dependencies, so it's doing a topological sort on a subset of a package's components.

Note that in Cabal they use the Data.Graph struct to pursue the same goal. But dong this here would require a large number intermediate data structure. This is needed because we need to get the right GhcPkgId of the relevant internal dependencies of a component before building it as a component.