/
Setup.lhs
executable file
·55 lines (43 loc) · 1.15 KB
/
Setup.lhs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#! /usr/bin/env runhaskell
\begin{code}
{-# OPTIONS -Wall #-}
-----------------------------------------------------------------------------
-- |
-- Module : Setup
-- Copyright : (c) 2008, 2009 Universiteit Utrecht
-- License : BSD3
--
-- Maintainer : generics@haskell.org
-----------------------------------------------------------------------------
module Main (main) where
import System.Cmd
( system
)
import System.FilePath
( (</>)
)
import Distribution.Simple
( defaultMainWithHooks
, simpleUserHooks
, UserHooks(runTests)
, Args
)
import Distribution.Simple.LocalBuildInfo
( LocalBuildInfo
)
import Distribution.PackageDescription
( PackageDescription
)
main :: IO ()
main = defaultMainWithHooks hooks
where
hooks = simpleUserHooks
{ runTests = runTests'
}
-- Run a 'test' binary that gets built when configured with '-ftest'.
runTests' :: Args -> Bool -> PackageDescription -> LocalBuildInfo -> IO ()
runTests' _ _ _ _ = system cmd >> return ()
where testdir = "dist" </> "build" </> "test"
testcmd = "." </> "test"
cmd = "cd " ++ testdir ++ " && " ++ testcmd
\end{code}