[commit: ghc] wip/nfs-locking: Rename GhcPkgVersionHs.hs to VersionHs.hs, refactor src/Rules/Generate.hs. (641eb2d)
git at git.haskell.org
git at git.haskell.org
Fri Oct 27 00:16:42 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/nfs-locking
Link : http://ghc.haskell.org/trac/ghc/changeset/641eb2d33053d8011be52b68ef28e4c44ddf34e5/ghc
>---------------------------------------------------------------
commit 641eb2d33053d8011be52b68ef28e4c44ddf34e5
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date: Sat Dec 26 02:03:09 2015 +0000
Rename GhcPkgVersionHs.hs to VersionHs.hs, refactor src/Rules/Generate.hs.
>---------------------------------------------------------------
641eb2d33053d8011be52b68ef28e4c44ddf34e5
shaking-up-ghc.cabal | 2 +-
src/Rules/Generate.hs | 27 ++++++++++------------
.../{GhcPkgVersionHs.hs => VersionHs.hs} | 8 +++----
3 files changed, 17 insertions(+), 20 deletions(-)
diff --git a/shaking-up-ghc.cabal b/shaking-up-ghc.cabal
index 3f09043..d233327 100644
--- a/shaking-up-ghc.cabal
+++ b/shaking-up-ghc.cabal
@@ -43,7 +43,7 @@ executable ghc-shake
, Rules.Documentation
, Rules.Generate
, Rules.Generators.ConfigHs
- , Rules.Generators.GhcPkgVersionHs
+ , Rules.Generators.VersionHs
, Rules.Generators.PlatformH
, Rules.Library
, Rules.Oracles
diff --git a/src/Rules/Generate.hs b/src/Rules/Generate.hs
index fd22926..13d149e1 100644
--- a/src/Rules/Generate.hs
+++ b/src/Rules/Generate.hs
@@ -3,7 +3,7 @@ module Rules.Generate (generatePackageCode) where
import Expression
import GHC
import Rules.Generators.ConfigHs
-import Rules.Generators.GhcPkgVersionHs
+import Rules.Generators.VersionHs
import Rules.Generators.PlatformH
import Oracles.ModuleFiles
import Rules.Actions
@@ -32,6 +32,10 @@ generatePackageCode _ target @ (PartialTarget stage pkg) =
primopsTxt = targetPath stage compiler -/- "build/primops.txt"
platformH = targetPath stage compiler -/- "ghc_boot_platform.h"
generated f = (buildPath ++ "//*.hs") ?== f && not ("//autogen/*" ?== f)
+ generate file expr = do
+ contents <- interpretPartial target expr
+ writeFileChanged file contents
+ putBuild $ "| Successfully generated '" ++ file ++ "'."
in do
generated ?> \file -> do
let pattern = "//" ++ takeBaseName file <.> "*"
@@ -60,23 +64,16 @@ generatePackageCode _ target @ (PartialTarget stage pkg) =
need [primopsTxt]
build $ fullTarget target GenPrimopCode [primopsTxt] [file]
- priority 2.0 $ buildPath -/- "Config.hs" %> \file -> do
- contents <- interpretPartial target generateConfigHs
- writeFileChanged file contents
- putBuild $ "| Successfully generated '" ++ file ++ "'."
+ priority 2.0 $ do
+ when (pkg == ghcPkg) $ buildPath -/- "Config.hs" %> \file -> do
+ generate file generateConfigHs
- when (pkg == compiler) $ platformH %> \file -> do
- contents <- interpretPartial target generatePlatformH
- writeFileChanged file contents
- putBuild $ "| Successfully generated '" ++ file ++ "'."
-
- priority 2.0 $
when (pkg == ghcPkg) $ buildPath -/- "Version.hs" %> \file -> do
- contents <- interpretPartial target generateGhcPkgVersionHs
- writeFileChanged file contents
- putBuild $ "| Successfully generated '" ++ file ++ "'."
+ generate file generateVersionHs
+
+ when (pkg == compiler) $ platformH %> \file -> do
+ generate file generatePlatformH
- priority 2.0 $
when (pkg == runghc) $ buildPath -/- "Main.hs" %> \file -> do
copyFileChanged (pkgPath pkg -/- "runghc.hs") file
putBuild $ "| Successfully generated '" ++ file ++ "'."
diff --git a/src/Rules/Generators/GhcPkgVersionHs.hs b/src/Rules/Generators/VersionHs.hs
similarity index 66%
rename from src/Rules/Generators/GhcPkgVersionHs.hs
rename to src/Rules/Generators/VersionHs.hs
index f29ee97..ea6501a 100644
--- a/src/Rules/Generators/GhcPkgVersionHs.hs
+++ b/src/Rules/Generators/VersionHs.hs
@@ -1,11 +1,11 @@
-module Rules.Generators.GhcPkgVersionHs (generateGhcPkgVersionHs) where
+module Rules.Generators.VersionHs (generateVersionHs) where
import Expression
import Oracles
-generateGhcPkgVersionHs :: Expr String
-generateGhcPkgVersionHs = do
- lift $ need [sourcePath -/- "Rules/Generators/GhcPkgVersionHs.hs"]
+generateVersionHs :: Expr String
+generateVersionHs = do
+ lift $ need [sourcePath -/- "Rules/Generators/VersionHs.hs"]
projectVersion <- getSetting ProjectVersion
targetOs <- getSetting TargetOs
targetArch <- getSetting TargetArch
More information about the ghc-commits
mailing list