parent
668e9e4771
commit
4426f7fd0f
@ -6,12 +6,14 @@ module Language.Haskell.GhcMod.CabalApi (
|
|||||||
, cabalAllBuildInfo
|
, cabalAllBuildInfo
|
||||||
, cabalDependPackages
|
, cabalDependPackages
|
||||||
, cabalSourceDirs
|
, cabalSourceDirs
|
||||||
|
, cabalAllTargets
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Applicative ((<$>))
|
import Control.Applicative ((<$>))
|
||||||
import Control.Exception (throwIO)
|
import Control.Exception (throwIO)
|
||||||
import Data.Maybe (maybeToList)
|
import Data.Maybe (maybeToList)
|
||||||
import Data.Set (fromList, toList)
|
import Data.Set (fromList, toList)
|
||||||
|
import Distribution.ModuleName (toFilePath)
|
||||||
import Distribution.Package (Dependency(Dependency)
|
import Distribution.Package (Dependency(Dependency)
|
||||||
, PackageName(PackageName)
|
, PackageName(PackageName)
|
||||||
, PackageIdentifier(pkgName))
|
, PackageIdentifier(pkgName))
|
||||||
@ -158,3 +160,19 @@ getGHC = do
|
|||||||
case mv of
|
case mv of
|
||||||
Nothing -> throwIO $ userError "ghc not found"
|
Nothing -> throwIO $ userError "ghc not found"
|
||||||
Just v -> return $ v
|
Just v -> return $ v
|
||||||
|
|
||||||
|
----------------------------------------------------------------
|
||||||
|
|
||||||
|
-- | Extracting all 'Module' 'FilePath's for libraries, executables,
|
||||||
|
-- tests and benchmarks.
|
||||||
|
cabalAllTargets :: PackageDescription -> ([FilePath],[FilePath],[FilePath],[FilePath])
|
||||||
|
cabalAllTargets pd = targets
|
||||||
|
where
|
||||||
|
lib = case library pd of
|
||||||
|
Nothing -> []
|
||||||
|
Just l -> libModules l
|
||||||
|
|
||||||
|
targets = (map toFilePath $ lib,
|
||||||
|
map modulePath $ executables pd,
|
||||||
|
map toFilePath $ concatMap testModules $ testSuites pd,
|
||||||
|
map toFilePath $ concatMap benchmarkModules $ benchmarks pd)
|
||||||
|
@ -13,6 +13,7 @@ module Language.Haskell.GhcMod.Internal (
|
|||||||
, cabalAllBuildInfo
|
, cabalAllBuildInfo
|
||||||
, cabalDependPackages
|
, cabalDependPackages
|
||||||
, cabalSourceDirs
|
, cabalSourceDirs
|
||||||
|
, cabalAllTargets
|
||||||
-- * GHC API
|
-- * GHC API
|
||||||
, canCheckFast
|
, canCheckFast
|
||||||
-- * Getting 'DynFlags'
|
-- * Getting 'DynFlags'
|
||||||
|
Loading…
Reference in New Issue
Block a user