Coadjute 0.0.1 → 0.1.0
raw patch · 7 files changed
+35/−64 lines, 7 filesdep −regex-dfadep ~arraydep ~containersdep ~pureMD5
Dependencies removed: regex-dfa
Dependency ranges changed: array, containers, pureMD5
Files
- CHANGELOG.txt +9/−0
- Coadjute.cabal +6/−7
- Coadjute.hs +6/−13
- Coadjute/CoData.hs +2/−8
- Coadjute/Rule.hs +8/−32
- Coadjute/Task/Perform.hs +3/−3
- LICENSE.txt +1/−1
CHANGELOG.txt view
@@ -1,3 +1,12 @@+0.1.0, 2010-04-01:+ Got rid of the regex-dfa dependency.++ Dropped all the Datum stuff. New rule* signatures:+ rule :: String -> [String] -> ([Source] -> Target -> IO ()) -> [([Source],Target)] -> Coadjute ()+ ruleM :: String -> [String] -> ([Source] -> [Target] -> IO ()) -> [([Source],[Target])] -> Coadjute ()+ rule' :: String -> ([Source] -> Target -> IO ()) -> [([Source],Target)] -> Coadjute ()+ ruleM' :: String -> ([Source] -> [Target] -> IO ()) -> [([Source],[Target])] -> Coadjute ()+ 0.0.1, 2009-01-18: Initial release.
Coadjute.cabal view
@@ -1,7 +1,7 @@ Cabal-Version: >= 1.2 Name: Coadjute-Version: 0.0.1+Version: 0.1.0 Homepage: http://iki.fi/matti.niemenmaa/coadjute/ Synopsis: A generic build tool Category: Development@@ -11,7 +11,7 @@ portable replacement for make. It's not tailored toward any particular language, and is not meant to replace tools which target a specific environment.-+ . Portability is striven towards in two ways: - You don't have to deal with the idiosyncrasies of many make implementations (well, people don't, but they call their GNU Make files makefiles@@ -19,7 +19,7 @@ - You have Haskell at your disposal, and are encouraged to use that whenever possible instead of system-specific binaries like the POSIX commands we all know and love.-+ . With support for: - Parallel task performing. - Advanced out-of-dateness detection:@@ -43,9 +43,9 @@ Library Build-Depends: base >= 4 && < 5- , array >= 0.1 && < 0.3+ , array >= 0.1 && < 0.4 , bytestring >= 0.9 && < 0.10- , containers >= 0.2 && < 0.3+ , containers >= 0.2 && < 0.4 , directory >= 1.0 && < 1.1 , filepath >= 1.1 && < 1.2 , mtl >= 1.1 && < 1.2@@ -53,8 +53,7 @@ , pretty >= 1.0.1 && < 1.1 , bytestring-csv >= 0.1.2 && < 0.2 , fgl >= 5.4 && < 5.5- , pureMD5 >= 0.2.4 && < 0.3- , regex-dfa >= 0.91 && < 1+ , pureMD5 >= 0.2.4 && < 1.2 , safe >= 0.2 && < 0.3 , utf8-string >= 0.3 && < 0.4
Coadjute.hs view
@@ -32,26 +32,19 @@ -- ** Defining rules -- $rules , rule, ruleM- , sourceToDatum- -- *** Convenience functions -- $convenience , rule', ruleM'- , sourceToDatum' -- ** Other functions within Coadjute , getUserArgs -- ** Sources and Targets -- $sourcesTargets , Source, Target- -- * TaskDatum- -- $taskdata- , TaskDatum, SingleDatum, MultiDatum ) where import Coadjute.Main (coadjute) import Coadjute.Rule ( Coadjute , rule, rule', ruleM, ruleM'- , sourceToDatum, sourceToDatum', getUserArgs- , TaskDatum, SingleDatum, MultiDatum+ , getUserArgs ) import Coadjute.Task (Source, Target) @@ -71,22 +64,22 @@ -- -- Each function takes: ----- * A name for the rule.+-- * A name for the rule. (Currently only used in error messages.) -- -- * A build action: this function will be run if the dependencies are deemed -- out of date compared to the target. ----- * 'TaskDatum's: dependencies paired up with targets.+-- * A list of dependencies paіred with one or more targets. -- -- For instance, you might have a rule \"C files\" which handles building of C -- code, thus: -- -- > rule' "C files" -- > (\_ c -> system ("gcc -c " ++ c))--- > (sourceToDatum' (reverse.('o':).drop 1 . reverse) ["foo.c","bar.c"])+-- > [(["foo.c"],"foo.o"), (["bar.c"],"bar.o")] ----- This example also demonstrates poor practices: you should really use--- 'sourceToDatum' and specify complete dependency data, such as header files.+-- This example also demonstrates poor practices: you should really specify+-- complete dependency data, such as header files. -- -- The above example did not use command line arguments, so let's have a look -- at those. Let's say you want to build either a debug or a release version of
Coadjute/CoData.hs view
@@ -34,7 +34,6 @@ import System.IO (hPutStrLn, stderr) import Text.Printf (printf) import Text.PrettyPrint.HughesPJ (renderStyle, style, Style(..), fsep, text)-import Text.Regex.DFA import Coadjute.Util.Misc (mread) @@ -200,14 +199,9 @@ prettify = renderStyle (style {lineLength = 80}) . fsep . map text . words -helpRegex :: Regex-helpRegex =- makeRegexOpts CompOption { caseSensitive = False, multiline = False }- defaultExecOpt- "^(--?|/)([?]|h(e?lp)?)$"- isHelp :: String -> Bool-isHelp = matchTest helpRegex+isHelp = flip elem [ pre ++ opt | pre <- ["-","/","--"]+ , opt <- ["?","h","hlp","help"] ] handleNonOpt :: String -> String -> OptionData -> OptionData handleNonOpt helpString opt (cd,s) =
Coadjute/Rule.hs view
@@ -2,15 +2,13 @@ -- |Holds the 'Rule' and 'Coadjute' types and relevant functions which act on -- them. For user code, the important parts here are the 'rule' family of--- functions and sourceToDatum.+-- functions. module Coadjute.Rule( Rule(..), Coadjute, runCoadjute, getUserArgs, rule, ruleM,- rule', ruleM',- sourceToDatum, sourceToDatum',- TaskDatum, SingleDatum, MultiDatum+ rule', ruleM' ) where import Control.Arrow (first)@@ -55,58 +53,36 @@ getUserArgs :: Coadjute [String] getUserArgs = Co $ gets snd -newtype TaskDatum a = TD ([Source], a)---- | A SingleDatum stores a single 'Target'.-type SingleDatum = TaskDatum Target---- | A MultiDatum stores multiple 'Target's, to be built all at once in one--- action.-type MultiDatum = TaskDatum [Target]- -- |A rule for building targets individually. rule :: String -> [String] -> ([Source] -> Target -> IO ())- -> [SingleDatum]+ -> [([Source],Target)] -> Coadjute () rule name args action = Co . modify . first . addRule . Rule name .- map (\(TD (d, t)) -> Task name (Set.fromList args) [t] d (action d t))+ map (\(d,t) -> Task name (Set.fromList args) [t] d (action d t)) -- |A rule for building multiple targets at once. ruleM :: String -> [String] -> ([Source] -> [Target] -> IO ())- -> [MultiDatum]+ -> [([Source],[Target])] -> Coadjute () ruleM name args action = Co . modify . first . addRule . Rule name .- map (\(TD (d, t)) -> Task name (Set.fromList args) t d (action d t))+ map (\(d,t) -> Task name (Set.fromList args) t d (action d t)) -- | > rule' = flip rule [] rule' :: String -> ([Source] -> Target -> IO ())- -> [SingleDatum]+ -> [([Source],Target)] -> Coadjute () rule' = flip rule [] -- | > ruleM' = flip ruleM [] ruleM' :: String -> ([Source] -> [Target] -> IO ())- -> [MultiDatum]+ -> [([Source],[Target])] -> Coadjute () ruleM' = flip ruleM []---- |Use a supplied function of type @Source -> ([Source], Target)@ or @Source--- -> ([Source], [Target])@ to turn a list of Sources to 'SingleDatum's or--- 'MultiDatum's, for passing to one of the 'rule' functions.------ The original Source is prepended to the list of dependencies in the Datum.-sourceToDatum :: (Source -> ([Source], a)) -> [Source] -> [TaskDatum a]-sourceToDatum f = map (\x -> TD $ first (x:) (f x))---- |A convenience around 'sourceToDatum' for when you don't wish to provide--- extra dependencies.-sourceToDatum' :: (Source -> a) -> [Source] -> [TaskDatum a]-sourceToDatum' f = sourceToDatum ((,) [] . f)
Coadjute/Task/Perform.hs view
@@ -104,7 +104,7 @@ io$ do when (verbosity >= Verbose) $ do let n = noNodes gr- printf "Performing %d task%s in parallel, " n (plural n)+ printf "Performing %d task%s in parallel, " n (plural n) :: IO () case cap of Nothing -> putStrLn "with no limit to the simultaneity." Just c -> printf "running at most %d at a time.\n" c@@ -116,7 +116,7 @@ -- set the manager thread rolling managerDone <- newEmptyMVar managerChan <- newChan- forkIO $ do+ _ <- forkIO $ do manage verbosity cap managerChan putMVar managerDone () @@ -149,7 +149,7 @@ KeepGoing task doneChan -> do maybe (return ()) wait cap printMessage verbosity task- forkIO $ do+ _ <- forkIO $ do s <- performTask task when (not.null $ s) (writeChan chan (ErrorMessage s)) writeChan doneChan ()
LICENSE.txt view
@@ -1,4 +1,4 @@-Copyright (c) 2008-2009, Matti Niemenmaa+Copyright (c) 2008-2010, Matti Niemenmaa All rights reserved. Redistribution and use in source and binary forms, with or without