[commit: ghc] wip/nfs-locking: Copy generated files to old build directories. (90c59d1)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 00:17:44 UTC 2017


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

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

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

commit 90c59d1382021802b10c385b93b70a6967a25719
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Sun Feb 7 02:32:32 2016 +0000

    Copy generated files to old build directories.
    
    See #98.


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

90c59d1382021802b10c385b93b70a6967a25719
 src/Rules/Generate.hs | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/Rules/Generate.hs b/src/Rules/Generate.hs
index 9c67760..4ced436 100644
--- a/src/Rules/Generate.hs
+++ b/src/Rules/Generate.hs
@@ -3,6 +3,8 @@ module Rules.Generate (
     includesDependencies, derivedConstantsPath, generatedDependencies
     ) where
 
+import qualified System.Directory as IO
+
 import Base
 import Expression
 import GHC
@@ -144,19 +146,32 @@ generatePackageCode _ target @ (PartialTarget stage pkg) =
             , "*.hs-incl" ] |%> \file -> do
                 need [primopsTxt stage]
                 build $ fullTarget target GenPrimopCode [primopsTxt stage] [file]
+                -- TODO: this is temporary hack, get rid of this (#113)
+                let oldPath = pkgPath pkg -/- targetDirectory stage pkg -/- "build"
+                    newFile = oldPath ++ (drop (length buildPath) file)
+                createDirectory $ takeDirectory newFile
+                liftIO $ IO.copyFile file newFile
+                putSuccess $ "| Duplicate file " ++ file ++ " -> " ++ newFile
 
         when (pkg == rts) $ buildPath -/- "AutoApply.cmm" %> \file -> do
             build $ fullTarget target GenApply [] [file]
 
         priority 2.0 $ do
+            -- TODO: this is temporary hack, get rid of this (#113)
+            let oldPath = pkgPath pkg -/- targetDirectory stage pkg -/- "build"
+                olden f = oldPath ++ (drop (length buildPath) f)
+
             when (pkg == compiler) $ buildPath -/- "Config.hs" %> \file -> do
                 file <~ generateConfigHs
+                olden file <~ generateConfigHs -- TODO: get rid of this (#113)
 
             when (pkg == compiler) $ platformH stage %> \file -> do
                 file <~ generateGhcBootPlatformH
+                olden file <~ generateGhcBootPlatformH -- TODO: get rid of this (#113)
 
             when (pkg == ghcPkg) $ buildPath -/- "Version.hs" %> \file -> do
                 file <~ generateVersionHs
+                olden file <~ generateVersionHs -- TODO: get rid of this (#113)
 
             when (pkg == runGhc) $ buildPath -/- "Main.hs" %> \file -> do
                 copyFileChanged (pkgPath pkg -/- "runghc.hs") file



More information about the ghc-commits mailing list