summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlp Mestanogullari <alpmestan@gmail.com>2020-04-08 09:24:55 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-05-13 20:03:30 -0400
commitd7e0b57fda289e2715e7be86d4871503e3c09ee8 (patch)
tree455eec9a46863ab42a78775c9a6d3843e8115378
parent55e35c0b7e0f4b907dc21d42827b1cea4317226e (diff)
downloadhaskell-d7e0b57fda289e2715e7be86d4871503e3c09ee8.tar.gz
hadrian: add a --freeze2 option to freeze stage 1 and 2
-rw-r--r--hadrian/README.md3
-rw-r--r--hadrian/src/CommandLine.hs14
-rw-r--r--hadrian/src/Main.hs7
3 files changed, 20 insertions, 4 deletions
diff --git a/hadrian/README.md b/hadrian/README.md
index c653d80902..d0efb853f7 100644
--- a/hadrian/README.md
+++ b/hadrian/README.md
@@ -101,6 +101,9 @@ time when you are working on a feature that affects both Stage1 and Stage2
compilers, but may lead to incorrect build results. To unfreeze Stage1 GHC
simply drop the `--freeze1` flag and Hadrian will rebuild all out-of-date files.
+* `--freeze2`: just like `--freeze1` but tell Hadrian to additionally freeze
+Stage2 GHC.
+
* `--integer-simple`: build GHC using the `integer-simple` integer library
(instead of `integer-gmp`).
diff --git a/hadrian/src/CommandLine.hs b/hadrian/src/CommandLine.hs
index 1b111d0b2f..82f25efb6a 100644
--- a/hadrian/src/CommandLine.hs
+++ b/hadrian/src/CommandLine.hs
@@ -1,6 +1,6 @@
module CommandLine (
- optDescrs, cmdLineArgsMap, cmdFlavour, lookupFreeze1, cmdIntegerSimple,
- cmdProgressInfo, cmdConfigure, cmdCompleteSetting,
+ optDescrs, cmdLineArgsMap, cmdFlavour, lookupFreeze1, lookupFreeze2,
+ cmdIntegerSimple, cmdProgressInfo, cmdConfigure, cmdCompleteSetting,
cmdDocsArgs, lookupBuildRoot, TestArgs(..), TestSpeed(..), defaultTestArgs
) where
@@ -24,6 +24,7 @@ data CommandLineArgs = CommandLineArgs
{ configure :: Bool
, flavour :: Maybe String
, freeze1 :: Bool
+ , freeze2 :: Bool
, integerSimple :: Bool
, progressInfo :: ProgressInfo
, buildRoot :: BuildRoot
@@ -38,6 +39,7 @@ defaultCommandLineArgs = CommandLineArgs
{ configure = False
, flavour = Nothing
, freeze1 = False
+ , freeze2 = False
, integerSimple = False
, progressInfo = Brief
, buildRoot = BuildRoot "_build"
@@ -100,8 +102,9 @@ readBuildRoot ms =
set :: BuildRoot -> CommandLineArgs -> CommandLineArgs
set flag flags = flags { buildRoot = flag }
-readFreeze1 :: Either String (CommandLineArgs -> CommandLineArgs)
+readFreeze1, readFreeze2 :: Either String (CommandLineArgs -> CommandLineArgs)
readFreeze1 = Right $ \flags -> flags { freeze1 = True }
+readFreeze2 = Right $ \flags -> flags { freeze1 = True, freeze2 = True }
readIntegerSimple :: Either String (CommandLineArgs -> CommandLineArgs)
readIntegerSimple = Right $ \flags -> flags { integerSimple = True }
@@ -239,6 +242,8 @@ optDescrs =
"Build flavour (Default, Devel1, Devel2, Perf, Prof, Quick or Quickest)."
, Option [] ["freeze1"] (NoArg readFreeze1)
"Freeze Stage1 GHC."
+ , Option [] ["freeze2"] (NoArg readFreeze2)
+ "Freeze Stage2 GHC."
, Option [] ["integer-simple"] (NoArg readIntegerSimple)
"Build GHC with integer-simple library."
, Option [] ["progress-info"] (OptArg readProgressInfo "STYLE")
@@ -336,6 +341,9 @@ lookupBuildRoot = buildRoot . lookupExtra defaultCommandLineArgs
lookupFreeze1 :: Map.HashMap TypeRep Dynamic -> Bool
lookupFreeze1 = freeze1 . lookupExtra defaultCommandLineArgs
+lookupFreeze2 :: Map.HashMap TypeRep Dynamic -> Bool
+lookupFreeze2 = freeze2 . lookupExtra defaultCommandLineArgs
+
cmdIntegerSimple :: Action Bool
cmdIntegerSimple = integerSimple <$> cmdLineArgs
diff --git a/hadrian/src/Main.hs b/hadrian/src/Main.hs
index 36b1fd3cc1..632b742624 100644
--- a/hadrian/src/Main.hs
+++ b/hadrian/src/Main.hs
@@ -30,7 +30,12 @@ main = do
BuildRoot buildRoot = CommandLine.lookupBuildRoot argsMap
rebuild = [ (RebuildLater, buildRoot -/- "stage0/**")
- | CommandLine.lookupFreeze1 argsMap ]
+ | CommandLine.lookupFreeze1 argsMap ||
+ CommandLine.lookupFreeze2 argsMap
+ ] ++
+ [ (RebuildLater, buildRoot -/- "stage1/**")
+ | CommandLine.lookupFreeze2 argsMap
+ ]
cwd <- getCurrentDirectory
shakeColor <- shouldUseColor