-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Build system library, like Make, but properly supports generated files. -- -- WARNING: Shake has only been lightly tested, and there will be -- bugs (please report them). The interface is likely to change, although -- hopefully not significantly. It would be unwise to build a critical -- production system on top of the current version of Shake. -- -- Shake is a Haskell library for writing build systems - designed as a -- replacement for make. To use Shake the user writes a Haskell program -- that imports the Shake library, defines some build rules, and calls -- shake. Thanks to do notation and infix operators, a simple Shake -- program is not too dissimilar from a simple Makefile. However, as -- build systems get more complex, Shake is able to take advantage of the -- excellent abstraction facilities offered by Haskell and easily support -- much larger projects. -- -- The Shake library provides all the standard features available in -- other build systems, including automatic parallelism and minimal -- rebuilds. Shake provides highly accurate dependency tracking, -- including seamless support for generated files, and dependencies on -- system information (i.e. compiler version). Shake will eventually be -- able to produce profile reports, indicating which files and take -- longest to build, and providing an analysis of the parallelism. -- -- The theory behind an old version of Shake is described in a video at -- http://vimeo.com/15465133, and an example is given at the top -- of Development.Shake. Some further examples are included in the -- Cabal tarball, under the Examples directory. @package shake @version 0.1.2 -- | A module for FilePath operations, to be used instead of -- System.FilePath when writing build systems. In build systems, -- when using the file name as a key for indexing rules, it is important -- that two different strings do not refer to the same on-disk file. We -- therefore follow the conventions: -- -- module Development.Shake.FilePath -- | Drop the first directory from a FilePath. Should only be used -- on relative paths. -- --
--   dropDirectory1 "aaa/bbb" == "bbb"
--   dropDirectory1 "aaa/" == ""
--   dropDirectory1 "aaa" == ""
--   dropDirectory1 "" == ""
--   
dropDirectory1 :: FilePath -> FilePath -- | Take the first component of a FilePath. Should only be used on -- relative paths. -- --
--   takeDirectory1 "aaa/bbb" == "aaa"
--   takeDirectory1 "aaa/" == "aaa"
--   takeDirectory1 "aaa" == "aaa"
--   
takeDirectory1 :: FilePath -> FilePath -- | Normalise a FilePath, translating any path separators to -- /. normalise :: FilePath -> FilePath -- | Convert to native path separators, namely \ on Windows. toNative :: FilePath -> FilePath -- | Combine two file paths, an alias for combine. () :: FilePath -> FilePath -> FilePath -- | Combine two file paths. Any leading ./ or ../ -- components in the right file are eliminated. -- --
--   combine "aaa/bbb" "ccc" == "aaa/bbb/ccc"
--   combine "aaa/bbb" "./ccc" == "aaa/bbb/ccc"
--   combine "aaa/bbb" "../ccc" == "aaa/ccc"
--   
combine :: FilePath -> FilePath -> FilePath -- | Main module for defining Shake build systems. You may also want to -- include Development.Shake.FilePath, for manipulating file -- paths. As a simple example, let us build a result.tar file -- from the contents of result.txt: -- --
--   import Development.Shake
--   import Development.Shake.FilePath
--   
--   main = shake shakeOptions $ do
--       want ["result.tar"]
--       "*.tar" *> out -> do
--           contents <- readFileLines $ replaceExtension out "txt"
--           need contents
--           system' "tar" $ ["-cf",out] ++ contents
--   
-- -- For the background theory behind a previous version of Shake the -- online video: http://vimeo.com/15465133. module Development.Shake -- | Main entry point for running Shake build systems. For an example see -- Development.Shake. shake :: ShakeOptions -> Rules () -> IO () -- | Options to control shake. data ShakeOptions ShakeOptions :: FilePath -> Int -> Int -> Int -> ShakeOptions -- | Where shall I store the database and journal files (defaults to -- .). shakeFiles :: ShakeOptions -> FilePath -- | What is the maximum number of rules I should run in parallel (defaults -- to 1). shakeParallel :: ShakeOptions -> Int -- | What is the version of your build system, increment to force a -- complete rebuild. shakeVersion :: ShakeOptions -> Int -- | 1 = normal, 0 = quiet, 2 = loud. shakeVerbosity :: ShakeOptions -> Int -- | The default set of ShakeOptions. shakeOptions :: ShakeOptions -- | This function is not actually exported, but Haddock is buggy. Please -- ignore. run :: ShakeOptions -> Rules () -> IO () -- | Define a pair of types that can be used by Shake rules. class (Show key, Typeable key, Eq key, Hashable key, Binary key, Show value, Typeable value, Eq value, Hashable value, Binary value) => Rule key value | key -> value validStored :: Rule key value => key -> value -> IO Bool -- | Define a set of rules. Rules can be created with calls to rule, -- defaultRule or action. Rules are combined with either -- the Monoid instance, or more commonly using the Monad -- instance and do notation. data Rules a -- | Like rule, but lower priority, if no rule exists then -- defaultRule is checked. All default rules must be disjoint. defaultRule :: Rule key value => (key -> Maybe (Action value)) -> Rules () -- | Add a rule to build a key, returning an appropriate Action. All -- rules must be disjoint. To define lower priority rules use -- defaultRule. rule :: Rule key value => (key -> Maybe (Action value)) -> Rules () -- | Run an action, usually used for specifying top-level requirements. action :: Action a -> Rules () -- | The Action monad, use liftIO to raise IO actions -- into it, and need to execute files. Action values are used by -- rule and action. data Action a -- | Execute a rule, returning the associated values. If possible, the -- rules will be run in parallel. This function requires that appropriate -- rules have been added with rule or defaultRule. apply :: Rule key value => [key] -> Action [value] -- | Apply a single rule, equivalent to calling apply with a -- singleton list. Where possible, use apply to allow the -- potential for parallelism. apply1 :: Rule key value => key -> Action value -- | Write an action to the trace list, along with the start/end time of -- running the IO action. The system' command automatically -- calls traced. traced :: String -> IO a -> Action a -- | Get the Key for the currently executing rule - usally used to -- improve error messages. Returns Nothing if being run by -- action. currentRule :: Action (Maybe Key) -- | Write a message to the output when the verbosity is appropriate. The -- output will not be interleaved with any other Shake messages (other -- than those generated by system commands). putLoud, putQuiet, putNormal :: String -> Action () -- | Execute a system command. This function will raise an error if the -- exit code is non-zero. Before running system' make sure you -- need any required files. system' :: FilePath -> [String] -> Action () -- | copyFile old new copies the existing file from old -- to new. The old file is has need called on it -- before copying the file. copyFile' :: FilePath -> FilePath -> Action () -- | Read a file, after calling need. readFile' :: FilePath -> Action String -- | Write a file, lifted to the Action monad. writeFile' :: FilePath -> String -> Action () -- | A version of readFile' which also splits the result into lines. readFileLines :: FilePath -> Action [String] -- | A version of writeFile' which writes out a list of lines. writeFileLines :: FilePath -> [String] -> Action () -- | A type synonym for file patterns, containing // and -- *. For the syntax and semantics of FilePattern see -- ?==. type FilePattern = String -- | Require that the following files are built before continuing. -- Particularly necessary when calling system'. As an example: -- --
--   "//*.rot13" *> \out -> do
--       let src = dropExtension out
--       need [src]
--       system' ["rot13",src,"-o",out]
--   
need :: [FilePath] -> Action () -- | Require that the following are built by the rules, used to specify the -- target. -- --
--   main = shake shakeOptions $ do
--      want ["Main.exe"]
--      ...
--   
-- -- This program will build Main.exe, given sufficient rules. want :: [FilePath] -> Rules () -- | This function is not actually exported, but Haddock is buggy. Please -- ignore. defaultRuleFile :: Rules () -- | Match a FilePattern against a FilePath, There are only -- two special forms: -- -- -- -- Some examples that match: -- --
--   "//*.c" ?== "foo/bar/baz.c"
--   "*.c" ?== "baz.c"
--   "test.c" ?== "test.c"
--   
(?==) :: FilePattern -> FilePath -> Bool -- | Define a rule that matches a FilePattern. No file required by -- the system must be matched by more than one pattern. For the pattern -- rules, see ?==. -- --
--   "*.asm.o" *> \out -> do
--       let src = dropExtension out
--       need [src]
--       system' ["as",src,"-o",out]
--   
-- -- To define a build system for multiple compiled languages, we recommend -- using .asm.o, .cpp.o, .hs.o, to indicate -- which language produces an object file. (*>) :: FilePattern -> (FilePath -> Action ()) -> Rules () -- | Define a set of patterns, and if any of them match, run the associate -- rule. See *>. (**>) :: [FilePattern] -> (FilePath -> Action ()) -> Rules () -- | Define a rule to build files. If the first argument returns -- True for a given file, the second argument will be used to -- build it. Usually *> is sufficient, but ?> gives -- additional power. For any file used by the build system, only one rule -- should return True. -- --
--   (all isUpper . takeBaseName) *> \out -> do
--       let src = replaceBaseName out $ map toLower $ takeBaseName out
--       writeFile' . map toUpper =<< readFile' src
--   
(?>) :: (FilePath -> Bool) -> (FilePath -> Action ()) -> Rules () -- | Returns True if the file exists. doesFileExist :: FilePath -> Action Bool -- | Get the contents of a directory. The result will be sorted, and will -- not contain the files . or .. (unlike the standard -- Haskell version). It is usually better to call either -- getDirectoryFiles or getDirectoryDirs. The resulting -- paths will be relative to the first argument. getDirectoryContents :: FilePath -> Action [FilePath] -- | Get the files in a directory that match a particular pattern. For the -- interpretation of the pattern see ?==. getDirectoryFiles :: FilePath -> FilePattern -> Action [FilePath] -- | Get the directories contained by a directory, does not include -- . or ... getDirectoryDirs :: FilePath -> Action [FilePath] -- | This function is not actually exported, but Haddock is buggy. Please -- ignore. defaultRuleDirectory :: Rules ()