packages feed

buildwrapper 0.7.3 → 0.7.4

raw patch · 4 files changed

+34/−17 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Language.Haskell.BuildWrapper.Base: instance Read LoadContents
+ Language.Haskell.BuildWrapper.Base: instance Show LoadContents

Files

buildwrapper.cabal view
@@ -1,5 +1,5 @@ name:           buildwrapper-version:        0.7.3+version:        0.7.4 cabal-version:  >= 1.8 build-type:     Simple license:        BSD3
src/Language/Haskell/BuildWrapper/Base.hs view
@@ -633,6 +633,7 @@         | MultipleFile {
                 lmFiles :: [(FilePath,String)]
         }
+        deriving (Show,Read)
 
 -- | get files to load
 getLoadFiles :: LoadContents -> [(FilePath,String)]
src/Language/Haskell/BuildWrapper/Cabal.hs view
@@ -405,7 +405,7 @@  
 -- | get the build info for a given source file
 -- if a source file is in several component, get the first one             
-getBuildInfo ::  FilePath  -- ^the source file
+getBuildInfo ::  FilePath  -- ^ the source file
         -> Maybe String -- ^ the cabal component to use, or Nothing if not specified
         -> BuildWrapper (OpResult (Maybe (LocalBuildInfo,CabalBuildInfo)))
 getBuildInfo fp mccn=do
src/Language/Haskell/BuildWrapper/GHC.hs view
@@ -197,44 +197,60 @@ --                        MultipleFile{}->LoadAllTargets                 let howMuch=LoadAllTargets                 -- GMU.liftIO $ putStrLn "Loading..."-                load howMuch+                sf<-load howMuch                            `gcatch` (\(e :: SourceError) -> handle_error ref e)+                           `gcatch` (\(ae :: GhcApiError) -> do+                                        dumpError ref contents ae+                                        return Failed)+                            `gcatch` (\(se :: SomeException) -> do+                                        dumpError ref contents se+                                        return Failed)                             -- GMU.liftIO $ putStrLn "Loaded..."                            --(warns, errs) <- GMU.liftIO $ readIORef ref                 --let notes = ghcMessagesToNotes base_dir (warns, errs)-                notes <- GMU.liftIO $ readIORef ref+                                 --c2<-GMU.liftIO getClockTime                 --GMU.liftIO $ putStrLn ("load all targets: " ++ (timeDiffToString  $ diffClockTimes c2 c1))                 -- GMU.liftIO $ print fps-                a<-fmap catMaybes $ mapM (\(fp,m)->(do+                a<-case sf of+                        Failed-> return []+                        _  ->fmap catMaybes $ mapM (\(fp,m)->(do                                 modSum <- getModSummary $ mkModuleName m                                 fmap Just $ workOnResult f fp modSum)                                `gcatch` (\(se :: SourceError) -> do-                                        when (processError contents (show se)) (do-                                                GMU.liftIO $ print m-                                                GMU.liftIO $ print se -                                                )+                                        dumpError ref contents se                                         return Nothing)                                `gcatch` (\(ae :: GhcApiError) -> do-                                        when (processError contents (show ae)) (do-                                                GMU.liftIO $ print m-                                                GMU.liftIO $ print ae -                                                )+                                        dumpError ref contents ae                                         return Nothing)-                        ) fps+                                `gcatch` (\(se :: SomeException) -> do+                                        dumpError ref contents se+                                        return Nothing)        +                                ) fps+                notes <- GMU.liftIO $ readIORef ref                 #if __GLASGOW_HASKELL__ < 702                                            warns <- getWarnings                 df <- getSessionDynFlags                 return (a,List.nub $ notes ++ reverse (ghcMessagesToNotes df base_dir (warns, emptyBag))) #else-                notes2 <- GMU.liftIO $ readIORef ref-                return $ (a,List.nub $ notes2)+                return $ (a,List.nub $ notes) #endif         where             processError :: LoadContents -> String -> Bool             processError MultipleFile{} "Module not part of module graph"=False -- we ignore the error when we process several files and some we can't find             processError _ _=True-            +            dumpError :: (Show a)=> IORef [BWNote] -> LoadContents -> a -> Ghc ()+            dumpError ref conts ae= when (processError conts (show ae)) (do+                                                GMU.liftIO $ print conts+                                                GMU.liftIO $ print ae +                                                case conts of+                                                        (SingleFile fp _)->do+                                                             let relfp=makeRelative base_dir $ normalise fp+                                                             let notes=[BWNote BWError (show ae) (BWLocation relfp 1 1 1 1)]+                                                             GMU.liftIO $ modifyIORef ref $+                                                                \ ns -> ns ++ notes+                                                        _->return () +                                                )                     workOnResult :: GHCApplyFunction a -> FilePath -> ModSummary -> Ghc a             workOnResult f2 fp modSum= do