on master help sign in
Install build tools one at a time
f9999a5Michael Snoyman
Stackage/Build.hs+15−12
@@ -44,11 +44,9 @@ build settings' bp = do
44 let runCabal args handle = runProcess "cabal" args Nothing menv Nothing (Just handle) (Just handle)
44 let runCabal args handle = runProcess "cabal" args Nothing menv Nothing (Just handle) (Just handle)
45
45
46 -- First install build tools so they can be used below.
46 -- First install build tools so they can be used below.
47− case bpTools bp of
47+ let installBuildTool tool = do
48− [] -> putStrLn "No build tools required"
49− tools -> do
50− putStrLn $ "Installing the following build tools: " ++ unwords tools
48+ putStrLn $ "Installing build tool: " ++ tool
51− ph1 <- withBinaryFile "build-tools.log" WriteMode $ \handle -> do
49+ ec <- withBinaryFile "build-tools.log" WriteMode $ \handle -> do
52 let args = addCabalArgs settings
50 let args = addCabalArgs settings
53 $ "install"
51 $ "install"
54 : ("--cabal-lib-version=" ++ libVersion)
52 : ("--cabal-lib-version=" ++ libVersion)
@@ -56,15 +54,20 @@ build settings' bp = do
56 : "-j"
54 : "-j"
57 : concat
55 : concat
58 [ extraArgs settings
56 [ extraArgs settings
59− , tools
57+ , [tool]
60 ]
58 ]
61 hPutStrLn handle ("cabal " ++ unwords (map (\s -> "'" ++ s ++ "'") args))
59 hPutStrLn handle ("cabal " ++ unwords (map (\s -> "'" ++ s ++ "'") args))
62− runCabal args handle
60+ ph <- runCabal args handle
63− ec2 <- waitForProcess ph1
61+ waitForProcess ph
64− unless (ec2 == ExitSuccess) $ do
62+ unless (ec == ExitSuccess) $ do
63+ putStrLn $ concat
64+ [ "Building of "
65+ , tool
65− putStrLn "Building of build tools failed, please see build-tools.log"
66+ , " failed, please see build-tools.log"
67+ ]
66− exitWith ec2
68+ exitWith ec
67− putStrLn "Build tools built"
69+ putStrLn $ tool ++ " built"
70+ mapM_ installBuildTool $ bpTools bp
68
71
69 ph <- withBinaryFile "build.log" WriteMode $ \handle -> do
72 ph <- withBinaryFile "build.log" WriteMode $ \handle -> do
70 let args = addCabalArgs settings
73 let args = addCabalArgs settings