@@ -219,17 +219,15 @@ data IdeState = IdeState
219219 ,shakeAbort :: Var (IO ()) -- close whoever was running last
220220 ,shakeClose :: IO ()
221221 ,shakeExtras :: ShakeExtras
222+ ,shakeProfileDir :: Maybe FilePath
222223 }
223224
224−profileDir :: Maybe FilePath
225−profileDir = Nothing -- set to Just the directory you want profile reports to appear in
226−
227225
228226-- This is debugging code that generates a series of profiles, if the Boolean is true
229−shakeRunDatabaseProfile :: ShakeDatabase -> [Action a] -> IO [a]
230−shakeRunDatabaseProfile shakeDb acts = do
227+shakeRunDatabaseProfile :: Maybe FilePath -> ShakeDatabase -> [Action a] -> IO [a]
228+shakeRunDatabaseProfile mbProfileDir shakeDb acts = do
231229 (time, (res,_)) <- duration $ shakeRunDatabase shakeDb acts
232− whenJust profileDir $ \dir -> do
230+ whenJust mbProfileDir $ \dir -> do
233231 count <- modifyVar profileCounter $ \x -> let y = x+1 in return (y,y)
234232 let file = "ide-" ++ profileStartTime ++ "-" ++ takeEnd 5 ("0000" ++ show count) ++ "-" ++ showDP 2 time <.> "html"
235233 shakeProfileDatabase shakeDb $ dir </> file
@@ -264,10 +262,11 @@ getValues state key file = do
264262-- | Open a 'IdeState', should be shut using 'shakeShut'.
265263shakeOpen :: (LSP.FromServerMessage -> IO ()) -- ^ diagnostic handler
266264 -> Logger
265+ -> Maybe FilePath
267266 -> ShakeOptions
268267 -> Rules ()
269268 -> IO IdeState
270−shakeOpen eventer logger opts rules = do
269+shakeOpen eventer logger shakeProfileDir opts rules = do
271270 shakeExtras <- do
272271 globals <- newVar HMap.empty
273272 state <- newVar HMap.empty
@@ -336,7 +335,7 @@ shakeRun IdeState{shakeExtras=ShakeExtras{..}, ..} acts = modifyVar shakeAbort $
336335 logDebug logger $ T.pack $ "Starting shakeRun (aborting the previous one took " ++ showDuration stopTime ++ ")"
337336 bar <- newBarrier
338337 start <- offsetTime
339− thread <- forkFinally (shakeRunDatabaseProfile shakeDb acts) $ \res -> do
338+ thread <- forkFinally (shakeRunDatabaseProfile shakeProfileDir shakeDb acts) $ \res -> do
340339 signalBarrier bar res
341340 runTime <- start
342341 let res' = case res of