Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setupEnv: Run some processes concurrently #2346

Merged
merged 2 commits into from
Aug 6, 2016
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
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Other enhancements:
* Nix: No longer uses LTS mirroring in nixpkgs. Gives to nix-shell a derivation
like `haskell.compiler.ghc801`
See [#2259](https://github.com/commercialhaskell/stack/issues/2259)
* Perform some subprocesses during setup concurrently, slightly speeding up most
commands. [#2346](https://github.com/commercialhaskell/stack/pull/2346)

Bug fixes:

Expand Down
11 changes: 7 additions & 4 deletions src/Stack/Setup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module Stack.Setup
) where

import Control.Applicative
import Control.Concurrent.Async.Lifted (Concurrently(..))
import Control.Exception.Enclosed (catchIO, tryAny)
import Control.Monad (liftM, when, join, void, unless)
import Control.Monad.Catch
Expand Down Expand Up @@ -214,10 +215,13 @@ setupEnv mResolveMissingGHC = do
menv0 <- getMinimalEnvOverride
env <- removeHaskellEnvVars
<$> augmentPathMap (maybe [] edBins mghcBin) (unEnvOverride menv0)

menv <- mkEnvOverride platform env
compilerVer <- getCompilerVersion menv wc
cabalVer <- getCabalPkgVer menv wc

(compilerVer, cabalVer, globaldb) <- runConcurrently $ (,,)
<$> Concurrently (getCompilerVersion menv wc)
<*> Concurrently (getCabalPkgVer menv wc)
<*> Concurrently (getGlobalDB menv wc)

$logDebug "Resolving package entries"
packages <- mapM
(resolvePackageEntry menv (bcRoot bconfig))
Expand All @@ -240,7 +244,6 @@ setupEnv mResolveMissingGHC = do
createDatabase menv wc deps
localdb <- runReaderT packageDatabaseLocal envConfig0
createDatabase menv wc localdb
globaldb <- getGlobalDB menv wc
extras <- runReaderT packageDatabaseExtra envConfig0
let mkGPP locals = mkGhcPackagePath locals localdb deps extras globaldb

Expand Down
1 change: 1 addition & 0 deletions stack.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ library
, http-client-tls >= 0.3.0
, http-conduit >= 2.2.0
, http-types >= 0.8.6 && < 0.10
, lifted-async
-- https://github.com/basvandijk/lifted-base/issues/31
, lifted-base < 0.2.3.7 || > 0.2.3.7
, microlens >= 0.3.0.0
Expand Down