From a13656f4acd111c8f1660c643fe6c1c30b2b06c0 Mon Sep 17 00:00:00 2001 From: Phil Freeman Date: Tue, 11 Jul 2017 19:57:42 -0700 Subject: [PATCH] Clone repos in parallel, fix #38 (#40) --- app/Main.hs | 4 ++-- psc-package.cabal | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Main.hs b/app/Main.hs index 40cd526..74006af 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -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_) @@ -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 @@ -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 diff --git a/psc-package.cabal b/psc-package.cabal index 8000936..281e969 100644 --- a/psc-package.cabal +++ b/psc-package.cabal @@ -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, @@ -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