Skip to content
Merged
Show file tree
Hide file tree
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
32 changes: 13 additions & 19 deletions src/Stack/Runners.hs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ withDefaultBuildConfigAndLock
-> (Maybe FileLock -> RIO EnvConfig ())
-> IO ()
withDefaultBuildConfigAndLock go inner =
withBuildConfigExt WithDocker go AllowNoTargets defaultBuildOptsCLI Nothing inner Nothing
withBuildConfigExt go AllowNoTargets defaultBuildOptsCLI Nothing inner Nothing

withBuildConfigAndLock
:: GlobalOpts
Expand All @@ -150,7 +150,7 @@ withBuildConfigAndLock
-> (Maybe FileLock -> RIO EnvConfig ())
-> IO ()
withBuildConfigAndLock go needTargets boptsCLI inner =
withBuildConfigExt WithDocker go needTargets boptsCLI Nothing inner Nothing
withBuildConfigExt go needTargets boptsCLI Nothing inner Nothing

-- | A runner specially built for the "stack clean" use case. For some
-- reason (hysterical raisins?), all of the functions in this module
Expand All @@ -171,8 +171,7 @@ withCleanConfig go inner =
runRIO bconfig inner

withBuildConfigExt
:: WithDocker
-> GlobalOpts
:: GlobalOpts
-> NeedTargets
-> BuildOptsCLI
-> Maybe (RIO Config ())
Expand All @@ -189,7 +188,7 @@ withBuildConfigExt
-- available in this action, since that would require build tools to be
-- installed on the host OS.
-> IO ()
withBuildConfigExt skipDocker go@GlobalOpts{..} needTargets boptsCLI mbefore inner mafter = loadConfigWithOpts go $ \lc -> do
withBuildConfigExt go@GlobalOpts{..} needTargets boptsCLI mbefore inner mafter = loadConfigWithOpts go $ \lc -> do
withUserFileLock go (view stackRootL lc) $ \lk0 -> do
-- A local bit of state for communication between callbacks:
curLk <- newIORef lk0
Expand All @@ -212,20 +211,15 @@ withBuildConfigExt skipDocker go@GlobalOpts{..} needTargets boptsCLI mbefore inn

let getCompilerVersion = loadCompilerVersion go lc
runRIO (lcConfig lc) $
case skipDocker of
SkipDocker -> do
forM_ mbefore id
Nix.reexecWithOptionalShell (lcProjectRoot lc) getCompilerVersion (inner'' lk0)
forM_ mafter id
WithDocker -> Docker.reexecWithOptionalContainer
(lcProjectRoot lc)
mbefore
(runRIO (lcConfig lc) $
Nix.reexecWithOptionalShell (lcProjectRoot lc) getCompilerVersion (inner'' lk0))
mafter
(Just $ liftIO $
do lk' <- readIORef curLk
munlockFile lk')
Docker.reexecWithOptionalContainer
(lcProjectRoot lc)
mbefore
(runRIO (lcConfig lc) $
Nix.reexecWithOptionalShell (lcProjectRoot lc) getCompilerVersion (inner'' lk0))
mafter
(Just $ liftIO $
do lk' <- readIORef curLk
munlockFile lk')

-- | Load the configuration. Convenience function used
-- throughout this module.
Expand Down
7 changes: 0 additions & 7 deletions src/Stack/Types/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ module Stack.Types.Config
,defaultLogLevel
-- ** LoadConfig
,LoadConfig(..)
-- ** WithDocker
,WithDocker(..)

-- ** Project & ProjectAndConfigMonoid
,Project(..)
,Curator(..)
Expand Down Expand Up @@ -495,10 +492,6 @@ data BuildConfig = BuildConfig
, bcCurator :: !(Maybe Curator)
}

data WithDocker
= SkipDocker
| WithDocker

stackYamlL :: HasBuildConfig env => Lens' env (Path Abs File)
stackYamlL = buildConfigL.lens bcStackYaml (\x y -> x { bcStackYaml = y })

Expand Down
1 change: 0 additions & 1 deletion src/main/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,6 @@ imgDockerCmd :: (Bool, [Text]) -> GlobalOpts -> IO ()
imgDockerCmd (rebuild,images) go@GlobalOpts{..} = loadConfigWithOpts go $ \lc -> do
let mProjectRoot = lcProjectRoot lc
withBuildConfigExt
WithDocker
go
NeedTargets
defaultBuildOptsCLI
Expand Down