PageRenderTime 6ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/Setup.hs

http://github.com/jamwt/Angel
Haskell | 40 lines | 28 code | 8 blank | 4 comment | 0 complexity | cf7de6440e440aaf327e531daf1e9e18 MD5 | raw file
 1#!/usr/bin/env runhaskell
 2import Control.Monad
 3import Distribution.Simple
 4import Distribution.Simple.Setup
 5import Distribution.Simple.Program.Run
 6import Distribution.Simple.UserHooks
 7import Distribution.PackageDescription
 8import Distribution.Verbosity
 9-- import System.Process
10
11
12main :: IO ()
13main = defaultMainWithHooks simpleUserHooks
14    {
15      preTest = myTestHook
16    }
17
18
19-------------------------------------------------------------------------------
20myTestHook
21    :: Args
22    -> TestFlags
23    -> IO HookedBuildInfo
24myTestHook _ _ = do
25    buildTestFixtures
26    return emptyHookedBuildInfo
27
28
29-------------------------------------------------------------------------------
30buildTestFixtures :: IO ()
31buildTestFixtures = do
32  runScript "ghc" ["--make", "test/test_jobs/StubbornJob.hs", "-o", "test/test_jobs/StubbornJob"]
33  runScript "ghc" ["--make", "test/test_jobs/CompliantJob.hs", "-o", "test/test_jobs/CompliantJob"]
34
35
36-------------------------------------------------------------------------------
37runScript :: String -> [String] -> IO ()
38runScript cmd args = do
39  putStrLn $ unwords [cmd, unwords args]
40  runProgramInvocation normal $ simpleProgramInvocation cmd args