Commit 131a0af3 authored by Simon Marlow's avatar Simon Marlow
Browse files

Checking UsageFile: don't fail if the file doesn't exist, just recompile

If a file we depended on last time is missing, we should recompile.

This also makes us insensitive to mistakes when recording dependent
source files (such as storing a temporary file), but will make more
recompilation happen instead.  With DEBUG on, you get a warning.
parent 128078e0
......@@ -102,6 +102,7 @@ import ListSetOps
import Binary
import Fingerprint
import Bag
import Exception
import Control.Monad
import Data.List
......@@ -1324,10 +1325,19 @@ checkModUsage this_pkg UsageHomeModule{
else up_to_date (ptext (sLit " Great! The bits I use are up to date"))
checkModUsage _this_pkg UsageFile{ usg_file_path = file, usg_mtime = old_mtime } = do
new_mtime <- liftIO $ getModificationTime file
return $ old_mtime /= new_mtime
checkModUsage _this_pkg UsageFile{ usg_file_path = file,
usg_mtime = old_mtime } =
liftIO $
handleIO handle $ do
new_mtime <- getModificationTime file
return $ old_mtime /= new_mtime
where
handle =
#ifdef DEBUG
\e -> pprTrace "UsageFile" (text (show e)) $ return True
#else
\_ -> return True -- if we can't find the file, just recompile, don't fail
#endif
------------------------
checkModuleFingerprint :: Fingerprint -> Fingerprint -> IfG RecompileRequired
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment