Merge pull request #765 from DanielG/dev

Add more version info to debug command (+hlint bounds)
This commit is contained in:
Daniel Gröber 2016-03-13 17:30:01 +01:00
commit 346d0868e0
2 changed files with 27 additions and 6 deletions

View File

@ -7,6 +7,7 @@ import Control.Monad.Trans.Journal
import qualified Data.Map as Map import qualified Data.Map as Map
import qualified Data.Set as Set import qualified Data.Set as Set
import Data.Char import Data.Char
import Data.Version
import Data.List.Split import Data.List.Split
import Text.PrettyPrint import Text.PrettyPrint
import Language.Haskell.GhcMod.Monad import Language.Haskell.GhcMod.Monad
@ -17,6 +18,11 @@ import Language.Haskell.GhcMod.Pretty
import Language.Haskell.GhcMod.Utils import Language.Haskell.GhcMod.Utils
import Language.Haskell.GhcMod.Cradle import Language.Haskell.GhcMod.Cradle
import Language.Haskell.GhcMod.Stack import Language.Haskell.GhcMod.Stack
import Language.Haskell.GhcMod.Output
import Paths_ghc_mod (version)
import Config (cProjectVersion)
---------------------------------------------------------------- ----------------------------------------------------------------
@ -34,14 +40,20 @@ debugInfo = do
pkgOpts <- packageGhcOptions pkgOpts <- packageGhcOptions
readProc <- gmReadProcess
ghcVersion <- liftIO $
dropWhileEnd isSpace <$> readProc "ghc" ["--numeric-version"] ""
return $ unlines $ return $ unlines $
[ "Root directory: " ++ cradleRootDir [ "Version: ghc-mod-" ++ showVersion version
, "Library GHC Version: " ++ cProjectVersion
, "System GHC Version: " ++ ghcVersion
, "Root directory: " ++ cradleRootDir
, "Current directory: " ++ cradleCurrentDir , "Current directory: " ++ cradleCurrentDir
, "GHC Package flags:\n" ++ render (nest 4 $ , "GHC Package flags:\n" ++ render (nest 4 $
fsep $ map text pkgOpts) fsep $ map text pkgOpts)
, "GHC System libraries: " ++ ghcLibDir , "GHC System libraries: " ++ ghcLibDir
, "GHC user options:\n" ++ render (nest 4 $
fsep $ map text optGhcUserOptions)
] ++ cabal ] ++ cabal
stackPaths :: IOish m => GhcModT m [String] stackPaths :: IOish m => GhcModT m [String]
@ -63,8 +75,17 @@ cabalDebug = do
opts = Map.map gmcGhcOpts mcs opts = Map.map gmcGhcOpts mcs
srcOpts = Map.map gmcGhcSrcOpts mcs srcOpts = Map.map gmcGhcSrcOpts mcs
readProc <- gmReadProcess
cabalInstVersion <- liftIO $
dropWhileEnd isSpace <$> readProc "cabal" ["--numeric-version"] ""
packages <- liftIO $ readProc "ghc-pkg" ["list", "--simple-output"] ""
let cabalPackages = filter ((== ["Cabal"]) . take 1 . splitOn "-") $ splitWhen isSpace packages
return $ return $
[ "Cabal file: " ++ show cradleCabalFile [ "cabal-install Version: " ++ cabalInstVersion
, "Cabal Library Versions:\n" ++ render (nest 4 $
fsep $ map text cabalPackages)
, "Cabal file: " ++ show cradleCabalFile
, "Project: " ++ show cradleProject , "Project: " ++ show cradleProject
, "Cabal entrypoints:\n" ++ render (nest 4 $ , "Cabal entrypoints:\n" ++ render (nest 4 $
mapDoc gmComponentNameDoc smpDoc entrypoints) mapDoc gmComponentNameDoc smpDoc entrypoints)

View File

@ -172,7 +172,7 @@ Library
, ghc < 8.2 && >= 7.6 , ghc < 8.2 && >= 7.6
, ghc-paths < 0.2 , ghc-paths < 0.2
, ghc-syb-utils < 0.3 , ghc-syb-utils < 0.3
, hlint < 1.10 && >= 1.9.26 , hlint < 1.10 && >= 1.9.27
, monad-journal < 0.8 && >= 0.4 , monad-journal < 0.8 && >= 0.4
, old-time < 1.2 , old-time < 1.2
, pretty < 1.2 , pretty < 1.2