handle flag to disable GHC API recompilator

This commit is contained in:
Luite Stegeman 2012-04-05 21:37:30 +02:00
parent 7e2fce52b5
commit 4dc5e74f02
2 changed files with 9 additions and 6 deletions

View File

@ -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

View File

@ -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"
]