7import Distribution.Text (simpleParse)
8import Control.Monad (unless)
10import Stackage.CheckPlan
11import Stackage.InstallInfo
12import Stackage.Tarballs
16import System.Exit (ExitCode (ExitSuccess), exitWith)
17import System.IO (IOMode (WriteMode), withBinaryFile)
18import System.Process (runProcess, waitForProcess, rawSystem, readProcess)
19import System.Directory (createDirectoryIfMissing, canonicalizePath)
20import Distribution.Version (thisVersion, withinRange)
21import Control.Exception (assert)
23defaultBuildSettings :: BuildSettings
24defaultBuildSettings = BuildSettings
25 { sandboxRoot = "sandbox"
27 , extraCore = defaultExtraCore
28 , expectedFailures = defaultExpectedFailures
29 , stablePackages = defaultStablePackages
30 , extraArgs = ["-fnetwork23"]
31 , haskellPlatformCabal = "haskell-platform/haskell-platform.cabal"
32 , requireHaskellPlatform = True
35build :: BuildSettings -> IO ()
37 putStrLn "Creating a build plan"
38 ii <- getInstallInfo settings'
40 putStrLn "Wiping out old sandbox folder"
41 let root' = sandboxRoot settings'
44 createDirectoryIfMissing True root'
45 root <- canonicalizePath root'
46 let settings = settings' { sandboxRoot = root }
48 ec1 <- rawSystem "ghc-pkg" ["init", packageDir settings]
49 unless (ec1 == ExitSuccess) $ do
50 putStrLn "Unable to create package database via ghc-pkg init"
54 putStrLn "No mismatches, starting the sandboxed build."
56 versionString <- readProcess "cabal" ["--version"] ""
58 case map words $ lines versionString of
59 [_,["using","version",libVersion,"of","the","Cabal","library"]] -> return libVersion
60 _ -> error "Did not understand cabal --version output"
62 case (simpleParse libVersion, simpleParse ">= 1.16") of
63 (Nothing, _) -> error $ "Invalid Cabal library version: " ++ libVersion
64 (_, Nothing) -> assert False $ return ()
66 | v `withinRange` vr -> return ()
67 | otherwise -> error $ "Unsupported Cabal version: " ++ libVersion
69 ph <- withBinaryFile "build.log" WriteMode $ \handle ->
70 let args = addCabalArgs settings
72 : ("--cabal-lib-version=" ++ libVersion)
73 : "--build-log=logs/$pkg.log"
76 [ extraBuildArgs settings
80 in runProcess "cabal" args Nothing Nothing Nothing (Just handle) (Just handle)
81 ec <- waitForProcess ph
82 unless (ec == ExitSuccess) $ do
83 putStrLn "Build failed, please see build.log"
86 putStrLn "Sandbox built, beginning individual test suites"
87 runTestSuites settings ii
89 putStrLn "All test suites that were expected to pass did pass, building tarballs."
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