Commit e09bc749 authored by ttuegel's avatar ttuegel

cabal bench: skip unbuildable benchmarks

parent e2ec9323
......@@ -111,7 +111,8 @@ import Distribution.Client.Utils (determineNumJobs
,existsAndIsMoreRecentThan)
import Distribution.PackageDescription
( Executable(..), benchmarkName, testName, testBuildInfo, buildable )
( Executable(..), benchmarkName, benchmarkBuildInfo, testName
, testBuildInfo, buildable )
import Distribution.PackageDescription.Parse
( readPackageDescription )
import Distribution.PackageDescription.PrettyPrint
......@@ -783,21 +784,29 @@ benchmarkAction (benchmarkFlags, buildFlags, buildExFlags)
-- the package was just configured, so the LBI must be available
lbi <- getPersistBuildConfig distPref
let pkgDescr = LBI.localPkgDescr lbi
nameBenchsOnly = LBI.foldComponent (const Nothing)
(const Nothing)
(const Nothing)
(Just . benchmarkName)
nameBenchsOnly =
LBI.foldComponent
(const Nothing)
(const Nothing)
(const Nothing)
(\b ->
if buildable (benchmarkBuildInfo b)
then Just (benchmarkName b)
else Nothing)
benchs = mapMaybe nameBenchsOnly $ LBI.pkgComponents pkgDescr
extraArgs'
| null extraArgs = benchs
| otherwise = extraArgs
maybeWithSandboxDirOnSearchPath useSandbox $
build verbosity config distPref buildFlags' extraArgs'
if null benchs
then notice verbosity "Package has no buildable benchmarks."
else do
maybeWithSandboxDirOnSearchPath useSandbox $
build verbosity config distPref buildFlags' extraArgs'
maybeWithSandboxDirOnSearchPath useSandbox $
setupWrapper verbosity setupOptions Nothing
Cabal.benchmarkCommand (const benchmarkFlags) extraArgs'
maybeWithSandboxDirOnSearchPath useSandbox $
setupWrapper verbosity setupOptions Nothing
Cabal.benchmarkCommand (const benchmarkFlags) extraArgs'
haddockAction :: HaddockFlags -> [String] -> GlobalFlags -> IO ()
haddockAction haddockFlags extraArgs globalFlags = do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment