[commit: ghc] wip/nfs-locking: Implement clean target. (a730d9b)
git at git.haskell.org
git at git.haskell.org
Fri Oct 27 00:43:26 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/nfs-locking
Link : http://ghc.haskell.org/trac/ghc/changeset/a730d9bd25ac701cd9b6bd22b4f4fb14f88902dd/ghc
>---------------------------------------------------------------
commit a730d9bd25ac701cd9b6bd22b4f4fb14f88902dd
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date: Fri Jan 22 12:57:14 2016 +0000
Implement clean target.
Fix #131.
>---------------------------------------------------------------
a730d9bd25ac701cd9b6bd22b4f4fb14f88902dd
shaking-up-ghc.cabal | 1 +
src/Main.hs | 2 ++
src/Rules/Clean.hs | 30 ++++++++++++++++++++++++++++++
src/Rules/Generate.hs | 2 +-
4 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/shaking-up-ghc.cabal b/shaking-up-ghc.cabal
index b6a42d5..bd21d28 100644
--- a/shaking-up-ghc.cabal
+++ b/shaking-up-ghc.cabal
@@ -39,6 +39,7 @@ executable ghc-shake
, Rules
, Rules.Actions
, Rules.Cabal
+ , Rules.Clean
, Rules.Compile
, Rules.Config
, Rules.Data
diff --git a/src/Main.hs b/src/Main.hs
index f83734c..7321f88 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -6,6 +6,7 @@ import qualified Base
import CmdLineFlag
import qualified Rules
import qualified Rules.Cabal
+import qualified Rules.Clean
import qualified Rules.Config
import qualified Rules.Generate
import qualified Rules.Gmp
@@ -24,6 +25,7 @@ main = shakeArgsWith options flags $ \cmdLineFlags targets -> do
rules :: Rules ()
rules = mconcat
[ Rules.Cabal.cabalRules
+ , Rules.Clean.cleanRules
, Rules.Config.configRules
, Rules.Generate.copyRules
, Rules.Generate.generateRules
diff --git a/src/Rules/Clean.hs b/src/Rules/Clean.hs
new file mode 100644
index 0000000..6ab5309
--- /dev/null
+++ b/src/Rules/Clean.hs
@@ -0,0 +1,30 @@
+module Rules.Clean (cleanRules) where
+
+import Base
+import Package
+import Rules.Generate
+import Settings.Packages
+import Settings.Paths
+import Settings.User
+import Stage
+
+cleanRules :: Rules ()
+cleanRules = do
+ "clean" ~> do
+ putBuild $ "| Remove files in " ++ buildRootPath ++ "..."
+ removeFilesAfter buildRootPath ["//*"]
+ putBuild $ "| Remove files in " ++ programInplacePath ++ "..."
+ removeFilesAfter programInplacePath ["//*"]
+ putBuild $ "| Remove files in inplace/lib..."
+ removeFilesAfter "inplace/lib" ["//*"]
+ putBuild $ "| Remove files in " ++ derivedConstantsPath ++ "..."
+ removeFilesAfter derivedConstantsPath ["//*"]
+ forM_ includesDependencies $ \file -> do
+ putBuild $ "| Remove " ++ file
+ removeFileIfExists file
+ putBuild $ "| Remove files generated by ghc-cabal..."
+ forM_ knownPackages $ \pkg ->
+ forM_ [Stage0 ..] $ \stage -> do
+ let dir = pkgPath pkg -/- targetDirectory stage pkg
+ removeDirectoryIfExists dir
+ putSuccess $ "| Done. "
diff --git a/src/Rules/Generate.hs b/src/Rules/Generate.hs
index c5386e4..73b160a 100644
--- a/src/Rules/Generate.hs
+++ b/src/Rules/Generate.hs
@@ -1,6 +1,6 @@
module Rules.Generate (
generatePackageCode, generateRules, installTargets, copyRules,
- derivedConstantsPath, generatedDependencies
+ includesDependencies, derivedConstantsPath, generatedDependencies
) where
import Base
More information about the ghc-commits
mailing list