diff options
author | Andrey Mokhov <andrey.mokhov@gmail.com> | 2017-11-06 22:59:38 +0000 |
---|---|---|
committer | Andrey Mokhov <andrey.mokhov@gmail.com> | 2017-11-06 22:59:38 +0000 |
commit | 5cee48036ed69ae298a599d43cf72e0fe73e3b4e (patch) | |
tree | 5fe732c738a769d02e732469f4ffecd4ac9e191a /hadrian/src/Main.hs | |
parent | 275ac8ef0a0081f16abbfb8934e10cf271573768 (diff) | |
parent | 7b0b9f603bb1215e2b7af23c2404d637b95a4988 (diff) | |
download | haskell-5cee48036ed69ae298a599d43cf72e0fe73e3b4e.tar.gz |
Merge commit '7b0b9f603bb1215e2b7af23c2404d637b95a4988' as 'hadrian'
Diffstat (limited to 'hadrian/src/Main.hs')
-rw-r--r-- | hadrian/src/Main.hs | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/hadrian/src/Main.hs b/hadrian/src/Main.hs new file mode 100644 index 0000000000..52af0adf7c --- /dev/null +++ b/hadrian/src/Main.hs @@ -0,0 +1,59 @@ +module Main (main) where + +import Development.Shake +import Hadrian.Expression +import Hadrian.Utilities + +import qualified Base +import qualified CommandLine +import qualified Environment +import qualified Rules +import qualified Rules.Clean +import qualified Rules.Documentation +import qualified Rules.Install +import qualified Rules.SourceDist +import qualified Rules.Selftest +import qualified Rules.Test +import qualified UserSettings + +main :: IO () +main = do + -- Provide access to command line arguments and some user settings through + -- Shake's type-indexed map 'shakeExtra'. + argsMap <- CommandLine.cmdLineArgsMap + let extra = insertExtra UserSettings.buildProgressColour + $ insertExtra UserSettings.successColour + $ insertExtra UserSettings.userBuildRoot + $ insertExtra (VerboseCommand UserSettings.verboseCommand) argsMap + + BuildRoot buildRoot = UserSettings.userBuildRoot + + rebuild = [ (RebuildLater, buildRoot -/- "stage0//*") + | CommandLine.lookupFreeze1 argsMap ] + + options :: ShakeOptions + options = shakeOptions + { shakeChange = ChangeModtimeAndDigest + , shakeFiles = buildRoot -/- Base.shakeFilesDir + , shakeProgress = progressSimple + , shakeRebuild = rebuild + , shakeTimings = True + , shakeExtra = extra } + + rules :: Rules () + rules = do + Rules.buildRules + Rules.Documentation.documentationRules + Rules.Clean.cleanRules + Rules.Install.installRules + Rules.oracleRules + Rules.Selftest.selftestRules + Rules.SourceDist.sourceDistRules + Rules.Test.testRules + Rules.topLevelTargets + + shakeArgsWith options CommandLine.optDescrs $ \_ targets -> do + Environment.setupEnvironment + return . Just $ if null targets + then rules + else want targets >> withoutActions rules |