stack-1.9.3: The Haskell Tool Stack

Safe HaskellNone
LanguageHaskell2010

Stack.Package

Description

Dealing with Cabal.

Synopsis

Documentation

readPackageDir #

Arguments

:: HasConfig env 
=> PackageConfig 
-> Path Abs Dir 
-> Bool

print warnings from cabal file parsing?

-> RIO env (Package, Path Abs File) 

Reads and exposes the package information

readPackageUnresolvedDir #

Arguments

:: HasConfig env 
=> Path Abs Dir

directory holding the cabal file

-> Bool

print warnings?

-> RIO env (GenericPackageDescription, Path Abs File) 

Read the raw, unresolved package information from a file.

readPackageDescriptionDir #

Arguments

:: HasConfig env 
=> PackageConfig 
-> Path Abs Dir 
-> Bool

print warnings?

-> RIO env (GenericPackageDescription, PackageDescriptionPair) 

Get GenericPackageDescription and PackageDescription reading info from given directory.

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

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 #

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 #

Some package info.

Constructors

Package 

Fields

Instances
Eq Package #

Compares the package name.

Instance details

Defined in Stack.Types.Package

Methods

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

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

Ord Package #

Compares the package name.

Instance details

Defined in Stack.Types.Package

Show Package # 
Instance details

Defined in Stack.Types.Package

data PackageDescriptionPair #

A pair of package descriptions: one which modified the buildable values of test suites and benchmarks depending on whether they are enabled, and one which does not.

Fields are intentionally lazy, we may only need one or the other value.

MSS 2017-08-29: The very presence of this data type is terribly ugly, it represents the fact that the Cabal 2.0 upgrade did _not_ go well. Specifically, we used to have a field to indicate whether a component was enabled in addition to buildable, but that's gone now, and this is an ugly proxy. We should at some point clean up the mess of Package, LocalPackage, etc, and probably pull in the definition of PackageDescription from Cabal with our additionally needed metadata. But this is a good enough hack for the moment. Odds are, you're reading this in the year 2024 and thinking "wtf?"

newtype GetPackageFiles #

Files that the package depends on, relative to package directory. Argument is the location of the .cabal file

newtype GetPackageOpts #

Files that the package depends on, relative to package directory. Argument is the location of the .cabal file

Instances
Show GetPackageOpts # 
Instance details

Defined in Stack.Types.Package

data PackageConfig #

Package build configuration

Constructors

PackageConfig 

Fields

Instances
Show PackageConfig # 
Instance details

Defined in Stack.Types.Package

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

Path for the package's build log.

packageDependencies :: PackageConfig -> PackageDescription -> Map PackageName VersionRange #

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

Note that for Cabal versions 1.22 and earlier, there is a bug where Cabal requires dependencies for non-buildable components to be present. We're going to use GHC version as a proxy for Cabal library version in this case for simplicity, so we'll check for GHC being 7.10 or earlier. This obviously makes our function a lot more fun to write...

cabalFilePackageId :: (MonadIO m, MonadThrow m) => Path Abs File -> m PackageIdentifier #

Extract the PackageIdentifier given an exploded haskell package path.