hdevtools 0.1.3.0 → 0.1.3.1
raw patch · 5 files changed
+64/−75 lines, 5 filesdep ~Cabal
Dependency ranges changed: Cabal
Files
- CHANGELOG.md +5/−0
- hdevtools.cabal +4/−9
- src/Cabal.hs +52/−32
- src/CommandArgs.hs +2/−33
- src/CommandLoop.hs +1/−1
CHANGELOG.md view
@@ -1,5 +1,10 @@ # Changelog +## 0.1.3.1 - 2016-05-13++ * Added support for new Cabal versions+ * Do not generate code, fixing inline-c modules typechecking+ ## 0.1.3.0 - 2016-02-29 * Improved performance in stack projects: The stack configuration is
hdevtools.cabal view
@@ -1,10 +1,10 @@ name: hdevtools-version: 0.1.3.0+version: 0.1.3.1 synopsis: Persistent GHC powered background server for FAST haskell development tools license: MIT license-file: LICENSE author: Bit Connor-maintainer: Sebastian Nagel <sebastian.nagel@ncoding.at>, +maintainer: Sebastian Nagel <sebastian.nagel@ncoding.at>, Ranjit Jhala <jhala@cs.ucsd.edu> copyright: See AUTHORS file category: Development@@ -38,7 +38,7 @@ for getting info about identifiers, and getting type information for snippets of code. -extra-source-files: +extra-source-files: CHANGELOG.md README.md @@ -49,7 +49,6 @@ executable hdevtools hs-source-dirs: src ghc-options: -Wall- cpp-options: -DCABAL main-is: Main.hs other-modules: Cabal, Client,@@ -79,15 +78,11 @@ unix if impl(ghc == 7.6.*)- build-depends: Cabal == 1.16.*- cpp-options: -DENABLE_CABAL+ build-depends: Cabal >= 1.16 if impl(ghc >= 7.7) build-depends: Cabal >= 1.18- cpp-options: -DENABLE_CABAL if impl(ghc >= 7.9) build-depends: Cabal >= 1.22, bin-package-db-- cpp-options: -DENABLE_CABAL
src/Cabal.hs view
@@ -4,7 +4,6 @@ , findCabalFile ) where -#ifdef ENABLE_CABAL import Stack import Control.Exception (IOException, catch) import Control.Monad (when)@@ -22,7 +21,7 @@ import Distribution.Simple.Configure (configure) import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(..), ComponentLocalBuildInfo(..), Component(..), ComponentName(..),-#if __GLASGOW_HASKELL__ < 707+#if !MIN_VERSION_Cabal(1,18,0) allComponentsBy, #endif componentBuildInfo, foldComponent)@@ -34,10 +33,10 @@ import Distribution.Simple.Program.Types (ConfiguredProgram(programVersion), simpleProgram) import Distribution.Simple.Program.GHC (GhcOptions(..), renderGhcOptions) import Distribution.Simple.Setup (ConfigFlags(..), defaultConfigFlags, configureCommand, toFlag)-#if __GLASGOW_HASKELL__ >= 709+#if MIN_VERSION_Cabal(1,21,1) import Distribution.Utils.NubList-import qualified Distribution.Simple.GHC as GHC(configure) #endif+import qualified Distribution.Simple.GHC as GHC(configure) import Distribution.Verbosity (silent) import Distribution.Version (Version(..)) @@ -54,7 +53,7 @@ (CBenchName . benchmarkName) getComponentLocalBuildInfo :: LocalBuildInfo -> ComponentName -> ComponentLocalBuildInfo-#if __GLASGOW_HASKELL__ >= 707+#if MIN_VERSION_Cabal(1,18,0) getComponentLocalBuildInfo lbi cname = getLocalBuildInfo cname $ componentsConfigs lbi where getLocalBuildInfo cname' ((cname'', clbi, _):cfgs) = if cname' == cname'' then clbi else getLocalBuildInfo cname' cfgs@@ -78,7 +77,7 @@ Just clbi -> clbi #endif -#if __GLASGOW_HASKELL__ >= 707+#if MIN_VERSION_Cabal(1,18,0) -- TODO: Fix callsites so we don't need `allComponentsBy`. It was taken from -- http://hackage.haskell.org/package/Cabal-1.16.0.3/docs/src/Distribution-Simple-LocalBuildInfo.html#allComponentsBy -- since it doesn't exist in Cabal 1.18.*@@ -155,33 +154,65 @@ localBuildInfo <- configure (genPkgDescr, emptyHookedBuildInfo) cfgFlags let pkgDescr = localPkgDescr localBuildInfo let baseDir = fst . splitFileName $ path- case getGhcVersion localBuildInfo of+ case getGhcVersion localBuildInfo of Nothing -> return $ Left "GHC is not configured"--#if __GLASGOW_HASKELL__ >= 709- Just _ -> do+ Just ghcVersion -> do let mbLibName = pkgLibName pkgDescr- let ghcOpts' = foldl' mappend mempty $ map (getComponentGhcOptions localBuildInfo) $ flip allComponentsBy (\c -> c) . localPkgDescr $ localBuildInfo+ let ghcOpts' = foldl' mappend mempty . map (getComponentGhcOptions localBuildInfo) .+ flip allComponentsBy (\c -> c) . localPkgDescr $ localBuildInfo -- FIX bug in GhcOptions' `mappend`+#if MIN_VERSION_Cabal(1,21,1)+-- API Change:+-- Distribution.Simple.Program.GHC.GhcOptions now uses NubListR's+-- GhcOptions { .. ghcOptPackages :: NubListR (InstalledPackageId, PackageId, ModuleRemaining) .. } ghcOpts = ghcOpts' { ghcOptExtra = overNubListR (filter (/= "-Werror")) $ ghcOptExtra ghcOpts'+#if __GLASGOW_HASKELL__ >= 709 , ghcOptPackageDBs = sort $ nub (ghcOptPackageDBs ghcOpts')+#endif , ghcOptPackages = overNubListR (filter (\(_, pkgId, _) -> Just (pkgName pkgId) /= mbLibName)) $ (ghcOptPackages ghcOpts') , ghcOptSourcePath = overNubListR (map (baseDir </>)) (ghcOptSourcePath ghcOpts') }- (ghcInfo,_,_) <- GHC.configure silent Nothing Nothing defaultProgramConfiguration-- return $ Right $ renderGhcOptions ghcInfo ghcOpts #else- Just ghcVersion -> do- let mbLibName = pkgLibName pkgDescr- let ghcOpts' = foldl' mappend mempty $ map (getComponentGhcOptions localBuildInfo) $ flip allComponentsBy (\c -> c) . localPkgDescr $ localBuildInfo-- ghcOpts = ghcOpts' { ghcOptExtra = filter (/= "-Werror") $ nub $ ghcOptExtra ghcOpts'+-- GhcOptions { .. ghcOptPackages :: [(InstalledPackageId, PackageId)] .. }+ let ghcOpts = ghcOpts' { ghcOptExtra = filter (/= "-Werror") $ nub $ ghcOptExtra ghcOpts' , ghcOptPackages = filter (\(_, pkgId) -> Just (pkgName pkgId) /= mbLibName) $ nub (ghcOptPackages ghcOpts') , ghcOptSourcePath = map (baseDir </>) (ghcOptSourcePath ghcOpts') }+#endif++#if MIN_VERSION_Cabal(1,18,0)+-- API Change:+-- Distribution.Simple.GHC.configure now returns (Compiler, Maybe Platform, ProgramConfiguration) +-- It used to just return (Compiler, ProgramConfiguration)+-- GHC.configure :: Verbosity -> Maybe FilePath -> Maybe FilePath -> ProgramConfiguration+-- -> IO (Compiler, Maybe Platform, ProgramConfiguration)+ (ghcInfo, mbPlatform, _) <- GHC.configure silent Nothing Nothing defaultProgramConfiguration+#else+-- configure :: Verbosity -> Maybe FilePath -> Maybe FilePath -> ProgramConfiguration+-- -> IO (Compiler, ProgramConfiguration)+ (ghcInfo, _) <- GHC.configure silent Nothing Nothing defaultProgramConfiguration+ -- let mbPlatform = Just (hostPlatform localBuildInfo) :: Maybe Platform+#endif+ putStrLn $ "Configured GHC " ++ show ghcVersion+#if MIN_VERSION_Cabal(1,18,0)+ ++ " " ++ show mbPlatform+#endif+#if MIN_VERSION_Cabal(1,23,2)+-- API Change:+-- Distribution.Simple.Program.GHC.renderGhcOptions now takes Platform argument+-- renderGhcOptions :: Compiler -> Platform -> GhcOptions -> [String]+ return $ case mbPlatform of+ Just platform -> Right $ renderGhcOptions ghcInfo platform ghcOpts+ Nothing -> Left "GHC.configure did not return platform"+#else+#if MIN_VERSION_Cabal(1,20,0)+-- renderGhcOptions :: Compiler -> GhcOptions -> [String]+ return $ Right $ renderGhcOptions ghcInfo ghcOpts+#else+-- renderGhcOptions :: Version -> GhcOptions -> [String] return $ Right $ renderGhcOptions ghcVersion ghcOpts #endif+#endif -- returns the right 'dist' directory in the case of a sandbox getDistDir = do@@ -236,16 +267,5 @@ where isCabalFile :: FilePath -> Bool- isCabalFile path = cabalExtension `isSuffixOf` path- && length path > length cabalExtension- where cabalExtension = ".cabal"--# else--getPackageGhcOpts :: FilePath -> [String] -> IO (Either String [String])-getPackageGhcOpts _ _ = return $ Right []--findCabalFile :: FilePath -> IO (Maybe FilePath)-findCabalFile _ = return Nothing--#endif+ isCabalFile path = ".cabal" `isSuffixOf` path+ && length path > length ".cabal"
src/CommandArgs.hs view
@@ -6,31 +6,20 @@ ) where +import Data.Version (showVersion)+import Paths_hdevtools (version) import System.Console.CmdArgs.Implicit import System.Environment (getProgName) import System.Info (arch, os) import qualified Config -#ifdef CABAL-import Data.Version (showVersion)-import Paths_hdevtools (version)-#endif- programVersion :: String programVersion =-#ifdef CABAL "version " ++ showVersion version-#else- "unknown-version (not built with cabal)"-#endif cabalVersion :: String cabalVersion =-#ifdef ENABLE_CABAL "cabal-" ++ VERSION_Cabal-#else- "no cabal support"-#endif fullVersion :: String fullVersion =@@ -160,11 +149,7 @@ check = record dummyCheck [ socket := def += typFile += help "socket file to use" , ghcOpts := def += typ "OPTION" += help "ghc options"-#ifdef ENABLE_CABAL , cabalOpts := def += typ "OPTION" += help "cabal options"-#else- , cabalOpts := def += ignore-#endif , path := def += typFile += help "path to target file" , file := def += typFile += argPos 0 += opt "" , json := def += help "render output as JSON"@@ -174,11 +159,7 @@ moduleFile = record dummyModuleFile [ socket := def += typFile += help "socket file to use" , ghcOpts := def += typ "OPTION" += help "ghc options"-#ifdef ENABLE_CABAL , cabalOpts := def += typ "OPTION" += help "cabal options"-#else- , cabalOpts := def += ignore-#endif , module_ := def += typ "MODULE" += argPos 0 ] += help "Get the haskell source file corresponding to a module name" @@ -186,11 +167,7 @@ info = record dummyInfo [ socket := def += typFile += help "socket file to use" , ghcOpts := def += typ "OPTION" += help "ghc options"-#ifdef ENABLE_CABAL , cabalOpts := def += typ "OPTION" += help "cabal options"-#else- , cabalOpts := def += ignore-#endif , path := def += typFile += help "path to target file" , file := def += typFile += argPos 0 += opt "" , identifier := def += typ "IDENTIFIER" += argPos 1@@ -200,11 +177,7 @@ type_ = record dummyType [ socket := def += typFile += help "socket file to use" , ghcOpts := def += typ "OPTION" += help "ghc options"-#ifdef ENABLE_CABAL , cabalOpts := def += typ "OPTION" += help "cabal options"-#else- , cabalOpts := def += ignore-#endif , path := def += typFile += help "path to target file" , file := def += typFile += argPos 0 += opt "" , line := def += typ "LINE" += argPos 1@@ -215,11 +188,7 @@ findSymbol = record dummyFindSymbol [ socket := def += typFile += help "socket file to use" , ghcOpts := def += typ "OPTION" += help "ghc options"-#ifdef ENABLE_CABAL , cabalOpts := def += typ "OPTION" += help "cabal options"-#else- , cabalOpts := def += ignore-#endif , symbol := def += typ "SYMBOL" += argPos 0 , files := def += typFile += args ] += help "List the modules where the given symbol could be found"
src/CommandLoop.hs view
@@ -162,7 +162,7 @@ let updatedDynFlags = initialDynFlags { GHC.log_action = logAction state clientSend , GHC.ghcLink = GHC.NoLink- , GHC.hscTarget = GHC.HscInterpreted+ , GHC.hscTarget = GHC.HscNothing } (finalDynFlags, _, _) <- GHC.parseDynamicFlags updatedDynFlags (map GHC.noLoc ghcOpts) _ <- GHC.setSessionDynFlags finalDynFlags