This commit is contained in:
Pepe Iborra 2022-09-16 10:59:15 +01:00
parent 25cf51837a
commit 2752d7c0a5

View File

@ -15,7 +15,8 @@ import Control.Monad
import Data.Attoparsec.Text import Data.Attoparsec.Text
import Data.Char import Data.Char
import Data.Foldable (asum) import Data.Foldable (asum)
import Data.Maybe (maybeToList, catMaybes) import Data.Maybe (catMaybes,
maybeToList)
import Data.Text (Text) import Data.Text (Text)
import qualified Data.Text as T import qualified Data.Text as T
import Data.Text.Encoding (encodeUtf8) import Data.Text.Encoding (encodeUtf8)
@ -23,15 +24,17 @@ import Distribution.ModuleName (ModuleName,
toFilePath) toFilePath)
import Distribution.Package (pkgName, import Distribution.Package (pkgName,
unPackageName) unPackageName)
import Distribution.PackageDescription (Benchmark (benchmarkBuildInfo, benchmarkName, benchmarkInterface), import Distribution.PackageDescription (Benchmark (benchmarkBuildInfo, benchmarkInterface, benchmarkName),
BenchmarkInterface (BenchmarkExeV10),
Executable (buildInfo, exeName, modulePath), Executable (buildInfo, exeName, modulePath),
ForeignLib (foreignLibBuildInfo, foreignLibName), ForeignLib (foreignLibBuildInfo, foreignLibName),
Library (libBuildInfo, libName), Library (libBuildInfo, libName),
LibraryName (..), LibraryName (..),
TestSuiteInterface (TestSuiteExeV10),
benchmarkModules, benchmarkModules,
exeModules, exeModules,
explicitLibModules, explicitLibModules,
foreignLibModules, TestSuiteInterface (TestSuiteExeV10), BenchmarkInterface (BenchmarkExeV10)) foreignLibModules)
import Distribution.PackageDescription.Configuration import Distribution.PackageDescription.Configuration
import Distribution.PackageDescription.Parsec import Distribution.PackageDescription.Parsec
import Distribution.Types.BuildInfo import Distribution.Types.BuildInfo
@ -39,9 +42,9 @@ import Distribution.Types.PackageDescription
import Distribution.Types.TestSuite import Distribution.Types.TestSuite
import Distribution.Types.UnqualComponentName import Distribution.Types.UnqualComponentName
import Distribution.Utils.Path (getSymbolicPath) import Distribution.Utils.Path (getSymbolicPath)
import System.FilePath ((</>), (<.>)) import GHC.IO (unsafePerformIO)
import GHC.IO (unsafePerformIO) import System.Directory (doesFileExist)
import System.Directory (doesFileExist) import System.FilePath ((<.>), (</>))
type Name = Text type Name = Text
@ -172,7 +175,7 @@ extractPackage PackageDescription{..} = Package n cc where
benchmarkExePath :: Benchmark -> [FilePath] benchmarkExePath :: Benchmark -> [FilePath]
benchmarkExePath b = case benchmarkInterface b of benchmarkExePath b = case benchmarkInterface b of
BenchmarkExeV10 _ f -> [f] BenchmarkExeV10 _ f -> [f]
_ -> [] _ -> []
toFilePath' :: ModuleName -> [FilePath] toFilePath' :: ModuleName -> [FilePath]
toFilePath' mod = [ toFilePath mod <.> ext | ext <- ["hs", "lhs"]] toFilePath' mod = [ toFilePath mod <.> ext | ext <- ["hs", "lhs"]]
@ -180,4 +183,4 @@ toFilePath' mod = [ toFilePath mod <.> ext | ext <- ["hs", "lhs"]]
testExePath :: TestSuite -> [FilePath] testExePath :: TestSuite -> [FilePath]
testExePath t = case testInterface t of testExePath t = case testInterface t of
TestSuiteExeV10 _ fp -> [fp] TestSuiteExeV10 _ fp -> [fp]
_ -> [] _ -> []