diff --git a/yesod/Devel.hs b/yesod/Devel.hs index 36c35b01..7d7c2a4d 100644 --- a/yesod/Devel.hs +++ b/yesod/Devel.hs @@ -30,10 +30,11 @@ import System.Process (createProcess, proc, terminateProcess, readProc waitForProcess, rawSystem, runInteractiveProcess) import System.IO (hClose, hIsEOF, hGetLine, stdout, stderr, hPutStrLn) -import Build (recompDeps, getDeps, isNewerThan) -import GhcBuild (getBuildFlags, buildPackage) +import Build (recompDeps, getDeps, isNewerThan) +import GhcBuild (getBuildFlags, buildPackage) import qualified Config as GHC +import SrcLoc (Located) lockFile :: FilePath lockFile = "dist/devel-terminate" @@ -90,7 +91,7 @@ devel isCabalDev passThroughArgs = do mainLoop :: [FilePath] -> FilePath -> IO () mainLoop hsSourceDirs cabal = do ghcVer <- ghcVersion - rebuildCabal cmd + _ <- rebuildCabal cmd pkgArgs <- ghcPackageArgs isCabalDev ghcVer rebuild <- mkRebuild ghcVer cabal cmd let devArgs = pkgArgs ++ ["devel.hs"] ++ passThroughArgs @@ -132,10 +133,12 @@ mkRebuild ghcVer cabalFile cabalCmd putStrLn "WARNING: yesod is compiled with a different ghc version, falling back to cabal" rebuildCabal cabalCmd +rebuildGhc :: [Located String] -> IO Bool rebuildGhc bf = do putStrLn "Rebuilding application... (GHC API)" buildPackage bf +rebuildCabal :: String -> IO Bool rebuildCabal cmd = do putStrLn "Rebuilding application... (cabal)" exit <- rawSystemFilter cmd ["build"] diff --git a/yesod/GhcBuild.hs b/yesod/GhcBuild.hs index 76bb6c67..1e610340 100644 --- a/yesod/GhcBuild.hs +++ b/yesod/GhcBuild.hs @@ -1,4 +1,14 @@ -{-# LANGUAGE CPP, ScopedTypeVariables #-} +{-# OPTIONS_GHC -fno-warn-unused-do-bind #-} +{-# OPTIONS_GHC -fno-warn-unused-binds #-} +{-# OPTIONS_GHC -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -fno-warn-unused-matches #-} +{- + There is a lot of code copied from GHC here, and some conditional + compilation. Instead of fixing all warnings and making it much more + difficult to compare the code to the original, just ignore unused + binds and imports. +-} +{-# LANGUAGE CPP, ScopedTypeVariables, PatternGuards #-} {- build package with the GHC API @@ -43,6 +53,7 @@ buildPackage a = buildPackage' a `Ex.catch` \(e::Ex.SomeException) -> do putStrLn ("exception building package: " ++ show e) return False +buildPackage' :: [Located String] -> IO Bool buildPackage' argv2 = do (mode, argv3, modeFlagWarnings) <- parseModeFlags argv2 GHC.runGhc (Just libdir) $ do @@ -85,12 +96,13 @@ buildPackage' argv2 = do else liftIO linkPkg >> return True -- fixme, find default ar and ld versions +linkPkg :: IO () linkPkg = do arargs <- fmap read $ readFile "dist/arargs.txt" rawSystem "ar" arargs ldargs <- fmap read $ readFile "dist/ldargs.txt" rawSystem "ld" ldargs - + return () -------------------------------------------------------------------------------------------- -- stuff below copied from ghc main.hs