[commit: ghc] wip/nfs-locking: Simplify build rule interfaces. (622d3c1)

git at git.haskell.org git at git.haskell.org
Thu Oct 26 23:10:59 UTC 2017


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

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

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

commit 622d3c164d3c36fba97e780a5d3e3b4049e18417
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Sat Jun 13 14:14:03 2015 +0100

    Simplify build rule interfaces.


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

622d3c164d3c36fba97e780a5d3e3b4049e18417
 src/Rules.hs         | 4 ++--
 src/Rules/Data.hs    | 9 ++++++---
 src/Rules/Package.hs | 3 +--
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/Rules.hs b/src/Rules.hs
index 8f2825f..dd9e2e0 100644
--- a/src/Rules.hs
+++ b/src/Rules.hs
@@ -30,5 +30,5 @@ packageRules :: Rules ()
 packageRules =
     forM_ [Stage0, Stage1] $ \stage -> do
         forM_ targetPackages $ \pkg -> do
-            let dir = pkgPath pkg </> targetDirectory stage pkg
-            buildPackage stage pkg dir targetWays buildSettings
+            let env = defaultEnvironment { getStage = stage, getPackage = pkg }
+            buildPackage env targetWays buildSettings
diff --git a/src/Rules/Data.hs b/src/Rules/Data.hs
index 0a1abf1..7447e5e 100644
--- a/src/Rules/Data.hs
+++ b/src/Rules/Data.hs
@@ -140,8 +140,12 @@ postProcessPackageData file = do
 -- * otherwise, we must collapse it into one space-separated string
 
 -- Build package-data.mk by using GhcCabal to process pkgCabal file
-buildPackageData :: Stage -> Package -> FilePath -> Ways -> Settings -> Rules ()
-buildPackageData stage pkg dir ways settings =
+buildPackageData :: Environment -> Ways -> Settings -> Rules ()
+buildPackageData env ways settings =
+    let stage = getStage env
+        pkg   = getPackage env
+        dir   = pkgPath pkg </> targetDirectory stage pkg
+    in
     (dir </>) <$>
     [ "package-data.mk"
     , "haddock-prologue.txt"
@@ -152,7 +156,6 @@ buildPackageData stage pkg dir ways settings =
     -- , "build" </> "autogen" </> ("Paths_" ++ name) <.> "hs"
     ] &%> \_ -> do
         let configure = pkgPath pkg </> "configure"
-            env = defaultEnvironment { getStage = stage, getPackage = pkg }
         need [pkgPath pkg </> pkgCabal pkg]
         -- GhcCabal will run the configure script, so we depend on it
         -- We still don't know who build the configure script from configure.ac
diff --git a/src/Rules/Package.hs b/src/Rules/Package.hs
index 5ce0ed9..d56bb30 100644
--- a/src/Rules/Package.hs
+++ b/src/Rules/Package.hs
@@ -3,10 +3,9 @@ module Rules.Package (
     ) where
 
 import Base
-import Package
 import Rules.Data
 import Expression
 import Expression.Settings
 
-buildPackage :: Stage -> Package -> FilePath -> Ways -> Settings -> Rules ()
+buildPackage :: Environment -> Ways -> Settings -> Rules ()
 buildPackage = buildPackageData



More information about the ghc-commits mailing list