7import Control.Monad (unless)
8import Prelude hiding (pi)
9import Stackage.CheckCabalVersion (checkCabalVersion)
11import Stackage.InstallInfo
14import System.Exit (ExitCode (ExitSuccess), exitWith)
15import System.IO (IOMode (WriteMode), hPutStrLn,
17import System.Process (rawSystem, runProcess,
20defaultBuildSettings :: BuildSettings
21defaultBuildSettings = BuildSettings
22 { sandboxRoot = "sandbox"
23 , expectedFailuresBuild = defaultExpectedFailures
24 , extraArgs = const ["-fnetwork23"]
25 , testWorkerThreads = 4
28build :: BuildSettings -> BuildPlan -> IO ()
29build settings' bp = do
30 libVersion <- checkCabalVersion
32 putStrLn "Wiping out old sandbox folder"
33 rm_r $ sandboxRoot settings'
35 settings <- fixBuildSettings settings'
37 putStrLn "Creating new package database"
38 ec1 <- rawSystem "ghc-pkg" ["init", packageDir settings]
39 unless (ec1 == ExitSuccess) $ do
40 putStrLn "Unable to create package database via ghc-pkg init"
43 menv <- fmap Just $ getModifiedEnv settings
44 let runCabal args handle = runProcess "cabal" args Nothing menv Nothing (Just handle) (Just handle)
46 -- First install build tools so they can be used below.
47 let installBuildTool tool = do
48 putStrLn $ "Installing build tool: " ++ tool
49 ec <- withBinaryFile "build-tools.log" WriteMode $ \handle -> do
50 let args = addCabalArgs settings BSBuild
52 : ("--cabal-lib-version=" ++ libVersion)
53 : "--build-log=logs-tools/$pkg.log"
56 hPutStrLn handle ("cabal " ++ unwords (map (\s -> "'" ++ s ++ "'") args))
57 ph <- runCabal args handle
59 unless (ec == ExitSuccess) $ do
63 , " failed, please see build-tools.log"
66 putStrLn $ tool ++ " built"
67 mapM_ installBuildTool $ bpTools bp
69 putStrLn "Beginning Stackage build"
70 ph <- withBinaryFile "build.log" WriteMode $ \handle -> do
71 let args = addCabalArgs settings BSBuild
73 : ("--cabal-lib-version=" ++ libVersion)
74 : "--build-log=logs/$pkg.log"
79 hPutStrLn handle ("cabal " ++ unwords (map (\s -> "'" ++ s ++ "'") args))
81 ec <- waitForProcess ph
82 unless (ec == ExitSuccess) $ do
83 putStrLn "Build failed, please see build.log"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list