[commit: ghc] wip/nfs-locking: Add support for multiple invokations of Ar when argument list is too long. (c02e070)

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


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

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

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

commit c02e070cb0b05a443a823ef1134415b14d7043df
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Thu Aug 6 01:37:32 2015 +0100

    Add support for multiple invokations of Ar when argument list is too long.


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

c02e070cb0b05a443a823ef1134415b14d7043df
 src/Rules/Actions.hs | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/Rules/Actions.hs b/src/Rules/Actions.hs
index d96157c..50eb87f 100644
--- a/src/Rules/Actions.hs
+++ b/src/Rules/Actions.hs
@@ -7,9 +7,11 @@ import Util
 import Builder
 import Expression
 import qualified Target
+import Oracles.Setting
+import Oracles.ArgsHash
 import Settings.Args
 import Settings.Util
-import Oracles.ArgsHash
+import Settings.Builders.Ar
 
 -- Build a given target using an appropriate builder and acquiring necessary
 -- resources. Force a rebuilt if the argument list has changed since the last
@@ -29,7 +31,14 @@ buildWithResources rs target = do
                  ++ show builder ++ " with arguments:"
         mapM_ (putBuild . ("|   " ++)) $ interestingInfo builder argList
         putBuild $ "\\--------"
-        quietly $ cmd [path] argList
+        quietly $ if builder /= Ar
+            then cmd [path] argList
+            else 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
 
 -- Most targets are built without explicitly acquiring resources
 build :: FullTarget -> Action ()



More information about the ghc-commits mailing list