Skip to content

Commit

Permalink
Clone repos in parallel, fix #38 (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
paf31 authored Jul 12, 2017
1 parent 0ed8764 commit a13656f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
module Main where

import qualified Control.Foldl as Foldl
import Control.Concurrent.Async (forConcurrently_)
import qualified Data.Aeson as Aeson
import Data.Aeson.Encode.Pretty
import Data.Foldable (fold, for_, traverse_)
Expand Down Expand Up @@ -168,7 +169,6 @@ writePackageSet PackageConfig{ set } =

installOrUpdate :: Text -> PackageName -> PackageInfo -> IO Turtle.FilePath
installOrUpdate set pkgName PackageInfo{ repo, version } = do
echoT ("Updating " <> runPackageName pkgName)
let pkgDir = ".psc-package" </> fromText set </> fromText (runPackageName pkgName) </> fromText version
exists <- testdir pkgDir
unless exists . void $ cloneShallow repo version pkgDir
Expand Down Expand Up @@ -197,7 +197,7 @@ updateImpl config@PackageConfig{ depends } = do
db <- readPackageSet config
trans <- getTransitiveDeps db depends
echoT ("Updating " <> pack (show (length trans)) <> " packages...")
for_ trans $ \(pkgName, pkg) -> installOrUpdate (set config) pkgName pkg
forConcurrently_ trans $ \(pkgName, pkg) -> installOrUpdate (set config) pkgName pkg

getPureScriptVersion :: IO Version
getPureScriptVersion = do
Expand Down
3 changes: 2 additions & 1 deletion psc-package.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ executable psc-package
build-depends: base >=4 && <5,
aeson -any,
aeson-pretty -any,
async -any,
bytestring -any,
containers -any,
foldl -any,
Expand All @@ -30,5 +31,5 @@ executable psc-package
Types
buildable: True
hs-source-dirs: app
ghc-options: -Wall -O2
ghc-options: -Wall -O2 -threaded -rtsopts -with-rtsopts=-N
default-language: Haskell2010

0 comments on commit a13656f

Please sign in to comment.