[commit: ghc] wip/nfs-locking: Drop need from build. Add appropriate needs to build rules. (5bb1d7e)

git at git.haskell.org git at git.haskell.org
Thu Oct 26 23:34:07 UTC 2017


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

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

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

commit 5bb1d7e24f6f51f2d2e570de47b5f554bb990753
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Fri Aug 7 12:26:57 2015 +0100

    Drop need from build. Add appropriate needs to build rules.


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

5bb1d7e24f6f51f2d2e570de47b5f554bb990753
 src/Rules/Actions.hs      | 2 +-
 src/Rules/Compile.hs      | 5 +++++
 src/Rules/Data.hs         | 1 +
 src/Rules/Dependencies.hs | 4 +++-
 4 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/Rules/Actions.hs b/src/Rules/Actions.hs
index 50eb87f..062a5d5 100644
--- a/src/Rules/Actions.hs
+++ b/src/Rules/Actions.hs
@@ -21,7 +21,7 @@ buildWithResources rs target = do
     let builder = Target.builder target
         deps    = Target.dependencies target
     needBuilder builder
-    need deps
+    -- need deps -- TODO: think if needs could be done here
     path    <- builderPath builder
     argList <- interpret target getArgs
     -- The line below forces the rule to be rerun if the args hash has changed
diff --git a/src/Rules/Compile.hs b/src/Rules/Compile.hs
index 6f57a81..223f9b2 100644
--- a/src/Rules/Compile.hs
+++ b/src/Rules/Compile.hs
@@ -35,6 +35,11 @@ compilePackage _ target = do
         when (null cDeps && null hDeps) $
             putError $ "Cannot determine sources for '" ++ obj ++ "'."
 
+        when (not (null cDeps) && not (null hDeps)) $
+            putError $ "Both .c and .hs sources found for '" ++ obj ++ "'."
+
+        need $ hDeps ++ cDeps
+
         if null cDeps
         then build $ fullTargetWithWay target hSrcDeps (Ghc stage) way [obj]
         else build $ fullTarget        target cDeps    (Gcc stage)     [obj]
diff --git a/src/Rules/Data.hs b/src/Rules/Data.hs
index 8f365e8..8b3eb05 100644
--- a/src/Rules/Data.hs
+++ b/src/Rules/Data.hs
@@ -45,6 +45,7 @@ buildPackageData (Resources ghcCabal ghcPkg) target = do
                 depPkgs      = intersectOrd cmp (sort pkgs) deps
             need [ targetPath stage p -/- "package-data.mk" | p <- depPkgs ]
 
+            need [cabal]
             buildWithResources [(ghcCabal, 1)] $
                 fullTarget target [cabal] GhcCabal files
 
diff --git a/src/Rules/Dependencies.hs b/src/Rules/Dependencies.hs
index bee85c6..ea47241 100644
--- a/src/Rules/Dependencies.hs
+++ b/src/Rules/Dependencies.hs
@@ -22,15 +22,17 @@ buildPackageDependencies _ target =
     in do
         (buildPath <//> "*.c.deps") %> \depFile -> do
             let srcFile = dropBuild . dropExtension $ depFile
+            need [srcFile]
             build $ fullTarget target [srcFile] (GccM stage) [depFile]
 
         (buildPath -/- "c.deps") %> \file -> do
             srcs <- pkgDataList $ CSrcs path
             let depFiles = [ buildPath -/- src <.> "deps" | src <- srcs ]
-            need depFiles -- increase parallelism by needing all at once
+            need depFiles
             deps <- mapM readFile' depFiles
             writeFileChanged file (concat deps)
 
         (buildPath -/- "haskell.deps") %> \file -> do
             srcs <- interpret target getHsSources
+            need srcs
             build $ fullTarget target srcs (GhcM stage) [file]



More information about the ghc-commits mailing list