Commit e918ec1d authored by Andrey Mokhov's avatar Andrey Mokhov

Clean the source tree before building source distribution

See #384
parent 3a39f383
module Rules.Clean (cleanRules) where
module Rules.Clean (clean, cleanSourceTree, cleanRules) where
import Base
import Settings.Path
......@@ -6,14 +6,20 @@ import Stage
import UserSettings
import Util
clean :: Action ()
clean = do
cleanSourceTree
putBuild $ "| Remove Hadrian files..."
removeDirectory generatedPath
removeFilesAfter buildRootPath ["//*"]
putSuccess $ "| Done. "
cleanSourceTree :: Action ()
cleanSourceTree = do
forM_ [Stage0 ..] $ removeDirectory . (buildRootPath -/-) . stageString
removeDirectory inplaceBinPath
removeDirectory inplaceLibPath
removeDirectory "sdistprep"
cleanRules :: Rules ()
cleanRules = do
"clean" ~> do
forM_ [Stage0 ..] $ removeDirectory . (buildRootPath -/-) . stageString
removeDirectory generatedPath
removeDirectory inplaceBinPath
removeDirectory inplaceLibPath
removeDirectory "sdistprep"
putBuild $ "| Remove Hadrian files..."
removeFilesAfter buildRootPath ["//*"]
putSuccess $ "| Done. "
cleanRules = "clean" ~> clean
......@@ -4,12 +4,14 @@ import Base
import Builder
import Oracles.Config.Setting
import Oracles.DirectoryContents
import Rules.Clean
import UserSettings
import Util
sourceDistRules :: Rules ()
sourceDistRules = do
"sdist-ghc" ~> do
cleanSourceTree -- We clean the source tree first, see #384
version <- setting ProjectVersion
need ["sdistprep/ghc-" ++ version ++ "-src.tar.xz"]
putSuccess "| Done"
......@@ -41,6 +43,7 @@ prepareTree dest = do
, Test "//*~"
, Test "//autom4te*"
, Test "//dist"
, Test "//dist-install"
, Test "//log"
, Test "//stage0"
, Test "//stage1"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment