[commit: ghc] wip/nfs-locking: Copy *.hs-boot files of generated sources. (4e2f6c5)
git at git.haskell.org
git at git.haskell.org
Thu Oct 26 23:44:45 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/nfs-locking
Link : http://ghc.haskell.org/trac/ghc/changeset/4e2f6c504a541f7a6eab6eb072bae265d67e5bff/ghc
>---------------------------------------------------------------
commit 4e2f6c504a541f7a6eab6eb072bae265d67e5bff
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date: Tue Dec 22 05:10:46 2015 +0000
Copy *.hs-boot files of generated sources.
>---------------------------------------------------------------
4e2f6c504a541f7a6eab6eb072bae265d67e5bff
src/Rules/Generate.hs | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/Rules/Generate.hs b/src/Rules/Generate.hs
index 53b7dd6..10a4e6b 100644
--- a/src/Rules/Generate.hs
+++ b/src/Rules/Generate.hs
@@ -29,11 +29,12 @@ generatePackageCode _ target @ (PartialTarget stage pkg) =
buildPath = path -/- "build"
primopsTxt = targetPath stage compiler -/- "build/primops.txt"
platformH = targetPath stage compiler -/- "ghc_boot_platform.h"
- in do -- TODO: do we need to copy *.(l)hs-boot files here? Never happens?
- buildPath -/- "*.hs" %> \file -> do
+ generated f = (buildPath ++ "//*.hs") ?== f && not ("//autogen/*" ?== f)
+ in do
+ generated ?> \file -> do
dirs <- interpretPartial target $ getPkgDataList SrcDirs
files <- getDirectoryFiles "" $
- [ packagePath -/- d -/- takeBaseName file <.> "*" | d <- dirs ]
+ [ packagePath -/- d ++ "//" ++ takeBaseName file <.> "*" | d <- dirs ]
let gens = [ (f, b) | f <- files, Just b <- [determineBuilder f] ]
when (length gens /= 1) . putError $
"Exactly one generator expected for " ++ file
@@ -41,6 +42,9 @@ generatePackageCode _ target @ (PartialTarget stage pkg) =
let (src, builder) = head gens
need [src]
build $ fullTarget target builder [src] [file]
+ let srcBoot = src -<.> "hs-boot"
+ whenM (doesFileExist srcBoot) $
+ copyFileChanged srcBoot $ file -<.> "hs-boot"
when (pkg == compiler) $ primopsTxt %> \file -> do
need [platformH, primopsSource]
@@ -80,7 +84,7 @@ quote :: String -> String
quote s = "\"" ++ s ++ "\""
-- TODO: do we need ghc-split? Always or is it platform specific?
--- TODO: add tracking
+-- TODO: add tracking by moving these functions to separate tracked files
generateConfigHs :: Expr String
generateConfigHs = do
cProjectName <- getSetting ProjectName
More information about the ghc-commits
mailing list