Add some more debug output

This commit is contained in:
Daniel Gröber 2015-09-02 05:30:00 +02:00
parent 996016ac7b
commit 86c157d1d2
2 changed files with 14 additions and 1 deletions

View File

@ -15,6 +15,7 @@ import Language.Haskell.GhcMod.Internal
import Language.Haskell.GhcMod.Target import Language.Haskell.GhcMod.Target
import Language.Haskell.GhcMod.Pretty import Language.Haskell.GhcMod.Pretty
import Language.Haskell.GhcMod.Utils import Language.Haskell.GhcMod.Utils
import Language.Haskell.GhcMod.PathsAndFiles
---------------------------------------------------------------- ----------------------------------------------------------------
@ -27,7 +28,7 @@ debugInfo = do
cabal <- cabal <-
case cradleProjectType of case cradleProjectType of
CabalProject -> cabalDebug CabalProject -> cabalDebug
StackProject -> cabalDebug StackProject -> (++) <$> stackPaths <*> cabalDebug
_ -> return [] _ -> return []
pkgOpts <- packageGhcOptions pkgOpts <- packageGhcOptions
@ -42,6 +43,16 @@ debugInfo = do
fsep $ map text optGhcUserOptions) fsep $ map text optGhcUserOptions)
] ++ cabal ] ++ cabal
stackPaths :: IOish m => GhcModT m [String]
stackPaths = do
Cradle {..} <- cradle
Just ghc <- getStackGhcPath cradleRootDir
Just ghcPkg <- getStackGhcPkgPath cradleRootDir
return $
[ "Stack ghc executable: " ++ show ghc
, "Stack ghc-pkg executable:" ++ show ghcPkg
]
cabalDebug :: IOish m => GhcModT m [String] cabalDebug :: IOish m => GhcModT m [String]
cabalDebug = do cabalDebug = do
Cradle {..} <- cradle Cradle {..} <- cradle

View File

@ -288,6 +288,7 @@ resolveGmComponent :: (IOish m, Gm m)
-> m (GmComponent 'GMCResolved (Set ModulePath)) -> m (GmComponent 'GMCResolved (Set ModulePath))
resolveGmComponent mums c@GmComponent {..} = do resolveGmComponent mums c@GmComponent {..} = do
distDir <- cradleDistDir <$> cradle distDir <- cradleDistDir <$> cradle
gmLog GmDebug "resolveGmComponent" $ text $ show $ ghcOpts distDir
withLightHscEnv (ghcOpts distDir) $ \env -> do withLightHscEnv (ghcOpts distDir) $ \env -> do
let srcDirs = if null gmcSourceDirs then [""] else gmcSourceDirs let srcDirs = if null gmcSourceDirs then [""] else gmcSourceDirs
let mg = gmcHomeModuleGraph let mg = gmcHomeModuleGraph
@ -313,6 +314,7 @@ resolveEntrypoint :: (IOish m, Gm m)
-> GmComponent 'GMCRaw ChEntrypoint -> GmComponent 'GMCRaw ChEntrypoint
-> m (GmComponent 'GMCRaw (Set ModulePath)) -> m (GmComponent 'GMCRaw (Set ModulePath))
resolveEntrypoint Cradle {..} c@GmComponent {..} = do resolveEntrypoint Cradle {..} c@GmComponent {..} = do
gmLog GmDebug "resolveEntrypoint" $ text $ show $ gmcGhcSrcOpts
withLightHscEnv gmcGhcSrcOpts $ \env -> do withLightHscEnv gmcGhcSrcOpts $ \env -> do
let srcDirs = if null gmcSourceDirs then [""] else gmcSourceDirs let srcDirs = if null gmcSourceDirs then [""] else gmcSourceDirs
eps <- liftIO $ resolveChEntrypoints cradleRootDir gmcEntrypoints eps <- liftIO $ resolveChEntrypoints cradleRootDir gmcEntrypoints