@@ -47,15 +47,17 @@ data BuildArgs = BuildArgs
4747 , buildPlanSrc :: FilePath
4848 , extraArgs' :: [String] -> [String]
4949 , noDocs :: Bool
50+ , buildCores :: Maybe Int
5051 }
5152
5253parseBuildArgs :: GhcMajorVersion -> [String] -> IO BuildArgs
5354parseBuildArgs version =
5455 loop BuildArgs
55− { sandbox = sandboxRoot $ defaultBuildSettings version
56+ { sandbox = sandboxRoot $ defaultBuildSettings Nothing version
5657 , buildPlanSrc = defaultBuildPlan
5758 , extraArgs' = id
5859 , noDocs = False
60+ , buildCores = Nothing
5961 }
6062 where
6163 loop x [] = return x
@@ -63,6 +65,7 @@ parseBuildArgs version =
6365 loop x ("--build-plan":y:rest) = loop x { buildPlanSrc = y } rest
6466 loop x ("--arg":y:rest) = loop x { extraArgs' = extraArgs' x . (y:) } rest
6567 loop x ("--no-docs":rest) = loop x { noDocs = True } rest
68+ loop x ("-j":y:rest) = loop x { buildCores = Just $ read y } rest
6669 loop _ (y:_) = error $ "Did not understand argument: " ++ y
6770
6871defaultBuildPlan :: FilePath
@@ -73,9 +76,10 @@ withBuildSettings args f = do
7376 version <- getGhcVersion
7477 BuildArgs {..} <- parseBuildArgs version args
7578 bp <- readBuildPlan buildPlanSrc
76− let settings = (defaultBuildSettings version)
79+ let bs = defaultBuildSettings buildCores version
80+ let settings = bs
7781 { sandboxRoot = sandbox
78− , extraArgs = extraArgs' . extraArgs (defaultBuildSettings version)
82+ , extraArgs = extraArgs' . extraArgs bs
7983 , buildDocs = not noDocs
8084 }
8185 f settings bp