[commit: ghc] wip/nfs-locking: Handle GenPrimopCode builder in a special way. (17087d7)

git at git.haskell.org git at git.haskell.org
Thu Oct 26 23:38:22 UTC 2017


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

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

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

commit 17087d74a371ab996b81e8436f07839294a21cf8
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Wed Sep 23 02:07:17 2015 +0100

    Handle GenPrimopCode builder in a special way.


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

17087d74a371ab996b81e8436f07839294a21cf8
 src/Rules/Actions.hs | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/Rules/Actions.hs b/src/Rules/Actions.hs
index f261b4f..1e0472a 100644
--- a/src/Rules/Actions.hs
+++ b/src/Rules/Actions.hs
@@ -24,15 +24,23 @@ buildWithResources rs target = do
                  ++ show builder ++ " with arguments:"
         mapM_ (putBuild . ("|   " ++)) $ interestingInfo builder argList
         putBuild $ "\\--------"
-        quietly $ if builder /= Ar
-            then cmd [path] argList
-            else do -- Split argument list into chunks as otherwise Ar chokes up
+        quietly $ case builder of
+            Ar -> do -- Split argument list into chunks as otherwise Ar chokes up
                 maxChunk <- cmdLineLengthLimit
                 let persistentArgs = take arPersistentArgsCount argList
                     remainingArgs  = drop arPersistentArgsCount argList
                 forM_ (chunksOfSize maxChunk remainingArgs) $ \argsChunk ->
                     unit . cmd [path] $ persistentArgs ++ argsChunk
 
+            GenPrimopCode -> do
+                let src  = head $ Target.sources target -- TODO: ugly
+                    file = head $ Target.files   target
+                input <- readFile' src
+                Stdout output <- cmd (Stdin input) [path] argList
+                writeFileChanged file output
+
+            _  -> cmd [path] argList
+
 -- Most targets are built without explicitly acquiring resources
 build :: Target -> Action ()
 build = buildWithResources []



More information about the ghc-commits mailing list