Add --skip-flags and pbEnableTests (#3976)

This commit is contained in:
Chris Done 2014-12-31 19:35:25 +01:00
parent c42b61bd4c
commit 787db34739
2 changed files with 11 additions and 3 deletions

View File

@ -4,6 +4,7 @@
module Stackage.CompleteBuild module Stackage.CompleteBuild
( BuildType (..) ( BuildType (..)
, BumpType (..) , BumpType (..)
, BuildFlags (..)
, completeBuild , completeBuild
, justCheck , justCheck
) where ) where
@ -24,6 +25,11 @@ import Stackage.UpdateBuildPlan
import Stackage.Upload import Stackage.Upload
import System.IO (BufferMode (LineBuffering), hSetBuffering) import System.IO (BufferMode (LineBuffering), hSetBuffering)
-- | Flags passed in from the command line.
data BuildFlags = BuildFlags
{ bfEnableTests :: !Bool
} deriving (Show)
data BuildType = Nightly | LTS BumpType data BuildType = Nightly | LTS BumpType
deriving (Show, Read, Eq, Ord) deriving (Show, Read, Eq, Ord)
@ -149,8 +155,8 @@ justCheck = withManager tlsManagerSettings $ \man -> do
putStrLn "Plan seems valid!" putStrLn "Plan seems valid!"
completeBuild :: BuildType -> IO () completeBuild :: BuildType -> BuildFlags -> IO ()
completeBuild buildType = withManager tlsManagerSettings $ \man -> do completeBuild buildType buildFlags = withManager tlsManagerSettings $ \man -> do
hSetBuffering stdout LineBuffering hSetBuffering stdout LineBuffering
putStrLn $ "Loading settings for: " ++ tshow buildType putStrLn $ "Loading settings for: " ++ tshow buildType
@ -170,6 +176,7 @@ completeBuild buildType = withManager tlsManagerSettings $ \man -> do
, pbLog = hPut stdout , pbLog = hPut stdout
, pbJobs = 8 , pbJobs = 8
, pbGlobalInstall = False , pbGlobalInstall = False
, pbEnableTests = bfEnableTests buildFlags
} }
performBuild pb >>= mapM_ putStrLn performBuild pb >>= mapM_ putStrLn

View File

@ -61,6 +61,7 @@ data PerformBuild = PerformBuild
, pbJobs :: Int , pbJobs :: Int
, pbGlobalInstall :: Bool , pbGlobalInstall :: Bool
-- ^ Register packages in the global database -- ^ Register packages in the global database
, pbEnableTests :: Bool
} }
data PackageInfo = PackageInfo data PackageInfo = PackageInfo
@ -378,7 +379,7 @@ singleBuild pb@PerformBuild {..} SingleBuild {..} =
runTests = wf testOut $ \outH -> do runTests = wf testOut $ \outH -> do
let run = runChild outH let run = runChild outH
when (pcTests /= Don'tBuild) $ do when (pbEnableTests && pcTests /= Don'tBuild) $ do
log' $ "Test configure " ++ namever log' $ "Test configure " ++ namever
run "cabal" $ "configure" : "--enable-tests" : configArgs run "cabal" $ "configure" : "--enable-tests" : configArgs