Return correct values for cabalAllTargets.
This commit is contained in:
parent
c570c5b689
commit
93195cb780
@ -13,7 +13,7 @@ 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.ModuleName (ModuleName,toFilePath)
|
||||||
import Distribution.Package (Dependency(Dependency)
|
import Distribution.Package (Dependency(Dependency)
|
||||||
, PackageName(PackageName)
|
, PackageName(PackageName)
|
||||||
, PackageIdentifier(pkgName))
|
, PackageIdentifier(pkgName))
|
||||||
@ -165,14 +165,26 @@ getGHC = do
|
|||||||
|
|
||||||
-- | Extracting all 'Module' 'FilePath's for libraries, executables,
|
-- | Extracting all 'Module' 'FilePath's for libraries, executables,
|
||||||
-- tests and benchmarks.
|
-- tests and benchmarks.
|
||||||
cabalAllTargets :: PackageDescription -> ([FilePath],[FilePath],[FilePath],[FilePath])
|
cabalAllTargets :: PackageDescription -> ([String],[String],[String],[String])
|
||||||
cabalAllTargets pd = targets
|
cabalAllTargets pd = targets
|
||||||
where
|
where
|
||||||
lib = case library pd of
|
lib = case library pd of
|
||||||
Nothing -> []
|
Nothing -> []
|
||||||
Just l -> libModules l
|
Just l -> libModules l
|
||||||
|
|
||||||
targets = (map toFilePath $ lib,
|
targets = (map toModuleString $ lib,
|
||||||
map modulePath $ executables pd,
|
map (fromFilePath . modulePath) $ executables pd,
|
||||||
map toFilePath $ concatMap testModules $ testSuites pd,
|
-- map toModuleString $ concatMap testModules $ testSuites pd,
|
||||||
map toFilePath $ concatMap benchmarkModules $ benchmarks pd)
|
concatMap getTestTargets $ map testInterface $ testSuites pd,
|
||||||
|
map toModuleString $ concatMap benchmarkModules $ benchmarks pd)
|
||||||
|
|
||||||
|
toModuleString :: ModuleName -> String
|
||||||
|
toModuleString mn = fromFilePath $ toFilePath mn
|
||||||
|
|
||||||
|
fromFilePath :: FilePath -> String
|
||||||
|
fromFilePath fp = map (\c -> if c=='/' then '.' else c) fp
|
||||||
|
|
||||||
|
getTestTargets :: TestSuiteInterface -> [String]
|
||||||
|
getTestTargets (TestSuiteExeV10 _ filePath) = [fromFilePath filePath]
|
||||||
|
getTestTargets (TestSuiteLibV09 _ moduleName) = [toModuleString moduleName]
|
||||||
|
getTestTargets (TestSuiteUnsupported _) = []
|
||||||
|
Loading…
Reference in New Issue
Block a user