[commit: ghc] wip/nfs-locking: Drop unused Resources parameter. (010fb8c)

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


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

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

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

commit 010fb8c148ae0d0c08236c19e74e214968d45410
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Sun Feb 14 23:30:15 2016 +0000

    Drop unused Resources parameter.


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

010fb8c148ae0d0c08236c19e74e214968d45410
 src/Rules.hs               | 23 ++++++++++-------------
 src/Rules/Data.hs          |  5 ++---
 src/Rules/Documentation.hs |  5 ++---
 src/Rules/Generate.hs      |  5 ++---
 src/Rules/Library.hs       |  5 ++---
 src/Rules/Program.hs       |  5 ++---
 6 files changed, 20 insertions(+), 28 deletions(-)

diff --git a/src/Rules.hs b/src/Rules.hs
index cea2c0d..be71d2f 100644
--- a/src/Rules.hs
+++ b/src/Rules.hs
@@ -55,19 +55,16 @@ packageRules :: Rules ()
 packageRules = do
     resources <- Rules.Resources.resourceRules
     for_ allStages $ \stage ->
-        for_ knownPackages $ \pkg ->
-            buildPackage resources $ vanillaContext stage pkg
-
-buildPackage :: Rules.Resources.Resources -> Context -> Rules ()
-buildPackage = mconcat
-    [ Rules.Compile.compilePackage
-    , Rules.Data.buildPackageData
-    , Rules.Dependencies.buildPackageDependencies
-    , Rules.Documentation.buildPackageDocumentation
-    , Rules.Generate.generatePackageCode
-    , Rules.Library.buildPackageLibrary
-    , Rules.Program.buildProgram
-    , Rules.Register.registerPackage ]
+        for_ knownPackages $ \package -> do
+            let context = vanillaContext stage package
+            Rules.Compile.compilePackage resources context
+            Rules.Data.buildPackageData context
+            Rules.Dependencies.buildPackageDependencies resources context
+            Rules.Documentation.buildPackageDocumentation context
+            Rules.Generate.generatePackageCode context
+            Rules.Library.buildPackageLibrary context
+            Rules.Program.buildProgram context
+            Rules.Register.registerPackage resources context
 
 buildRules :: Rules ()
 buildRules = mconcat
diff --git a/src/Rules/Data.hs b/src/Rules/Data.hs
index 7386003..f47e8d0 100644
--- a/src/Rules/Data.hs
+++ b/src/Rules/Data.hs
@@ -12,14 +12,13 @@ import Oracles.PackageDeps
 import Rules.Actions
 import Rules.Generate
 import Rules.Libffi
-import Rules.Resources
 import Settings
 import Settings.Builders.Common
 import Target
 
 -- Build package-data.mk by using GhcCabal to process pkgCabal file
-buildPackageData :: Resources -> Context -> Rules ()
-buildPackageData _ context @ (Context {..}) = do
+buildPackageData :: Context -> Rules ()
+buildPackageData context @ (Context {..}) = do
     let cabalFile = pkgCabalFile package
         configure = pkgPath package -/- "configure"
         dataFile  = pkgDataFile stage package
diff --git a/src/Rules/Documentation.hs b/src/Rules/Documentation.hs
index 95a5667..848a3fa 100644
--- a/src/Rules/Documentation.hs
+++ b/src/Rules/Documentation.hs
@@ -7,7 +7,6 @@ import Expression
 import GHC
 import Oracles.PackageData
 import Rules.Actions
-import Rules.Resources
 import Settings
 import Target
 
@@ -17,8 +16,8 @@ haddockHtmlLib = "inplace/lib/html/haddock-util.js"
 -- Note: this build rule creates plenty of files, not just the .haddock one.
 -- All of them go into the 'doc' subdirectory. Pedantically tracking all built
 -- files in the Shake databases seems fragile and unnecesarry.
-buildPackageDocumentation :: Resources -> Context -> Rules ()
-buildPackageDocumentation _ context @ (Context {..}) =
+buildPackageDocumentation :: Context -> Rules ()
+buildPackageDocumentation context @ (Context {..}) =
     let cabalFile   = pkgCabalFile package
         haddockFile = pkgHaddockFile package
     in when (stage == Stage1) $ do
diff --git a/src/Rules/Generate.hs b/src/Rules/Generate.hs
index 1a8a239..050f83c 100644
--- a/src/Rules/Generate.hs
+++ b/src/Rules/Generate.hs
@@ -20,7 +20,6 @@ import Oracles.ModuleFiles
 import Rules.Actions
 import Rules.Gmp
 import Rules.Libffi
-import Rules.Resources (Resources)
 import Settings
 import Target hiding (builder, context)
 
@@ -114,8 +113,8 @@ generate file context expr = do
     writeFileChanged file contents
     putSuccess $ "| Successfully generated '" ++ file ++ "'."
 
-generatePackageCode :: Resources -> Context -> Rules ()
-generatePackageCode _ context @ (Context stage pkg _) =
+generatePackageCode :: Context -> Rules ()
+generatePackageCode context @ (Context stage pkg _) =
     let buildPath   = targetPath stage pkg -/- "build"
         dropBuild   = drop (length buildPath + 1)
         generated f = (buildPath ++ "//*.hs") ?== f && not ("//autogen/*" ?== f)
diff --git a/src/Rules/Library.hs b/src/Rules/Library.hs
index be8f158..79b4952 100644
--- a/src/Rules/Library.hs
+++ b/src/Rules/Library.hs
@@ -11,13 +11,12 @@ import GHC
 import Oracles.PackageData
 import Rules.Actions
 import Rules.Gmp
-import Rules.Resources
 import Settings
 import Target
 
 -- TODO: Use way from Context, #207
-buildPackageLibrary :: Resources -> Context -> Rules ()
-buildPackageLibrary _ context @ (Context {..}) = do
+buildPackageLibrary :: Context -> Rules ()
+buildPackageLibrary context @ (Context {..}) = do
     let buildPath = targetPath stage package -/- "build"
 
     -- TODO: handle dynamic libraries
diff --git a/src/Rules/Program.hs b/src/Rules/Program.hs
index 00f4c52..d7fdaad 100644
--- a/src/Rules/Program.hs
+++ b/src/Rules/Program.hs
@@ -11,7 +11,6 @@ import Oracles.Config.Setting
 import Oracles.PackageData
 import Rules.Actions
 import Rules.Library
-import Rules.Resources
 import Rules.Wrappers.Ghc
 import Rules.Wrappers.GhcPkg
 import Settings
@@ -32,8 +31,8 @@ wrappers = [ (vanillaContext Stage0 ghc   , ghcWrapper   )
            , (vanillaContext Stage1 ghc   , ghcWrapper   )
            , (vanillaContext Stage0 ghcPkg, ghcPkgWrapper)]
 
-buildProgram :: Resources -> Context -> Rules ()
-buildProgram _ context @ (Context {..}) = do
+buildProgram :: Context -> Rules ()
+buildProgram context @ (Context {..}) = do
     let match file = case programPath stage package of
             Nothing      -> False
             Just program -> program == file



More information about the ghc-commits mailing list