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 GHC
|
||||
import GHCApi
|
||||
import qualified Gap
|
||||
import Language.Haskell.Extension
|
||||
import System.Directory
|
||||
import System.FilePath
|
||||
@ -34,8 +35,8 @@ initializeGHC opt fileName ghcOptions logging = withCabal <|> withoutCabal
|
||||
(owdir,cdir,cfile) <- liftIO getDirs
|
||||
binfo <- liftIO $ parseCabalFile cfile
|
||||
let (idirs',exts',mlang) = extractBuildInfo binfo
|
||||
exts = map addX exts'
|
||||
lang = maybe "-XHaskell98" addX mlang
|
||||
exts = map (addX . Gap.extensionToString) exts'
|
||||
lang = maybe "-XHaskell98" (addX . show) mlang
|
||||
gopts = ghcOptions ++ exts ++ [lang]
|
||||
changeToCabalDirectory cdir
|
||||
let idirs = case idirs' of
|
||||
@ -44,7 +45,7 @@ initializeGHC opt fileName ghcOptions logging = withCabal <|> withoutCabal
|
||||
file = ajustFileName fileName owdir cdir
|
||||
logReader <- initSession opt gopts idirs logging
|
||||
return (file,logReader)
|
||||
addX x = "-X" ++ show x
|
||||
addX = ("-X" ++)
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
|
14
Gap.hs
14
Gap.hs
@ -9,6 +9,7 @@ module Gap (
|
||||
, fOptions
|
||||
, toStringBuffer
|
||||
, liftIO
|
||||
, extensionToString
|
||||
#if __GLASGOW_HASKELL__ >= 702
|
||||
#else
|
||||
, module Pretty
|
||||
@ -21,6 +22,7 @@ import Control.Monad
|
||||
import DynFlags
|
||||
import FastString
|
||||
import GHC
|
||||
import Language.Haskell.Extension
|
||||
import Outputable
|
||||
import StringBuffer
|
||||
|
||||
@ -119,3 +121,15 @@ setCtx ms = do
|
||||
where
|
||||
lookupMod = lookupModule (ms_mod_name mos) Nothing >> return True
|
||||
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