shake 0.14 → 0.14.1
raw patch · 8 files changed
+40/−18 lines, 8 filesdep ~unordered-containers
Dependency ranges changed: unordered-containers
Files
- CHANGES.txt +4/−0
- README.md +1/−1
- html/shake-progress.js +1/−1
- html/shake-ui.js +1/−1
- shake.cabal +3/−3
- src/Development/Shake.hs +2/−2
- src/Development/Shake/Rules/Files.hs +21/−10
- src/Test/Files.hs +7/−0
CHANGES.txt view
@@ -1,5 +1,9 @@ Changelog for Shake +0.14.1+ #196, change the links to point at http://www.shakebuild.com/+ Improve the error messages when &%> or &?> go wrong+ Normalise file patterns used by &?> 0.14 Make FilePattern on Windows cope with all path separators Rename normalise to normaliseEx
README.md view
@@ -1,4 +1,4 @@-# Shake [](http://hackage.haskell.org/package/shake) [](https://travis-ci.org/ndmitchell/shake)+# Shake [](https://hackage.haskell.org/package/shake) [](https://travis-ci.org/ndmitchell/shake) Shake is a tool for writing build systems - an alternative to make, Scons, Ant etc. Shake has been used commercially for over five years, running thousands of builds per day.
html/shake-progress.js view
@@ -14,7 +14,7 @@ // } $(function(){- $(".version").html("Generated by <a href='https://github.com/ndmitchell/shake#readme'>Shake " + version + "</a>.");+ $(".version").html("Generated by <a href='http://www.shakebuild.com/'>Shake " + version + "</a>."); $("#output").html(""); for (var i = 0; i < shake.length; i++) {
html/shake-ui.js view
@@ -204,7 +204,7 @@ for (var i = 0; i < res.length; i++) s += "<li>" + res[i] + "</li>"; s += "</ul>";- s += "<p class='version'>Generated by <a href='https://github.com/ndmitchell/shake#readme'>Shake " + version + "</a>.</p>";+ s += "<p class='version'>Generated by <a href='http://www.shakebuild.com/'>Shake " + version + "</a>.</p>"; $("#output").html(s); break;
shake.cabal view
@@ -1,7 +1,7 @@ cabal-version: >= 1.10 build-type: Simple name: shake-version: 0.14+version: 0.14.1 license: BSD3 license-file: LICENSE category: Development@@ -15,7 +15,7 @@ including an example. Further examples are included in the Cabal tarball, under the @Examples@ directory. The homepage contains links to a user manual, an academic paper and further information:- <https://github.com/ndmitchell/shake>+ <http://www.shakebuild.com/> . To use Shake the user writes a Haskell program that imports "Development.Shake", defines some build rules, and calls@@ -29,7 +29,7 @@ Shake also provides more accurate dependency tracking, including seamless support for generated files, and dependencies on system information (e.g. compiler version).-homepage: https://github.com/ndmitchell/shake#readme+homepage: http://www.shakebuild.com/ bug-reports: https://github.com/ndmitchell/shake/issues tested-with: GHC==7.8.3, GHC==7.6.3, GHC==7.4.2, GHC==7.2.2 extra-source-files:
src/Development/Shake.hs view
@@ -30,9 +30,9 @@ -- To find out more: -- -- * The user manual contains a longer example and background information on how to use Shake--- <https://github.com/ndmitchell/shake/blob/master/docs/Manual.md#readme>.+-- <http://www.shakebuild.com/manual>. ----- * The home page has links to additional information <https://github.com/ndmitchell/shake#readme>, including+-- * The home page has links to additional information <http://www.shakebuild.com/>, including -- a mailing list. -- -- * The theory behind Shake is described in an ICFP 2012 paper, /Shake Before Building -- Replacing Make with Haskell/
src/Development/Shake/Rules/Files.hs view
@@ -15,9 +15,9 @@ import Development.Shake.Classes import Development.Shake.Rules.File import Development.Shake.FilePattern+import Development.Shake.FilePath import Development.Shake.Types--import System.FilePath(takeDirectory) -- important that this is the system local filepath, or wrong slashes go wrong+import Development.Shake.ByteString infix 1 &?>, &%>@@ -64,13 +64,13 @@ -- Think of it as the OR (@||@) equivalent of '%>'. (&%>) :: [FilePattern] -> ([FilePath] -> Action ()) -> Rules () ps &%> act- | not $ compatible ps = error $- "All patterns to &%> must have the same number and position of // and * wildcards\n" ++- unwords ps+ | not $ compatible ps = error $ unlines $+ ["All patterns to &%> must have the same number and position of // and * wildcards"] +++ ["* " ++ p ++ (if compatible [p, head ps] then "" else " (incompatible)") | p <- ps] | otherwise = do forM_ ps $ \p -> p %> \file -> do- _ :: FilesA <- apply1 $ FilesQ $ map (FileQ . packU . substitute (extract p file)) ps+ _ :: FilesA <- apply1 $ FilesQ $ map (FileQ . packU_ . filepathNormalise . unpackU_ . packU . substitute (extract p file)) ps return () (if all simple ps then id else priority 0.5) $ rule $ \(FilesQ xs_) -> let xs = map (unpackU . fromFileQ) xs_ in@@ -101,15 +101,26 @@ -- Regardless of whether @Foo.hi@ or @Foo.o@ is passed, the function always returns @[Foo.hi, Foo.o]@. (&?>) :: (FilePath -> Maybe [FilePath]) -> ([FilePath] -> Action ()) -> Rules () (&?>) test act = priority 0.5 $ do- let checkedTest x = case test x of+ let norm = toStandard . normaliseEx+ let inputOutput suf inp out =+ ["Input" ++ suf ++ ":", " " ++ inp] +++ ["Output" ++ suf ++ ":"] ++ map (" "++) out+ let normTest = fmap (map norm) . test+ let checkedTest x = case normTest x of Nothing -> Nothing- Just ys | x `elem` ys && all ((== Just ys) . test) ys -> Just ys- | otherwise -> error $ "Invariant broken in &?> when trying on " ++ x+ Just ys | x `notElem` ys -> error $ unlines $+ ["Invariant broken in &?>, did not return the input (after normalisation)."] +++ inputOutput "" x ys+ Just ys | bad:_ <- filter ((/= Just ys) . normTest) ys -> error $ unlines $+ ["Invariant broken in &?>, not equal for all arguments (after normalisation)."] +++ inputOutput "1" x ys +++ inputOutput "2" bad (fromMaybe ["Nothing"] $ normTest bad)+ Just ys -> Just ys isJust . checkedTest ?> \x -> do -- FIXME: Could optimise this test by calling rule directly and returning FileA Eq Eq Eq -- But only saves noticable time on uncommon Change modes- _ :: FilesA <- apply1 $ FilesQ $ map (FileQ . packU) $ fromJust $ test x+ _ :: FilesA <- apply1 $ FilesQ $ map (FileQ . packU_ . filepathNormalise . unpackU_ . packU) $ fromJust $ test x return () rule $ \(FilesQ xs_) -> let xs@(x:_) = map (unpackU . fromFileQ) xs_ in
src/Test/Files.hs view
@@ -2,6 +2,7 @@ module Test.Files(main) where import Development.Shake+import Development.Shake.FilePath import Test.Type import Control.Monad import Data.List@@ -26,7 +27,11 @@ writeFile' a "a" writeFile' b "b" + (\x -> let dir = takeDirectory x in+ if takeFileName dir /= "pred" then Nothing else Just [dir </> "a.txt",dir </> "b.txt"]) &?> \outs -> do+ mapM_ (`writeFile'` "") outs + test build obj = do forM_ [[],["@"]] $ \args -> do let nums = unlines . map show@@ -37,3 +42,5 @@ build ["clean"] build ["--no-build","--report=-"] build ["dir1/out.txt"]++ build ["pred/a.txt"]