Commit e918ec1d authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

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 Base
import Settings.Path import Settings.Path
...@@ -6,14 +6,20 @@ import Stage ...@@ -6,14 +6,20 @@ import Stage
import UserSettings import UserSettings
import Util 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 :: Rules ()
cleanRules = do cleanRules = "clean" ~> clean
"clean" ~> do
forM_ [Stage0 ..] $ removeDirectory . (buildRootPath -/-) . stageString
removeDirectory generatedPath
removeDirectory inplaceBinPath
removeDirectory inplaceLibPath
removeDirectory "sdistprep"
putBuild $ "| Remove Hadrian files..."
removeFilesAfter buildRootPath ["//*"]
putSuccess $ "| Done. "
...@@ -4,12 +4,14 @@ import Base ...@@ -4,12 +4,14 @@ import Base
import Builder import Builder
import Oracles.Config.Setting import Oracles.Config.Setting
import Oracles.DirectoryContents import Oracles.DirectoryContents
import Rules.Clean
import UserSettings import UserSettings
import Util import Util
sourceDistRules :: Rules () sourceDistRules :: Rules ()
sourceDistRules = do sourceDistRules = do
"sdist-ghc" ~> do "sdist-ghc" ~> do
cleanSourceTree -- We clean the source tree first, see #384
version <- setting ProjectVersion version <- setting ProjectVersion
need ["sdistprep/ghc-" ++ version ++ "-src.tar.xz"] need ["sdistprep/ghc-" ++ version ++ "-src.tar.xz"]
putSuccess "| Done" putSuccess "| Done"
...@@ -41,6 +43,7 @@ prepareTree dest = do ...@@ -41,6 +43,7 @@ prepareTree dest = do
, Test "//*~" , Test "//*~"
, Test "//autom4te*" , Test "//autom4te*"
, Test "//dist" , Test "//dist"
, Test "//dist-install"
, Test "//log" , Test "//log"
, Test "//stage0" , Test "//stage0"
, Test "//stage1" , 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