shake 0.19.6 → 0.19.7
raw patch · 21 files changed
+60/−59 lines, 21 files
Files
- CHANGES.txt +3/−0
- LICENSE +1/−1
- shake.cabal +3/−6
- src/Development/Ninja/Type.hs +1/−1
- src/Development/Shake/Database.hs +1/−1
- src/Development/Shake/Internal/Args.hs +2/−2
- src/Development/Shake/Internal/Core/Build.hs +4/−1
- src/Development/Shake/Internal/Core/Database.hs +1/−1
- src/Development/Shake/Internal/FilePattern.hs +3/−1
- src/Development/Shake/Internal/Rules/Files.hs +1/−1
- src/General/Chunks.hs +1/−1
- src/General/Extra.hs +1/−1
- src/General/Template.hs +5/−0
- src/Test/BuiltinOverride.hs +1/−1
- src/Test/Docs.hs +3/−9
- src/Test/Errors.hs +4/−8
- src/Test/Lint.hs +2/−2
- src/Test/Oracle.hs +2/−5
- src/Test/Self.hs +7/−9
- src/Test/SelfMake.hs +2/−4
- src/Test/Type.hs +12/−4
CHANGES.txt view
@@ -1,5 +1,8 @@ Changelog for Shake (* = breaking change) +0.9.7, released 2022-09-15+ #815, improve corrupt database handling code+ Don't say (changed) for files that don't build 0.19.6, released 2021-09-07 #810, don't hash files in &%> if you don't have to 0.19.5, released 2021-07-04
LICENSE view
@@ -1,4 +1,4 @@-Copyright Neil Mitchell 2011-2021.+Copyright Neil Mitchell 2011-2022. All rights reserved. Redistribution and use in source and binary forms, with or without
shake.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.18 build-type: Simple name: shake-version: 0.19.6+version: 0.19.7 license: BSD3 license-file: LICENSE category: Development, Shake author: Neil Mitchell <ndmitchell@gmail.com> maintainer: Neil Mitchell <ndmitchell@gmail.com>-copyright: Neil Mitchell 2011-2021+copyright: Neil Mitchell 2011-2022 synopsis: Build system library, like Make, but more accurate dependencies. description: Shake is a Haskell library for writing build systems - designed as a@@ -30,7 +30,7 @@ (e.g. compiler version). homepage: https://shakebuild.com bug-reports: https://github.com/ndmitchell/shake/issues-tested-with: GHC==9.0, GHC==8.10, GHC==8.8, GHC==8.6, GHC==8.4, GHC==8.2, GHC==8.0+tested-with: GHC==9.0, GHC==8.10, GHC==8.8, GHC==8.6 extra-doc-files: CHANGES.txt README.md@@ -123,9 +123,6 @@ if flag(cloud) cpp-options: -DNETWORK build-depends: network, network-uri-- if impl(ghc < 8.0)- build-depends: semigroups >= 0.18 exposed-modules: Development.Shake
src/Development/Ninja/Type.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE TupleSections #-} --- | The IO in this module is only to evaluate an envrionment variable,+-- | The IO in this module is only to evaluate an environment variable, -- the 'Env' itself it passed around purely. module Development.Ninja.Type( Str, FileStr,
src/Development/Shake/Database.hs view
@@ -124,7 +124,7 @@ -- -- * The 'SomeException' values are highly likely to be of type 'ShakeException'. ----- * If you want as many errors as possile in one run set @'shakeStaunch'=True@.+-- * If you want as many errors as possible in one run set @'shakeStaunch'=True@. shakeErrorsDatabase :: ShakeDatabase -> IO [(String, SomeException)] shakeErrorsDatabase (ShakeDatabase use s) = withOpen use "shakeErrorsDatabase" id $ \_ ->
src/Development/Shake/Internal/Args.hs view
@@ -91,8 +91,8 @@ -- 'shakeArgsWith' opts flags (\\flagValues argValues -> result) -- @ ----- * @opts@ is the initial 'ShakeOptions' value, which may have some fields overriden by command line flags.--- This argument is usually 'shakeOptions', perhaps with a few fields overriden.+-- * @opts@ is the initial 'ShakeOptions' value, which may have some fields overridden by command line flags.+-- This argument is usually 'shakeOptions', perhaps with a few fields overridden. -- -- * @flags@ is a list of flag descriptions, which either produce a 'String' containing an error -- message (typically for flags with invalid arguments, .e.g. @'Left' \"could not parse as int\"@), or a value
src/Development/Shake/Internal/Core/Build.hs view
@@ -48,7 +48,10 @@ old <- getKeyValueFromId db i let changeStatus = maybe "Missing" (statusType . snd) old ++ " -> " ++ statusType v ++ ", " ++ maybe "<unknown>" (show . fst) old let changeValue = case v of- Ready r -> Just $ " = " ++ showBracket (result r) ++ " " ++ (if built r == changed r then "(changed)" else "(unchanged)")+ Ready r -> Just $ " = " ++ showBracket (result r) ++ " " +++ if changed r == globalStep then "(changed)"+ else if built r == globalStep then "(unchanged)"+ else "(didn't run)" _ -> Nothing pure $ changeStatus ++ maybe "" ("\n" ++) changeValue setMem db i k v
src/Development/Shake/Internal/Core/Database.hs view
@@ -30,7 +30,7 @@ -- | Invariant: The database does not have any cycles where a Key depends on itself.--- Everything is mutable. intern and status must form a bijecttion.+-- Everything is mutable. intern and status must form a bijection. -- There may be dangling Id's as a result of version changes. -- Lock is used to prevent any torn updates data DatabasePoly k v = Database
src/Development/Shake/Internal/FilePattern.hs view
@@ -104,7 +104,9 @@ internalTest :: IO () internalTest = do- let x # y = when (parse x /= y) $ fail $ show ("FilePattern.internalTest",x,parse x,y)+ let x # y =+ let p = parse x+ in when (p /= y) $ fail $ show ("FilePattern.internalTest",x,p,y) "" # [Lit ""] "x" # [Lit "x"] "/" # [Lit "",Lit ""]
src/Development/Shake/Internal/Rules/Files.hs view
@@ -192,7 +192,7 @@ -- > forAll $ \x ys -> test x == Just ys ==> x `elem` ys && all ((== Just ys) . test) ys -- -- Intuitively, the function defines a set partitioning, mapping each element to the partition that contains it.--- As an example of a function satisfying the invariaint:+-- As an example of a function satisfying the invariant: -- -- @ -- test x | 'Development.Shake.FilePath.takeExtension' x \`elem\` [\".hi\",\".o\"]
src/General/Chunks.hs view
@@ -135,7 +135,7 @@ resetChunksCorrupt :: Maybe FilePath -> Chunks -> IO () resetChunksCorrupt copy Chunks{..} = mask $ \restore -> do h <- takeMVar chunksHandle- case copy of+ h <- case copy of Nothing -> pure h Just copy -> do flip onException (putMVar chunksHandle h) $ restore $ do
src/General/Extra.hs view
@@ -286,7 +286,7 @@ --------------------------------------------------------------------- -- Data.Version --- | A version number that indicates change, not ordering or compatibilty.+-- | A version number that indicates change, not ordering or compatibility. -- Always presented as an 'Int' to the user, but a newtype inside the library for safety. newtype Ver = Ver Int deriving (Show,Eq,Storable)
src/General/Template.hs view
@@ -1,6 +1,11 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE ViewPatterns #-} +-- Keep using iso8601DateFormat, since the alternative was introduced in time-1.9+-- while GHC 8.6 still has time-1.8.+-- Safe once we no longer support GHC 8.6.+{-# OPTIONS_GHC -Wno-deprecations #-}+ #ifdef FILE_EMBED {-# LANGUAGE TemplateHaskell #-} #endif
src/Test/BuiltinOverride.hs view
@@ -33,6 +33,6 @@ build ["--allow-redefine-rules"] res <- takeMVar store- assertBool (res == 2) "Rule was not overriden"+ assertBool (res == 2) "Rule was not overridden" assertException ["rule defined twice"] $ build ["--quiet"]
src/Test/Docs.hs view
@@ -7,23 +7,17 @@ import qualified System.FilePattern.Directory as IO import System.Directory import Test.Type-import Control.Monad import Data.Char import Data.List.Extra-import System.Info-import Data.Version.Extra --- Older versions of Haddock (GHC 7.10 and below) garbage the --@ markup and have ambiguity errors--- GHC 8.0 has a segfault when linking Setup-brokenHaddock = compilerVersion < makeVersion [8,2]--main = testBuild (notCI . unless brokenHaddock . defaultTest) $ do+-- Can't get the paths to work on CI with tracking etc+main = testBuild (notCI . defaultTest) $ do let index = "dist/doc/html/shake/index.html" let setup = "dist/setup.exe" let config = "dist/setup-config" want ["Success.txt"]- let trackIgnore = trackAllow ["dist/**"]+ let trackIgnore = trackAllow ["dist/**", "dist-newstyle/**"] let needSource = need =<< getDirectoryFiles "." (map (shakeRoot </>) ["src/Development/Shake.hs","src/Development/Shake//*.hs","src/Development/Ninja/*.hs","src/General//*.hs"])
src/Test/Errors.hs view
@@ -12,8 +12,6 @@ import General.GetOpt import General.Extra import Data.IORef-import System.Info-import Data.Version.Extra import Control.Exception.Extra import System.Directory as IO import System.Time.Extra@@ -179,8 +177,6 @@ liftIO $ putStrLn $ let x = x in x test build = do- let hasLocations = compilerVersion >= readVersion "8.0" -- when GHC got support for locations- -- on Windows, file paths may end up with \ separators, make sure we can still match them let crash args parts = assertExceptionAfter (replace "\\" "/") parts (build $ "--quiet" : args) build ["clean"]@@ -195,7 +191,7 @@ crash ["failcreates"] ["failcreates"] crash ["recursive_"] ["recursive_","intermediate_","recursive"] crash ["rec1","rec2"] ["rec1","rec2","indirect recursion","recursive"]- notCI $ crash ["systemcmd"] $ ["systemcmd","random_missing_command"] ++ ["at cmd, called at" | hasLocations]+ notMacCI $ crash ["systemcmd"] ["systemcmd","random_missing_command", "at cmd, called at"] crash ["stack1"] ["stack1","stack2","stack3","crash"] b <- IO.doesFileExist "staunch1"@@ -232,14 +228,14 @@ assertContents "overlap.txt" "overlap.txt" crash ["overlap.txx"] $ ["key matches multiple rules","matched: 4","overlap.txx","overlap.t*","overlap.*","*.tox"] ++- ["Test/Errors.hs" | hasLocations]+ ["Test/Errors.hs"] crash ["tempfile"] ["tempfile-died"] src <- readFile "tempfile" assertMissing src build ["tempdir"] - crash ["--die"] $ ["Shake","death error"] ++ ["Test/Errors.hs" | hasLocations]+ crash ["--die"] ["Shake","death error","Test/Errors.hs"] putStrLn "## BUILD errors" (out,_) <- IO.captureOutput $ build []@@ -291,7 +287,7 @@ t <- forkIO $ build ["finalfinal","--quiet"] sleep 0.2 killThread t- sleep 0.3+ sleep 0.5 assertContents "finalfinal" "XY" build ["catch1"]
src/Test/Lint.hs view
@@ -27,7 +27,7 @@ writeFile' out "" "pause.*" %> \out -> do- liftIO $ sleep 0.1+ liftIO $ sleep 0.2 need ["cdir" <.> takeExtension out] writeFile' out "" @@ -36,7 +36,7 @@ let dir2 = "dir" ++ takeExtension out liftIO $ createDirectoryRecursive dir2 liftIO $ setCurrentDirectory dir2- liftIO $ sleep 0.2+ liftIO $ sleep 0.4 liftIO $ setCurrentDirectory pwd writeFile' out ""
src/Test/Oracle.hs view
@@ -9,8 +9,6 @@ import General.GetOpt import Data.List.Extra import Data.Tuple.Extra-import System.Info-import Data.Version.Extra import Test.Type hiding (RandomType) import qualified Test.Type as T import Control.Monad@@ -114,6 +112,5 @@ errors ["int.txt"] -- Building with an Oracle that I know nothing about ["missing a call to addOracle"] - errors ["--def=string=1","--def=string=1"] $ -- Two Oracles defined in one go- "oracle defined twice" :- ["Test/Oracle.hs" | compilerVersion >= readVersion "8.0"] -- when GHC got support for locations+ errors ["--def=string=1","--def=string=1"] -- Two Oracles defined in one go+ ["oracle defined twice", "Test/Oracle.hs"]
src/Test/Self.hs view
@@ -10,8 +10,7 @@ import Control.Monad.Extra import Data.Char import Data.List.Extra-import System.Info-import Data.Version.Extra+import System.Info.Extra newtype GhcPkg = GhcPkg () deriving (Show,Typeable,Eq,Hashable,Binary,NFData)@@ -20,7 +19,8 @@ type instance RuleResult GhcPkg = [String] type instance RuleResult GhcFlags = [String] -main = testBuild defaultTest $ do+-- Doesn't work on the Windows CI for reasons I don't understand+main = testBuild (notWindowsCI . defaultTest) $ do let moduleToFile ext xs = replace "." "/" xs <.> ext want ["Main" <.> exe] @@ -83,10 +83,8 @@ -- FIXME: Should actually parse the list from the contents of the .cabal file cabalBuildDepends :: String -> [String]-cabalBuildDepends _ = packages ++ ["unix" | os /= "mingw32"]+cabalBuildDepends _ = packages ++ ["unix" | not isWindows] -packages = words- ("base transformers binary unordered-containers hashable heaps time bytestring primitive " ++- "filepath directory process deepseq random utf8-string extra js-dgtable js-jquery js-flot filepattern") ++- ["old-time" | compilerVersion < makeVersion [7,6]] ++- ["semigroups" | compilerVersion < makeVersion [8,0]]+packages = words $+ "base transformers binary unordered-containers hashable heaps time bytestring primitive " +++ "filepath directory process deepseq random utf8-string extra js-dgtable js-jquery js-flot filepattern"
src/Test/SelfMake.hs view
@@ -10,8 +10,6 @@ import Test.Type import Data.List.Extra-import System.Info-import Data.Version.Extra newtype GhcPkg = GhcPkg () deriving (Show,Typeable,Eq,Hashable,Binary,NFData)@@ -20,7 +18,7 @@ type instance RuleResult GhcPkg = [String] type instance RuleResult GhcFlags = [String] -main = testBuild defaultTest $ do+main = testBuild (notWindowsCI . defaultTest) $ do want ["Main" <.> exe] ghcPkg <- addOracleHash $ \GhcPkg{} -> do@@ -48,7 +46,7 @@ trackAllow ["**/*.o","**/*.hi","Makefile"] ghc $ ["-M",run] ++ flags need . filter (\x -> takeExtension x == ".hs") . concatMap snd . parseMakefile =<< liftIO (readFile "Makefile")- ghc $ ["-o",out,run] ++ ["-j4" | compilerVersion >= makeVersion [7,8]] ++ flags+ ghc $ ["-o",out,run,"-j4"] ++ flags ".pkgs" %> \out -> do src <- readFile' $ shakeRoot </> "shake.cabal"
src/Test/Type.hs view
@@ -4,7 +4,7 @@ sleep, sleepFileTime, sleepFileTimeCalibrate, testBuildArgs, testBuild, testSimple, testNone, shakeRoot,- defaultTest, hasTracker, notCI,+ defaultTest, hasTracker, notCI, notWindowsCI, notMacCI, copyDirectoryChanged, copyFileChangedIO, assertWithin, assertBool, assertBoolIO, assertException, assertExceptionAfter,@@ -152,7 +152,8 @@ tracker :: IO Lint tracker = do fsatrace <- findExecutable $ "fsatrace" <.> exe- pure $ if isJust fsatrace then LintFSATrace else LintBasic+ -- Tracking on a Mac is pretty unreliable+ pure $ if not isMac && isJust fsatrace then LintFSATrace else LintBasic -- Tests that don't currently work on CI notCI :: IO () -> IO ()@@ -160,11 +161,18 @@ b <- lookupEnv "CI" when (isNothing b) act +-- Tests that don't currently work on Windows CI+notWindowsCI :: IO () -> IO ()+notWindowsCI = if isWindows then notCI else id++-- Tests that don't currently work on Mac CI+notMacCI :: IO () -> IO ()+notMacCI = if isMac then notCI else id+ hasTracker :: IO Bool hasTracker = do t <- tracker- -- Tracking on a Mac is pretty unreliable- pure $ not isMac && t == LintFSATrace+ pure $ t == LintFSATrace assertFail :: String -> IO a assertFail msg = error $ "ASSERTION FAILED: " ++ msg