[Git][ghc/ghc][master] Hadrian: fix dyn_o/dyn_hi rule (#17534)

Marge Bot gitlab at gitlab.haskell.org
Fri Apr 17 16:45:35 UTC 2020



 Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
85fc32f0 by Sylvain Henry at 2020-04-17T12:45:25-04:00
Hadrian: fix dyn_o/dyn_hi rule (#17534)

- - - - -


1 changed file:

- hadrian/src/Rules/Compile.hs


Changes:

=====================================
hadrian/src/Rules/Compile.hs
=====================================
@@ -55,7 +55,22 @@ compilePackage rs = do
         &%> \ [dyn_o, _dyn_hi] -> do
           p <- platformSupportsSharedLibs
           if p
-            then need [dyn_o -<.> "o", dyn_o -<.> "hi"]
+            then do
+               -- We `need` ".o/.hi" because GHC is called with `-dynamic-too`
+               -- and builds ".dyn_o/.dyn_hi" too.
+               changed <- needHasChanged [dyn_o -<.> "o", dyn_o -<.> "hi"]
+
+               -- If for some reason a previous Hadrian execution has been
+               -- interrupted after the rule for .o/.hi generation has completed
+               -- but before the current rule for .dyn_o/.dyn_hi has completed,
+               -- or if some of the dynamic artifacts have been removed by the
+               -- user, "needing" the non dynamic artifacts is not enough as
+               -- Shake won't execute the associated action. Hence we detect
+               -- this case and we explictly build the dynamic artifacts here:
+               case changed of
+                  [] -> compileHsObjectAndHi rs dyn_o
+                  _  -> pure ()
+
             else compileHsObjectAndHi rs dyn_o
 
       forM_ ((,) <$> hsExts <*> wayPats) $ \ ((oExt, hiExt), wayPat) ->



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/85fc32f03a6df92ec8d4ec9accca3c11b31a1596
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/20200417/8eca227b/attachment.html>


More information about the ghc-commits mailing list