From 4dc5e74f02e809f39f07f9a6b7e26459f4220068 Mon Sep 17 00:00:00 2001 From: Luite Stegeman Date: Thu, 5 Apr 2012 21:37:30 +0200 Subject: [PATCH] handle flag to disable GHC API recompilator --- yesod/Devel.hs | 11 ++++++----- yesod/main.hs | 4 +++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/yesod/Devel.hs b/yesod/Devel.hs index ca504b5f..a7a65a0a 100644 --- a/yesod/Devel.hs +++ b/yesod/Devel.hs @@ -51,8 +51,8 @@ writeLock = do removeLock :: IO () removeLock = try_ (removeFile lockFile) -devel :: Bool -> [String] -> IO () -devel isCabalDev passThroughArgs = do +devel :: Bool -> Bool -> [String] -> IO () +devel isCabalDev forceCabal passThroughArgs = do checkDevelFile writeLock @@ -98,7 +98,7 @@ devel isCabalDev passThroughArgs = do ghcVer <- ghcVersion _ <- rebuildCabal cmd pkgArgs <- ghcPackageArgs isCabalDev ghcVer - rebuild <- mkRebuild ghcVer cabal cmd ldar + rebuild <- mkRebuild ghcVer cabal cmd forceCabal ldar let devArgs = pkgArgs ++ ["devel.hs"] ++ passThroughArgs forever $ do recompDeps hsSourceDirs @@ -123,8 +123,9 @@ devel isCabalDev passThroughArgs = do Ex.throwTo watchTid (userError "process finished") watchForChanges hsSourceDirs list -mkRebuild :: String -> FilePath -> String -> (FilePath, FilePath) -> IO (IO Bool) -mkRebuild ghcVer cabalFile cabalCmd (ldPath, arPath) +mkRebuild :: String -> FilePath -> String -> Bool -> (FilePath, FilePath) -> IO (IO Bool) +mkRebuild ghcVer cabalFile cabalCmd forceCabal (ldPath, arPath) + | forceCabal = return (rebuildCabal cabalCmd) | GHC.cProjectVersion == ghcVer = do bf <- getBuildFlags return $ do diff --git a/yesod/main.hs b/yesod/main.hs index 555fac5f..839e6c4f 100755 --- a/yesod/main.hs +++ b/yesod/main.hs @@ -34,6 +34,7 @@ cabalCommand mopt | optCabalDev mopt = "cabal-dev" | otherwise = "cabal" +main :: IO () main = runSubcommand' [ subcommand "init" cmdInit , subcommand "configure" cmdConfigure @@ -60,7 +61,7 @@ cmdTouch :: MainOptions -> TouchOptions -> [String] -> IO () cmdTouch _ _ _ = touch cmdDevel :: MainOptions -> DevelOptions -> [String] -> IO () -cmdDevel mopt opts args = devel (optCabalDev mopt) args +cmdDevel mopt opts args = devel (optCabalDev mopt) forceCabal args where forceCabal = develOptNoApi opts @@ -97,3 +98,4 @@ describeSubcommands = unlines , " devel Run project with the devel server" , " version Print the version of Yesod" ] +