[Git][ghc/ghc][wip/inplace-final] Only use needBuilders

Matthew Pickering (@mpickering) gitlab at gitlab.haskell.org
Wed Aug 24 09:28:22 UTC 2022



Matthew Pickering pushed to branch wip/inplace-final at Glasgow Haskell Compiler / GHC


Commits:
f05fbdd6 by Matthew Pickering at 2022-08-24T10:28:14+01:00
Only use needBuilders

- - - - -


2 changed files:

- hadrian/src/Builder.hs
- hadrian/src/Hadrian/Builder.hs


Changes:

=====================================
hadrian/src/Builder.hs
=====================================
@@ -6,7 +6,7 @@ module Builder (
     TarMode (..), GitMode (..), Builder (..), Win32TarballsMode(..),
 
     -- * Builder properties
-    builderProvenance, systemBuilderPath, builderPath, isSpecified, needBuilder, needBuilders,
+    builderProvenance, systemBuilderPath, builderPath, isSpecified, needBuilders,
     runBuilder, runBuilderWith, runBuilderWithCmdOptions, getBuilderPath,
     builderEnvironment,
 
@@ -266,7 +266,7 @@ instance H.Builder Builder where
         GhcPkg Dependencies _ -> do
             let input  = fromSingleton msgIn buildInputs
                 msgIn  = "[askBuilder] Exactly one input file expected."
-            needBuilder builder
+            needBuilders [builder]
             path <- H.builderPath builder
             -- we do not depend on bare builders. E.g. we won't depend on `clang`
             -- or `ld` or `ar`.  Unless they are provided with fully qualified paths
@@ -484,7 +484,7 @@ isSpecified = fmap (not . null) . systemBuilderPath
 applyPatch :: FilePath -> FilePath -> Action ()
 applyPatch dir patch = do
     let file = dir -/- patch
-    needBuilder Patch
+    needBuilders [Patch]
     path <- builderPath Patch
     putBuild $ "| Apply patch " ++ file
     quietly $ cmd' [Cwd dir, FileStdin file] [path, "-p0"]


=====================================
hadrian/src/Hadrian/Builder.hs
=====================================
@@ -12,7 +12,7 @@
 -- functions that can be used to invoke builders.
 -----------------------------------------------------------------------------
 module Hadrian.Builder (
-    Builder (..), BuildInfo (..), needBuilder, needBuilders, runBuilder,
+    Builder (..), BuildInfo (..), needBuilders, runBuilder,
     runBuilderWithCmdOptions, build, buildWithResources, buildWithCmdOptions,
     getBuilderPath, builderEnvironment, askWithResources
     ) where
@@ -58,16 +58,12 @@ class ShakeValue b => Builder b where
     runBuilderWith :: b -> BuildInfo -> Action ()
     runBuilderWith builder buildInfo = do
         let args = buildArgs buildInfo
-        needBuilder builder
+        needBuilders [builder]
         path <- builderPath builder
         let msg = if null args then "" else " (" ++ intercalate ", " args ++ ")"
         putBuild $ "| Run " ++ show builder ++ msg
         quietly $ cmd (buildOptions buildInfo) [path] args
 
--- | Make sure a builder and its runtime dependencies are up-to-date.
-needBuilder :: Builder b => b -> Action ()
-needBuilder builder = needBuilders [builder]
-
 needBuilders :: Builder b => [b] -> Action ()
 needBuilders bs = do
     paths <- mapM builderPath bs
@@ -117,7 +113,7 @@ doWith :: (Builder b, ShakeValue c)
        -> (Target c b -> Action ())
        -> [(Resource, Int)] -> [CmdOption] -> Target c b -> Args c b -> Action a
 doWith f info rs opts target args = do
-    needBuilder (builder target)
+    needBuilders [builder target]
     argList <- interpret target args
     trackArgsHash target -- Rerun the rule if the hash of argList has changed.
     info target
@@ -163,6 +159,6 @@ getBuilderPath = expr . builderPath
 -- | Write a builder path into a given environment variable.
 builderEnvironment :: Builder b => String -> b -> Action CmdOption
 builderEnvironment variable builder = do
-    needBuilder builder
+    needBuilders [builder]
     path <- builderPath builder
     return $ AddEnv variable path



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f05fbdd61733b7275ecf8bccf61ebdf8d0e145d0

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f05fbdd61733b7275ecf8bccf61ebdf8d0e145d0
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20220824/ecea729e/attachment-0001.html>


More information about the ghc-commits mailing list