moving #if to Gap.hs.
This commit is contained in:
parent
1524d2a43e
commit
be9a67f02a
@ -10,9 +10,10 @@ module Language.Haskell.GhcMod.CabalApi (
|
|||||||
, cabalConfigDependencies
|
, cabalConfigDependencies
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Language.Haskell.GhcMod.Types
|
|
||||||
import Language.Haskell.GhcMod.GhcPkg
|
|
||||||
import Language.Haskell.GhcMod.CabalConfig
|
import Language.Haskell.GhcMod.CabalConfig
|
||||||
|
import Language.Haskell.GhcMod.Gap (benchmarkBuildInfo, benchmarkTargets, toModuleString)
|
||||||
|
import Language.Haskell.GhcMod.GhcPkg
|
||||||
|
import Language.Haskell.GhcMod.Types
|
||||||
|
|
||||||
import Control.Applicative ((<$>))
|
import Control.Applicative ((<$>))
|
||||||
import qualified Control.Exception as E
|
import qualified Control.Exception as E
|
||||||
@ -20,7 +21,6 @@ import Control.Monad (filterM)
|
|||||||
import CoreMonad (liftIO)
|
import CoreMonad (liftIO)
|
||||||
import Data.Maybe (maybeToList)
|
import Data.Maybe (maybeToList)
|
||||||
import Data.Set (fromList, toList)
|
import Data.Set (fromList, toList)
|
||||||
import Distribution.ModuleName (ModuleName,toFilePath)
|
|
||||||
import Distribution.Package (Dependency(Dependency)
|
import Distribution.Package (Dependency(Dependency)
|
||||||
, PackageName(PackageName))
|
, PackageName(PackageName))
|
||||||
import qualified Distribution.Package as C
|
import qualified Distribution.Package as C
|
||||||
@ -119,11 +119,7 @@ cabalAllBuildInfo pd = libBI ++ execBI ++ testBI ++ benchBI
|
|||||||
libBI = map P.libBuildInfo $ maybeToList $ P.library pd
|
libBI = map P.libBuildInfo $ maybeToList $ P.library pd
|
||||||
execBI = map P.buildInfo $ P.executables pd
|
execBI = map P.buildInfo $ P.executables pd
|
||||||
testBI = map P.testBuildInfo $ P.testSuites pd
|
testBI = map P.testBuildInfo $ P.testSuites pd
|
||||||
#if __GLASGOW_HASKELL__ >= 704
|
benchBI = benchmarkBuildInfo pd
|
||||||
benchBI = map P.benchmarkBuildInfo $ P.benchmarks pd
|
|
||||||
#else
|
|
||||||
benchBI = []
|
|
||||||
#endif
|
|
||||||
|
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
|
|
||||||
@ -172,16 +168,7 @@ cabalAllTargets pd = do
|
|||||||
Just l -> P.libModules l
|
Just l -> P.libModules l
|
||||||
|
|
||||||
libTargets = map toModuleString lib
|
libTargets = map toModuleString lib
|
||||||
#if __GLASGOW_HASKELL__ >= 704
|
benchTargets = benchmarkTargets pd
|
||||||
benchTargets = map toModuleString $ concatMap P.benchmarkModules $ P.benchmarks pd
|
|
||||||
#else
|
|
||||||
benchTargets = []
|
|
||||||
#endif
|
|
||||||
toModuleString :: ModuleName -> String
|
|
||||||
toModuleString mn = fromFilePath $ toFilePath mn
|
|
||||||
|
|
||||||
fromFilePath :: FilePath -> String
|
|
||||||
fromFilePath fp = map (\c -> if c=='/' then '.' else c) fp
|
|
||||||
|
|
||||||
getTestTarget :: TestSuite -> IO [String]
|
getTestTarget :: TestSuite -> IO [String]
|
||||||
getTestTarget ts =
|
getTestTarget ts =
|
||||||
|
@ -33,6 +33,9 @@ module Language.Haskell.GhcMod.Gap (
|
|||||||
, fileModSummary
|
, fileModSummary
|
||||||
, WarnFlags
|
, WarnFlags
|
||||||
, emptyWarnFlags
|
, emptyWarnFlags
|
||||||
|
, benchmarkBuildInfo
|
||||||
|
, benchmarkTargets
|
||||||
|
, toModuleString
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Applicative hiding (empty)
|
import Control.Applicative hiding (empty)
|
||||||
@ -58,6 +61,7 @@ import StringBuffer
|
|||||||
import TcType
|
import TcType
|
||||||
import Var (varType)
|
import Var (varType)
|
||||||
|
|
||||||
|
import qualified Distribution.PackageDescription as P
|
||||||
import qualified InstEnv
|
import qualified InstEnv
|
||||||
import qualified Pretty
|
import qualified Pretty
|
||||||
import qualified StringBuffer as SB
|
import qualified StringBuffer as SB
|
||||||
@ -80,6 +84,7 @@ import Data.Convertible
|
|||||||
|
|
||||||
#if __GLASGOW_HASKELL__ >= 704
|
#if __GLASGOW_HASKELL__ >= 704
|
||||||
import qualified Data.IntSet as I (IntSet, empty)
|
import qualified Data.IntSet as I (IntSet, empty)
|
||||||
|
import qualified Distribution.ModuleName as M (ModuleName,toFilePath)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
@ -398,3 +403,26 @@ type WarnFlags = [WarningFlag]
|
|||||||
emptyWarnFlags :: WarnFlags
|
emptyWarnFlags :: WarnFlags
|
||||||
emptyWarnFlags = []
|
emptyWarnFlags = []
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
----------------------------------------------------------------
|
||||||
|
----------------------------------------------------------------
|
||||||
|
|
||||||
|
benchmarkBuildInfo :: P.PackageDescription -> [P.BuildInfo]
|
||||||
|
#if __GLASGOW_HASKELL__ >= 704
|
||||||
|
benchmarkBuildInfo pd = map P.benchmarkBuildInfo $ P.benchmarks pd
|
||||||
|
#else
|
||||||
|
benchmarkBuildInfo pd = []
|
||||||
|
#endif
|
||||||
|
|
||||||
|
benchmarkTargets :: P.PackageDescription -> [String]
|
||||||
|
#if __GLASGOW_HASKELL__ >= 704
|
||||||
|
benchmarkTargets pd = map toModuleString $ concatMap P.benchmarkModules $ P.benchmarks pd
|
||||||
|
#else
|
||||||
|
benchmarkTargets = []
|
||||||
|
#endif
|
||||||
|
|
||||||
|
toModuleString :: M.ModuleName -> String
|
||||||
|
toModuleString mn = fromFilePath $ M.toFilePath mn
|
||||||
|
where
|
||||||
|
fromFilePath :: FilePath -> String
|
||||||
|
fromFilePath fp = map (\c -> if c=='/' then '.' else c) fp
|
||||||
|
Loading…
Reference in New Issue
Block a user