| License | BSD-3-Clause |
|---|---|
| Safe Haskell | None |
| Language | GHC2024 |
Stack.Package
Description
Dealing with Cabal.
Synopsis
- readDotBuildinfo :: MonadIO m => Path Abs File -> m HookedBuildInfo
- resolvePackage :: PackageConfig -> GenericPackageDescription -> Package
- packageFromPackageDescription :: PackageConfig -> [PackageFlag] -> PackageDescription -> Package
- data Package = Package {
- name :: !PackageName
- version :: !Version
- license :: !(Either License License)
- ghcOptions :: ![Text]
- cabalConfigOpts :: ![Text]
- flags :: !(Map FlagName Bool)
- defaultFlags :: !(Map FlagName Bool)
- library :: !(Maybe StackLibrary)
- subLibraries :: !(CompCollection StackLibrary)
- foreignLibraries :: !(CompCollection StackForeignLibrary)
- testSuites :: !(CompCollection StackTestSuite)
- benchmarks :: !(CompCollection StackBenchmark)
- executables :: !(CompCollection StackExecutable)
- buildType :: !BuildType
- setupDeps :: !(Maybe (Map PackageName DepValue))
- cabalSpec :: !CabalSpecVersion
- file :: StackPackageFile
- testEnabled :: Bool
- benchmarkEnabled :: Bool
- data PackageConfig = PackageConfig {
- enableTests :: !Bool
- enableBenchmarks :: !Bool
- flags :: !(Map FlagName Bool)
- ghcOptions :: ![Text]
- cabalConfigOpts :: ![Text]
- compilerVersion :: ActualCompiler
- platform :: !Platform
- buildLogPath :: (MonadReader env m, HasBuildConfig env, MonadThrow m) => Package -> Maybe String -> m (Path Abs File)
- data PackageException
- resolvePackageDescription :: PackageConfig -> GenericPackageDescription -> PackageDescription
- packageDependencies :: PackageDescription -> Map PackageName VersionRange
- applyForceCustomBuild :: Version -> Package -> Package
- hasBuildableMainLibrary :: Package -> Bool
- packageUnknownTools :: Package -> Set Text
- buildableForeignLibs :: Package -> Set StackUnqualCompName
- buildableSubLibs :: Package -> Set StackUnqualCompName
- buildableExes :: Package -> Set StackUnqualCompName
- buildableTestSuites :: Package -> Set StackUnqualCompName
- buildableBenchmarks :: Package -> Set StackUnqualCompName
- 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)
- processPackageDepsEither :: (Monad m, Monoid a, Monoid b) => Package -> (PackageName -> DepValue -> m (Either a b)) -> m (Either a b)
- listOfPackageDeps :: Package -> [PackageName]
- setOfPackageDeps :: Package -> Set PackageName
- topSortPackageComponent :: Package -> Target -> Bool -> Seq NamedComponent
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.
packageFromPackageDescription :: PackageConfig -> [PackageFlag] -> PackageDescription -> Package Source #
Some package info.
Constructors
| Package | |
Fields
| |
data PackageConfig Source #
Package build configuration
Constructors
| PackageConfig | |
Fields
| |
Instances
| Show PackageConfig Source # | |
Defined in Stack.Types.Package Methods showsPrec :: Int -> PackageConfig -> ShowS # show :: PackageConfig -> String # showList :: [PackageConfig] -> ShowS # | |
buildLogPath :: (MonadReader env m, HasBuildConfig env, MonadThrow m) => Package -> Maybe String -> m (Path Abs File) Source #
Path for the package's build log.
data PackageException Source #
Type representing exceptions thrown by functions exported by the Stack.Package module.
Constructors
Instances
| Exception PackageException Source # | |
Defined in Stack.Types.Package Methods toException :: PackageException -> SomeException # fromException :: SomeException -> Maybe PackageException # | |
| Show PackageException Source # | |
Defined in Stack.Types.Package Methods showsPrec :: Int -> PackageException -> ShowS # show :: PackageException -> String # showList :: [PackageException] -> ShowS # | |
resolvePackageDescription :: PackageConfig -> GenericPackageDescription -> PackageDescription Source #
Evaluates the conditions of a GenericPackageDescription, yielding
a resolved PackageDescription.
packageDependencies :: PackageDescription -> Map PackageName VersionRange Source #
Get all dependencies of the package (buildable targets only).
applyForceCustomBuild Source #
Force a package to be treated as a custom build type, see https://github.com/commercialhaskell/stack/issues/4488
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.