filling the gap b/w Cabal 1.10 and 1.14.
This commit is contained in:
parent
f353e89d11
commit
9daf5b36f0
7
Cabal.hs
7
Cabal.hs
@ -14,6 +14,7 @@ import Distribution.Verbosity (silent)
|
|||||||
import ErrMsg
|
import ErrMsg
|
||||||
import GHC
|
import GHC
|
||||||
import GHCApi
|
import GHCApi
|
||||||
|
import qualified Gap
|
||||||
import Language.Haskell.Extension
|
import Language.Haskell.Extension
|
||||||
import System.Directory
|
import System.Directory
|
||||||
import System.FilePath
|
import System.FilePath
|
||||||
@ -34,8 +35,8 @@ initializeGHC opt fileName ghcOptions logging = withCabal <|> withoutCabal
|
|||||||
(owdir,cdir,cfile) <- liftIO getDirs
|
(owdir,cdir,cfile) <- liftIO getDirs
|
||||||
binfo <- liftIO $ parseCabalFile cfile
|
binfo <- liftIO $ parseCabalFile cfile
|
||||||
let (idirs',exts',mlang) = extractBuildInfo binfo
|
let (idirs',exts',mlang) = extractBuildInfo binfo
|
||||||
exts = map addX exts'
|
exts = map (addX . Gap.extensionToString) exts'
|
||||||
lang = maybe "-XHaskell98" addX mlang
|
lang = maybe "-XHaskell98" (addX . show) mlang
|
||||||
gopts = ghcOptions ++ exts ++ [lang]
|
gopts = ghcOptions ++ exts ++ [lang]
|
||||||
changeToCabalDirectory cdir
|
changeToCabalDirectory cdir
|
||||||
let idirs = case idirs' of
|
let idirs = case idirs' of
|
||||||
@ -44,7 +45,7 @@ initializeGHC opt fileName ghcOptions logging = withCabal <|> withoutCabal
|
|||||||
file = ajustFileName fileName owdir cdir
|
file = ajustFileName fileName owdir cdir
|
||||||
logReader <- initSession opt gopts idirs logging
|
logReader <- initSession opt gopts idirs logging
|
||||||
return (file,logReader)
|
return (file,logReader)
|
||||||
addX x = "-X" ++ show x
|
addX = ("-X" ++)
|
||||||
|
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
|
|
||||||
|
14
Gap.hs
14
Gap.hs
@ -9,6 +9,7 @@ module Gap (
|
|||||||
, fOptions
|
, fOptions
|
||||||
, toStringBuffer
|
, toStringBuffer
|
||||||
, liftIO
|
, liftIO
|
||||||
|
, extensionToString
|
||||||
#if __GLASGOW_HASKELL__ >= 702
|
#if __GLASGOW_HASKELL__ >= 702
|
||||||
#else
|
#else
|
||||||
, module Pretty
|
, module Pretty
|
||||||
@ -21,6 +22,7 @@ import Control.Monad
|
|||||||
import DynFlags
|
import DynFlags
|
||||||
import FastString
|
import FastString
|
||||||
import GHC
|
import GHC
|
||||||
|
import Language.Haskell.Extension
|
||||||
import Outputable
|
import Outputable
|
||||||
import StringBuffer
|
import StringBuffer
|
||||||
|
|
||||||
@ -119,3 +121,15 @@ setCtx ms = do
|
|||||||
where
|
where
|
||||||
lookupMod = lookupModule (ms_mod_name mos) Nothing >> return True
|
lookupMod = lookupModule (ms_mod_name mos) Nothing >> return True
|
||||||
returnFalse = return False
|
returnFalse = return False
|
||||||
|
|
||||||
|
----------------------------------------------------------------
|
||||||
|
-- This is Cabal, not GHC API
|
||||||
|
|
||||||
|
extensionToString :: Extension -> String
|
||||||
|
#if __GLASGOW_HASKELL__ == 704
|
||||||
|
extensionToString (EnableExtension ext) = show ext
|
||||||
|
extensionToString (DisableExtension ext) = show ext -- FIXME
|
||||||
|
extensionToString (UnknownExtension ext) = ext
|
||||||
|
#else
|
||||||
|
extensionToString = show
|
||||||
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user