Skip to content

Commit

Permalink
Re #2407 Move Runner out of Stack.Types.Config
Browse files Browse the repository at this point in the history
  • Loading branch information
mpilgrem committed Apr 18, 2023
1 parent c419e4c commit f5899e8
Show file tree
Hide file tree
Showing 68 changed files with 1,030 additions and 746 deletions.
18 changes: 18 additions & 0 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -260,21 +260,39 @@ library:
- Stack.Storage.User
- Stack.Storage.Util
- Stack.Templates
- Stack.Types.AllowNewerDeps
- Stack.Types.ApplyGhcOptions
- Stack.Types.Build
- Stack.Types.CabalConfigKey
- Stack.Types.ColorWhen
- Stack.Types.CompilerBuild
- Stack.Types.Compiler
- Stack.Types.Config
- Stack.Types.Config.Build
- Stack.Types.ConfigMonoid
- Stack.Types.Docker
- Stack.Types.DockerEntrypoint
- Stack.Types.DownloadInfo
- Stack.Types.DumpLogs
- Stack.Types.GHCDownloadInfo
- Stack.Types.GHCVariant
- Stack.Types.GhcPkgId
- Stack.Types.GlobalOpts
- Stack.Types.LockFileBehavior
- Stack.Types.NamedComponent
- Stack.Types.Nix
- Stack.Types.Package
- Stack.Types.PackageName
- Stack.Types.PvpBounds
- Stack.Types.Resolver
- Stack.Types.Runner
- Stack.Types.SCM
- Stack.Types.SetupInfo
- Stack.Types.SourceMap
- Stack.Types.StackYamlLoc
- Stack.Types.TemplateName
- Stack.Types.Version
- Stack.Types.VersionedDownloadInfo
- Stack.Uninstall
- Stack.Unpack
- Stack.Update
Expand Down
3 changes: 2 additions & 1 deletion src/Options/Applicative/Complicated.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ import Options.Applicative.Builder.Internal
( Mod (..), mkCommand, mkParser )
import Options.Applicative.Types ( OptReader (..) )
import Stack.Prelude
import Stack.Types.Config ( AddCommand, GlobalOptsMonoid, Runner )
import Stack.Types.Config ( AddCommand, GlobalOptsMonoid )
import Stack.Types.Runner ( Runner )
import System.Environment ( getArgs )

-- | Generate and execute a complicated options parser.
Expand Down
5 changes: 3 additions & 2 deletions src/Stack/Build.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ import Stack.Types.Compiler ( getGhcVersion )
import Stack.Types.Config
( BuildOpts (..), BuildOptsCLI (..), Config (..)
, EnvConfig (..), HasBuildConfig, HasConfig (..)
, HasEnvConfig (..), HasPlatform (..), HasSourceMap, Runner
, HasEnvConfig (..), HasPlatform (..), HasSourceMap
, actualCompilerVersionL, buildOptsL
, buildOptsMonoidBenchmarksL, buildOptsMonoidHaddockL
, buildOptsMonoidInstallExesL, buildOptsMonoidTestsL
, cabalVersionL, globalOptsL, globalOptsBuildOptsMonoidL
, cabalVersionL, globalOptsBuildOptsMonoidL
, installationRootDeps, installationRootLocal
, packageDatabaseDeps, packageDatabaseExtra
, packageDatabaseLocal, stackYamlL
Expand All @@ -57,6 +57,7 @@ import Stack.Types.NamedComponent ( exeComponents )
import Stack.Types.Package
( InstallLocation (..), LocalPackage (..), Package (..)
, PackageConfig (..), lpFiles, lpFilesForComponents )
import Stack.Types.Runner ( Runner, globalOptsL )
import Stack.Types.SourceMap
( CommonPackage (..), ProjectPackage (..), SMTargets (..)
, SourceMap (..), Target (..) )
Expand Down
5 changes: 3 additions & 2 deletions src/Stack/Build/ConstructPlan.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ import Stack.Types.Config
, Curator (..), DumpPackage (..), EnvConfig, EnvSettings (..)
, HasBuildConfig (..), HasCompiler (..), HasConfig (..)
, HasEnvConfig (..), HasGHCVariant, HasPlatform
, HasRunner (..), HasSourceMap (..), minimalEnvSettings
, stackRootL, stackYamlL
, HasSourceMap (..), minimalEnvSettings, stackRootL
, stackYamlL
)
import Stack.Types.Dependency
( DepValue (DepValue), DepType (AsLibrary) )
Expand All @@ -58,6 +58,7 @@ import Stack.Types.Package
, PackageLibraries (..), PackageSource (..), installedVersion
, packageIdentifier, psVersion, runMemoizedWith
)
import Stack.Types.Runner ( HasRunner (..) )
import Stack.Types.SourceMap
( CommonPackage (..), DepPackage (..), FromSnapshot (..)
, GlobalPackage (..), SMTargets (..), SourceMap (..)
Expand Down
24 changes: 13 additions & 11 deletions src/Stack/Build/Execute.hs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ import Stack.GhcPkg ( ghcPkgPathEnvVar, unregisterGhcPkgIds )
import Stack.Package ( buildLogPath )
import Stack.PackageDump ( conduitDumpPackage, ghcPkgDescribe )
import Stack.Prelude
import Stack.Types.ApplyGhcOptions ( ApplyGhcOptions (..) )
import Stack.Types.Build
( BaseConfigOpts (..), BuildException (..)
, BuildPrettyException (..), ConfigCache (..)
Expand All @@ -141,22 +142,22 @@ import Stack.Types.Compiler
, compilerVersionString, getGhcVersion
)
import Stack.Types.Config
( ApplyGhcOptions (..), BenchmarkOpts (..), BuildConfig (..)
, BuildOpts (..), BuildOptsCLI (..), CabalVerbosity (..)
, CompilerPaths (..), Config (..), Curator (..)
, DumpLogs (..), DumpPackage (..), EnvSettings (..)
, GhcPkgExe (..), GlobalOpts (..), HaddockOpts (..)
( BenchmarkOpts (..), BuildConfig (..), BuildOpts (..)
, BuildOptsCLI (..), CabalVerbosity (..), CompilerPaths (..)
, Config (..), Curator (..), DumpPackage (..)
, EnvSettings (..), GhcPkgExe (..), HaddockOpts (..)
, HasBuildConfig (..), HasCompiler (..), HasConfig (..)
, HasEnvConfig, HasPlatform (..), HasRunner, TestOpts (..)
, HasEnvConfig, HasPlatform (..), TestOpts (..)
, actualCompilerVersionL, appropriateGhcColorFlag
, bindirCompilerTools, buildOptsL, cabalVersionL, cpWhich
, getCompilerPath, getGhcPkgExe, globalOptsL
, installationRootDeps, installationRootLocal
, packageDatabaseLocal, platformGhcRelDir, projectRootL
, shouldForceGhcColorFlag, stackRootL, terminalL
, whichCompilerL
, getCompilerPath, getGhcPkgExe, installationRootDeps
, installationRootLocal, packageDatabaseLocal
, platformGhcRelDir, projectRootL, shouldForceGhcColorFlag
, stackRootL, whichCompilerL
)
import Stack.Types.DumpLogs ( DumpLogs (..) )
import Stack.Types.GhcPkgId ( GhcPkgId, ghcPkgIdString, unGhcPkgId )
import Stack.Types.GlobalOpts ( GlobalOpts (..) )
import Stack.Types.NamedComponent
( NamedComponent, benchComponents, exeComponents, isCBench
, isCTest, renderComponent, testComponents
Expand All @@ -168,6 +169,7 @@ import Stack.Types.Package
, runMemoizedWith
)
import Stack.Types.PackageFile ( PackageWarning (..) )
import Stack.Types.Runner ( HasRunner, globalOptsL, terminalL )
import Stack.Types.SourceMap ( Target )
import Stack.Types.Version ( withinRange )
import qualified System.Directory as D
Expand Down
16 changes: 9 additions & 7 deletions src/Stack/Build/Source.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,17 @@ import Stack.SourceMap
, getCompilerInfo, immutableLocSha, mkProjectPackage
, pruneGlobals
)
import Stack.Types.ApplyGhcOptions ( ApplyGhcOptions (..) )
import Stack.Types.Build ( FlagSource (..) )
import Stack.Types.CabalConfigKey ( CabalConfigKey (..) )
import Stack.Types.Config
( ApplyCLIFlag (..), ApplyGhcOptions (..), BuildConfig (..)
, BuildOpts (..), BuildOptsCLI (..), CabalConfigKey (..)
, Config (..), Curator (..), HasBuildConfig (..), HasCompiler
, HasConfig (..), HasEnvConfig (..), HasPlatform (..)
, HasSourceMap (..), ProjectPackage (..), TestOpts (..)
, actualCompilerVersionL, buildOptsL, envConfigSourceMap
, getCompilerPath, ppGPD, ppRoot
( ApplyCLIFlag (..), BuildConfig (..), BuildOpts (..)
, BuildOptsCLI (..), Config (..), Curator (..)
, HasBuildConfig (..), HasCompiler, HasConfig (..)
, HasEnvConfig (..), HasPlatform (..), HasSourceMap (..)
, ProjectPackage (..), TestOpts (..), actualCompilerVersionL
, buildOptsL, envConfigSourceMap, getCompilerPath, ppGPD
, ppRoot
)
import Stack.Types.NamedComponent
( NamedComponent (..), isCInternalLib )
Expand Down
3 changes: 2 additions & 1 deletion src/Stack/Clean.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ import Stack.Constants.Config ( rootDistDirFromDir, workDirFromDir )
import Stack.Prelude
import Stack.Runners ( ShouldReexec (..), withConfig )
import Stack.Types.Config
( BuildConfig (..), Config, HasBuildConfig (..), Runner
( BuildConfig (..), Config, HasBuildConfig (..)
, getProjectWorkDir, ppRoot
)
import Stack.Types.Runner ( Runner )
import Stack.Types.SourceMap ( SMWanted (..) )

-- | Type representing exceptions thrown by functions exported by the
Expand Down
27 changes: 18 additions & 9 deletions src/Stack/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -97,29 +97,38 @@ import Stack.SourceMap
import Stack.Storage.Project ( initProjectStorage )
import Stack.Storage.User ( initUserStorage )
import Stack.Storage.Util ( handleMigrationException )
import Stack.Types.AllowNewerDeps ( AllowNewerDeps (..) )
import Stack.Types.ApplyGhcOptions ( ApplyGhcOptions (..) )
import Stack.Types.Build ( BuildException (..), FlagSource (..) )
import Stack.Types.ColorWhen ( ColorWhen (..) )
import Stack.Types.Compiler ( defaultCompilerRepository )
import Stack.Types.Config
( AllowNewerDeps (..), ApplyGhcOptions (..), BuildConfig (..)
, BuildOpts (..), ColorWhen (..), Config (..)
, ConfigException (..), ConfigMonoid (..), DumpLogs (..)
, ConfigPrettyException (..), GlobalOpts (..), HasConfig (..)
, HasRunner (..), ParseAbsolutePathException (..)
( BuildConfig (..)
, BuildOpts (..), Config (..)
, ConfigException (..)
, ConfigPrettyException (..), HasConfig (..)
, ParseAbsolutePathException (..)
, PlatformVariant (..), Project (..)
, ProjectAndConfigMonoid (..), ProjectConfig (..)
, PvpBounds (..), PvpBoundsType (..), Runner (..)
, StackYamlLoc (..), askLatestSnapshotUrl, configProjectRoot
, globalOptsL, packageIndicesWarning, parseConfigMonoid
, askLatestSnapshotUrl, configProjectRoot
, packageIndicesWarning, parseConfigMonoid
, parseProjectAndConfigMonoid, platformOnlyRelDir
, runnerGlobalOpts, stackRootL, terminalL, workDirL
, stackRootL, workDirL
)
import Stack.Types.ConfigMonoid ( ConfigMonoid (..) )
import Stack.Types.Docker ( DockerOptsMonoid (..), dockerEnable )
import Stack.Types.DumpLogs ( DumpLogs (..) )
import Stack.Types.GlobalOpts ( GlobalOpts (..) )
import Stack.Types.Nix ( nixEnable )
import Stack.Types.PvpBounds ( PvpBounds (..), PvpBoundsType (..) )
import Stack.Types.Resolver ( AbstractResolver (..), Snapshots (..) )
import Stack.Types.Runner
( HasRunner (..), Runner (..), globalOptsL, terminalL )
import Stack.Types.SourceMap
( CommonPackage (..), DepPackage (..), ProjectPackage (..)
, SMWanted (..)
)
import Stack.Types.StackYamlLoc ( StackYamlLoc (..) )
import Stack.Types.Version
( IntersectingVersionRange (..), VersionCheck (..)
, stackVersion, withinRange
Expand Down
2 changes: 1 addition & 1 deletion src/Stack/Config/Nix.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import qualified Data.Text.IO as TIO
import Distribution.System ( OS (..) )
import Stack.Constants ( osIsWindows )
import Stack.Prelude
import Stack.Types.Config ( HasRunner )
import Stack.Types.Runner ( HasRunner )
import Stack.Types.Nix ( NixOpts (..), NixOptsMonoid (..) )
import System.Directory ( doesFileExist )

Expand Down
5 changes: 3 additions & 2 deletions src/Stack/ConfigCmd.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,13 @@ import Stack.Config
import Stack.Constants ( stackDotYaml )
import Stack.Prelude
import Stack.Types.Config
( Config (..), EnvConfig, EnvSettings (..), GlobalOpts (..)
( Config (..), EnvConfig, EnvSettings (..)
, HasConfig (..), HasGHCVariant, ProjectConfig (..)
, configMonoidInstallGHCName, configMonoidSystemGHCName
, globalOptsL
)
import Stack.Types.GlobalOpts ( GlobalOpts (..) )
import Stack.Types.Resolver ( AbstractResolver, readAbstractResolver )
import Stack.Types.Runner ( globalOptsL )
import System.Environment ( getEnvironment )

-- | Type repesenting exceptions thrown by functions exported by the
Expand Down
3 changes: 2 additions & 1 deletion src/Stack/Coverage.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,14 @@ import Stack.Runners ( ShouldReexec (..), withConfig, withEnvConfig )
import Stack.Types.Compiler ( getGhcVersion )
import Stack.Types.Config
( BuildConfig (..), BuildOptsCLI (..), EnvConfig (..)
, HasBuildConfig (..), HasEnvConfig (..), Runner
, HasBuildConfig (..), HasEnvConfig (..)
, actualCompilerVersionL, cabalVersionL, defaultBuildOptsCLI
, hpcReportDir, ppRoot
)
import Stack.Types.NamedComponent ( NamedComponent (..) )
import Stack.Types.Package
( Package (..), PackageLibraries (..), packageIdentifier )
import Stack.Types.Runner ( Runner )
import Stack.Types.SourceMap
( PackageType (..), SMTargets (..), SMWanted (..)
, SourceMap (..), Target (..)
Expand Down
2 changes: 1 addition & 1 deletion src/Stack/DefaultColorWhen.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Stack.DefaultColorWhen
) where

import Stack.Prelude ( stdout )
import Stack.Types.Config ( ColorWhen (ColorAuto, ColorNever) )
import Stack.Types.ColorWhen ( ColorWhen (..) )
import System.Console.ANSI ( hSupportsANSIWithoutEmulation )
import System.Environment ( lookupEnv )

Expand Down
6 changes: 4 additions & 2 deletions src/Stack/Docker.hs
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,17 @@ import Stack.Setup ( ensureDockerStackExe )
import Stack.Storage.User
( loadDockerImageExeCache, saveDockerImageExeCache )
import Stack.Types.Config
( Config (..), DockerEntrypoint (..), DockerUser (..)
, HasConfig (..), configProjectRoot, stackRootL, terminalL
( Config (..), HasConfig (..), configProjectRoot, stackRootL
)
import Stack.Types.Docker
( DockerException (..), DockerOpts (..), DockerStackExe (..)
, Mount (..), dockerCmdName, dockerContainerPlatform
, dockerEntrypointArgName, dockerHelpOptName
, dockerPullCmdName, reExecArgName
)
import Stack.Types.DockerEntrypoint
( DockerEntrypoint (..), DockerUser (..) )
import Stack.Types.Runner ( terminalL )
import Stack.Types.Version ( showStackVersion, withinRange )
import System.Environment
( getArgs, getEnv, getEnvironment, getExecutablePath
Expand Down
2 changes: 1 addition & 1 deletion src/Stack/DockerCmd.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Stack.DockerCmd
import Stack.Docker ( preventInContainer, pull, reset )
import Stack.Prelude
import Stack.Runners ( ShouldReexec (..), withConfig )
import Stack.Types.Config ( Runner )
import Stack.Types.Runner ( Runner )

-- | Function underlying the @stack docker pull@ command. Pull the current
-- Docker image.
Expand Down
1 change: 1 addition & 0 deletions src/Stack/Dot.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import Stack.Types.Build
import Stack.Types.Compiler ( wantedToActual )
import Stack.Types.Config
import Stack.Types.GhcPkgId
import Stack.Types.Runner ( HasRunner (..), Runner )
import Stack.Types.SourceMap

-- | Type representing exceptions thrown by functions exported by the
Expand Down
2 changes: 1 addition & 1 deletion src/Stack/Eval.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Stack.Exec
, execCmd
)
import Stack.Prelude
import Stack.Types.Config ( Runner )
import Stack.Types.Runner ( Runner )

-- Type representing command line options for the @stack eval@ command.
data EvalOpts = EvalOpts
Expand Down
5 changes: 3 additions & 2 deletions src/Stack/Exec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ import Stack.Prelude
import Stack.Runners ( ShouldReexec (..), withConfig, withEnvConfig )
import Stack.Types.Config
( BuildConfig (..), BuildOptsCLI (..), CompilerPaths (..)
, EnvConfig, EnvSettings (..), Runner
, buildConfigL, compilerPathsL, configL, configProcessContextSettings, defaultBuildOptsCLI
, EnvConfig, EnvSettings (..), buildConfigL, compilerPathsL
, configL, configProcessContextSettings, defaultBuildOptsCLI
, getGhcPkgExe, ppComponents
)
import Stack.Types.Runner ( Runner )
import Stack.Types.SourceMap ( SMWanted (..) )
import System.Directory ( withCurrentDirectory )
import System.FilePath ( isValid )
Expand Down
1 change: 1 addition & 0 deletions src/Stack/Ghci.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import Stack.Types.Config
import Stack.Types.NamedComponent
import Stack.Types.Package
import Stack.Types.PackageFile
import Stack.Types.Runner ( HasRunner, Runner )
import Stack.Types.SourceMap
import System.IO ( putStrLn )
import System.IO.Temp ( getCanonicalTemporaryDirectory )
Expand Down
9 changes: 5 additions & 4 deletions src/Stack/Hoogle.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ import Stack.Runners
)
import Stack.Types.Config
( BuildOptsCLI (..), Config (..), EnvConfig, EnvSettings (..)
, GlobalOpts (..), HasConfig (..), HasSourceMap (..), Runner
, buildOptsMonoidHaddockL, defaultBuildOptsCLI
, hoogleDatabasePath, hoogleRoot, globalOptsBuildOptsMonoidL
, globalOptsL
, HasConfig (..), HasSourceMap (..), buildOptsMonoidHaddockL
, defaultBuildOptsCLI, hoogleDatabasePath, hoogleRoot
, globalOptsBuildOptsMonoidL
)
import Stack.Types.GlobalOpts ( GlobalOpts (..) )
import Stack.Types.Runner ( Runner, globalOptsL )
import Stack.Types.SourceMap ( DepPackage (..), SourceMap (..) )

-- | Type representing exceptions thrown by functions exported by the
Expand Down
5 changes: 2 additions & 3 deletions src/Stack/IDE.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ import Stack.Prelude
import Stack.Runners
( ShouldReexec (..), withBuildConfig, withConfig )
import Stack.Types.Config
( BuildConfig (..), HasBuildConfig (..), Runner
, ppComponents
)
( BuildConfig (..), HasBuildConfig (..), ppComponents )
import Stack.Types.NamedComponent
( NamedComponent, renderPkgComponent )
import Stack.Types.Runner ( Runner )
import Stack.Types.SourceMap ( ProjectPackage (..), SMWanted (..) )
import System.IO ( putStrLn )

Expand Down
Loading

0 comments on commit f5899e8

Please sign in to comment.