@@ -8,8 +8,9 @@ module Development.IDE.Graph.Database(
8
8
shakeGetBuildStep ,
9
9
shakeGetDatabaseKeys ,
10
10
shakeGetDirtySet ,
11
- shakeGetCleanKeys
12
- ,shakeGetBuildEdges ) where
11
+ shakeGetCleanKeys ,
12
+ shakeMarkDirtyKeys ,
13
+ shakeGetBuildEdges ) where
13
14
import Control.Concurrent.STM.Stats (readTVarIO )
14
15
import Data.Dynamic
15
16
import Data.Maybe
@@ -34,7 +35,7 @@ shakeNewDatabase opts rules = do
34
35
pure $ ShakeDatabase (length actions) actions db
35
36
36
37
shakeRunDatabase :: ShakeDatabase -> [Action a ] -> IO [a ]
37
- shakeRunDatabase = shakeRunDatabaseForKeys Nothing
38
+ shakeRunDatabase = shakeRunDatabaseForKeys
38
39
39
40
-- | Returns the set of dirty keys annotated with their age (in # of builds)
40
41
shakeGetDirtySet :: ShakeDatabase -> IO [(Key , Int )]
@@ -52,16 +53,19 @@ unvoid :: Functor m => m () -> m a
52
53
unvoid = fmap undefined
53
54
54
55
-- | Assumes that the database is not running a build
56
+ -- dirty keys should be marked using `shakeMarkDirtyKeys`
57
+ -- before calling this function
55
58
shakeRunDatabaseForKeys
56
- :: Maybe [Key ]
57
- -- ^ Set of keys changed since last run. 'Nothing' means everything has changed
58
- -> ShakeDatabase
59
+ ::
60
+ ShakeDatabase
59
61
-> [Action a ]
60
62
-> IO [a ]
61
- shakeRunDatabaseForKeys keysChanged (ShakeDatabase lenAs1 as1 db) as2 = do
62
- incDatabase db keysChanged
63
+ shakeRunDatabaseForKeys (ShakeDatabase lenAs1 as1 db) as2 = do
63
64
fmap (drop lenAs1) $ runActions db $ map unvoid as1 ++ as2
64
65
66
+ shakeMarkDirtyKeys :: ShakeDatabase -> KeySet -> IO ()
67
+ shakeMarkDirtyKeys (ShakeDatabase _ _ db) keys = incDatabase db $ Just (toListKeySet keys)
68
+
65
69
-- | Given a 'ShakeDatabase', write an HTML profile to the given file about the latest run.
66
70
shakeProfileDatabase :: ShakeDatabase -> FilePath -> IO ()
67
71
shakeProfileDatabase (ShakeDatabase _ _ s) file = writeProfile file s
0 commit comments