@@ -12,13 +12,13 @@ module Development.IDE.Graph.Database(
12
12
shakeGetDirtySet ,
13
13
shakeGetCleanKeys
14
14
,shakeGetBuildEdges ) where
15
+ import Control.Concurrent.STM (atomically ,
16
+ readTVarIO )
15
17
import Data.Dynamic
16
- import Data.IORef (readIORef )
17
18
import Data.Maybe
18
19
import Development.IDE.Graph.Classes ()
19
20
import Development.IDE.Graph.Internal.Action
20
21
import Development.IDE.Graph.Internal.Database
21
- import qualified Development.IDE.Graph.Internal.Ids as Ids
22
22
import Development.IDE.Graph.Internal.Options
23
23
import Development.IDE.Graph.Internal.Profile (writeProfile )
24
24
import Development.IDE.Graph.Internal.Rules
@@ -45,12 +45,12 @@ shakeRunDatabase = shakeRunDatabaseForKeys Nothing
45
45
-- | Returns the set of dirty keys annotated with their age (in # of builds)
46
46
shakeGetDirtySet :: ShakeDatabase -> IO [(Key , Int )]
47
47
shakeGetDirtySet (ShakeDatabase _ _ db) =
48
- fmap snd <$> Development.IDE.Graph.Internal.Database. getDirtySet db
48
+ Development.IDE.Graph.Internal.Database. getDirtySet db
49
49
50
50
-- | Returns the build number
51
51
shakeGetBuildStep :: ShakeDatabase -> IO Int
52
52
shakeGetBuildStep (ShakeDatabase _ _ db) = do
53
- Step s <- readIORef $ databaseStep db
53
+ Step s <- readTVarIO $ databaseStep db
54
54
return s
55
55
56
56
-- Only valid if we never pull on the results, which we don't
@@ -64,7 +64,7 @@ shakeRunDatabaseForKeys
64
64
-> [Action a ]
65
65
-> IO ([a ], [IO () ])
66
66
shakeRunDatabaseForKeys keysChanged (ShakeDatabase lenAs1 as1 db) as2 = do
67
- incDatabase db keysChanged
67
+ atomically $ incDatabase db keysChanged
68
68
as <- fmap (drop lenAs1) $ runActions db $ map unvoid as1 ++ as2
69
69
return (as, [] )
70
70
@@ -75,12 +75,12 @@ shakeProfileDatabase (ShakeDatabase _ _ s) file = writeProfile file s
75
75
-- | Returns the clean keys in the database
76
76
shakeGetCleanKeys :: ShakeDatabase -> IO [(Key , Result )]
77
77
shakeGetCleanKeys (ShakeDatabase _ _ db) = do
78
- keys <- Ids. elems $ databaseValues db
78
+ keys <- getDatabaseValues db
79
79
return [ (k,res) | (k, Clean res) <- keys]
80
80
81
81
-- | Returns the total count of edges in the build graph
82
82
shakeGetBuildEdges :: ShakeDatabase -> IO Int
83
83
shakeGetBuildEdges (ShakeDatabase _ _ db) = do
84
- keys <- Ids. elems $ databaseValues db
84
+ keys <- getDatabaseValues db
85
85
let ress = mapMaybe (getResult . snd ) keys
86
86
return $ sum $ map (length . getResultDepsDefault [] . resultDeps) ress
0 commit comments