[commit: ghc] wip/nfs-locking: Parallelise build by collecting targets and then needing them. (9463852)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 00:00:58 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/946385207cf7691b7baa05e3003ebfa4fdb29082/ghc

>---------------------------------------------------------------

commit 946385207cf7691b7baa05e3003ebfa4fdb29082
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Sun Jul 26 17:01:03 2015 +0100

    Parallelise build by collecting targets and then needing them.


>---------------------------------------------------------------

946385207cf7691b7baa05e3003ebfa4fdb29082
 src/Rules.hs | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/Rules.hs b/src/Rules.hs
index f8fd786..b63687f 100644
--- a/src/Rules.hs
+++ b/src/Rules.hs
@@ -1,7 +1,7 @@
 module Rules (
     generateTargets, packageRules, oracleRules,
-    module Rules.Package,
     module Rules.Config,
+    module Rules.Package,
     ) where
 
 import Util
@@ -17,12 +17,13 @@ import Development.Shake
 -- generateTargets needs package-data.mk files of all target packages
 -- TODO: make interpretDiff total
 generateTargets :: Rules ()
-generateTargets = action $
-    forM_ [Stage0 ..] $ \stage -> do
+generateTargets = action $ do
+    targets <- fmap concat . forM [Stage0 ..] $ \stage -> do
         pkgs <- interpret (stageTarget stage) packages
-        forM_ pkgs $ \pkg -> do
-            need [targetPath stage pkg -/- "build/haskell.deps"]
-            need [targetPath stage pkg -/- "build/c.deps"]
+        fmap concat . forM pkgs $ \pkg -> return
+            [ targetPath stage pkg -/- "build/haskell.deps"
+            , targetPath stage pkg -/- "build/c.deps" ]
+    need targets
 
 -- TODO: add Stage2 (compiler only?)
 packageRules :: Rules ()



More information about the ghc-commits mailing list