2 import Distribution
.Simple
3 import qualified Control
.Exception
as Ex
4 import qualified Tests
.Properties
as P
5 import System
.Directory
14 ["util" </> "unlambda"] -- files to remove
19 , "Infinity" </> "Plugins"] -- directories to clean
21 main
= defaultMainWithHooks
$ defaultUserHooks
{
23 postBuild
= copyInfinity
,
24 postClean
= cleanInfinity
27 tests _ _ _ _
= P
.main
29 copyInfinity _ _ _ _
= do
30 copyFile
(joinPath
["dist","build","infinity",inf
]) inf
31 ignore
(createDirectory "Log" >> createDirectory "State")
33 cleanInfinity _ _ _ _
= do
34 mapM_ (ignore
. removeFile) bins
37 clean d
= getDirectoryContents d
>>= mapM_ (check d
)
38 check d f
= when (any (`
isSuffixOf` f
) exts
)
39 (removeFile (d
</> f
))
40 exts
= ["~",".o",".hi",".o-boot",".hi-boot"]
44 ignore a
= Ex
.catch a
(\_
-> return ())