diff options
| author | Simon Marlow <marlowsd@gmail.com> | 2011-11-23 15:25:35 +0000 |
|---|---|---|
| committer | Simon Marlow <marlowsd@gmail.com> | 2011-11-23 16:19:23 +0000 |
| commit | 131a0af32eeaa22f598239c4467b65860af185d1 (patch) | |
| tree | 92a1b8115e4578aa01d81db48b51eeb3e90d7a9c | |
| parent | 128078e0dcfea03c3306f57a4ae7303ca8ff055b (diff) | |
| download | haskell-131a0af32eeaa22f598239c4467b65860af185d1.tar.gz | |
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.
| -rw-r--r-- | compiler/iface/MkIface.lhs | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/compiler/iface/MkIface.lhs b/compiler/iface/MkIface.lhs index 3196614510..3edf1d64e5 100644 --- a/compiler/iface/MkIface.lhs +++ b/compiler/iface/MkIface.lhs @@ -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 |
