Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 106 additions & 14 deletions src/Stack/Types/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,109 @@

-- | The Config type.

module Stack.Types.Config where
module Stack.Types.Config
(
-- * Main configuration types and classes
-- ** HasPlatform & HasStackRoot
HasPlatform(..)
,HasStackRoot(..)
-- ** Config & HasConfig
,Config(..)
,HasConfig(..)
,askConfig
,askLatestSnapshotUrl
,explicitSetupDeps
,getMinimalEnvOverride
-- ** BuildConfig & HasBuildConfig
,BuildConfig(..)
,bcRoot
,bcWorkDir
,HasBuildConfig(..)
-- ** GHCVariant & HasGHCVariant
,GHCVariant(..)
,ghcVariantName
,ghcVariantSuffix
,parseGHCVariant
,HasGHCVariant(..)
,snapshotsDir
-- ** EnvConfig & HasEnvConfig
,EnvConfig(..)
,HasEnvConfig(..)
,getWhichCompiler
-- * Details
-- ** ApplyGhcOptions
,ApplyGhcOptions(..)
-- ** ConfigException
,ConfigException(..)
-- ** ConfigMonoid
,ConfigMonoid(..)
-- ** EnvSettings
,EnvSettings(..)
,minimalEnvSettings
-- ** GlobalOpts & GlobalOptsMonoid
,GlobalOpts(..)
,GlobalOptsMonoid(..)
,defaultLogLevel
-- ** LoadConfig
,LoadConfig(..)
-- ** PackageEntry & PackageLocation
,PackageEntry(..)
,peExtraDep
,PackageLocation(..)
-- ** PackageIndex, IndexName & IndexLocation
,PackageIndex(..)
,IndexName(..)
,configPackageIndex
,configPackageIndexCache
,configPackageIndexGz
,configPackageIndexRoot
,configPackageTarball
,indexNameText
,IndexLocation(..)
-- ** Project & ProjectAndConfigMonoid
,Project(..)
,ProjectAndConfigMonoid(..)
-- ** PvpBounds
,PvpBounds(..)
,parsePvpBounds
-- ** Resolver & AbstractResolver
,Resolver(..)
,parseResolverText
,resolverName
,AbstractResolver(..)
-- ** SCM
,SCM(..)
-- * Paths
,bindirSuffix
,configInstalledCache
,configMiniBuildPlanCache
,configProjectWorkDir
,docDirSuffix
,flagCacheLocal
,extraBinDirs
,hpcReportDir
,installationRootDeps
,installationRootLocal
,packageDatabaseDeps
,packageDatabaseExtra
,packageDatabaseLocal
,platformOnlyRelDir
,platformVariantRelDir
,useShaPathOnWindows
,workDirRel
-- * Command-specific types
-- ** Eval
,EvalOpts(..)
-- ** Exec
,ExecOpts(..)
,SpecialExecCmd(..)
,ExecOptsExtra(..)
-- ** Setup
,DownloadInfo(..)
,VersionedDownloadInfo(..)
,SetupInfo(..)
,SetupInfoLocation(..)
) where

import Control.Applicative
import Control.Arrow ((&&&))
Expand Down Expand Up @@ -355,9 +457,9 @@ data BuildConfig = BuildConfig
bcRoot :: BuildConfig -> Path Abs Dir
bcRoot = parent . bcStackYaml

-- | Directory containing the project's stack.yaml file
-- | @"'bcRoot'/.stack-work"@
bcWorkDir :: BuildConfig -> Path Abs Dir
bcWorkDir = (</> workDirRel) . parent . bcStackYaml
bcWorkDir = (</> workDirRel) . bcRoot

-- | Configuration after the environment has been setup.
data EnvConfig = EnvConfig
Expand Down Expand Up @@ -862,9 +964,6 @@ configMonoidLocalBinPathName = "local-bin-path"
configMonoidImageOptsName :: Text
configMonoidImageOptsName = "image"

configMonoidTemplatesName :: Text
configMonoidTemplatesName = "templates"

configMonoidScmInitName :: Text
configMonoidScmInitName = "scm-init"

Expand Down Expand Up @@ -1005,6 +1104,7 @@ configPackageTarball iname ident = do
base <- parseRelFile $ packageIdentifierString ident ++ ".tar.gz"
return (root </> $(mkRelDir "packages") </> name </> ver </> base)

-- | @".stack-work"@
workDirRel :: Path Rel Dir
workDirRel = $(mkRelDir ".stack-work")

Expand All @@ -1026,14 +1126,6 @@ platformOnlyRelDir = do
platform <- asks getPlatform
parseRelDir (Distribution.Text.display platform)

-- | Path to .shake files.
configShakeFilesDir :: (MonadReader env m, HasBuildConfig env) => m (Path Abs Dir)
configShakeFilesDir = liftM (</> $(mkRelDir "shake")) configProjectWorkDir

-- | Where to unpack packages for local build
configLocalUnpackDir :: (MonadReader env m, HasBuildConfig env) => m (Path Abs Dir)
configLocalUnpackDir = liftM (</> $(mkRelDir "unpacked")) configProjectWorkDir

-- | Directory containing snapshots
snapshotsDir :: (MonadReader env m, HasConfig env, HasGHCVariant env, MonadThrow m) => m (Path Abs Dir)
snapshotsDir = do
Expand Down