Commit adcf97d4 authored by ttuegel's avatar ttuegel
Browse files

Useful error message for --enable-library-coverage

parent 9279996c
......@@ -84,7 +84,8 @@ import Distribution.Simple.Program
, lookupProgram, requireProgram, requireProgramVersion
, pkgConfigProgram, gccProgram, rawSystemProgramStdoutConf )
import Distribution.Simple.Setup
( ConfigFlags(..), CopyDest(..), fromFlag, fromFlagOrDefault, flagToMaybe )
( ConfigFlags(..), CopyDest(..), Flag(..), fromFlag, fromFlagOrDefault
, flagToMaybe )
import Distribution.Simple.InstallDirs
( InstallDirs(..), defaultInstallDirs, combineInstallDirs )
import Distribution.Simple.LocalBuildInfo
......@@ -293,7 +294,13 @@ localBuildInfoFile distPref = distPref </> "setup-config"
configure :: (GenericPackageDescription, HookedBuildInfo)
-> ConfigFlags -> IO LocalBuildInfo
configure (pkg_descr0, pbi) cfg
= do let distPref = fromFlag (configDistPref cfg)
= do unless (configLibCoverage cfg == NoFlag) $ do
let enable | fromFlag (configLibCoverage cfg) = "enable"
| otherwise = "disable"
die $ "Option --" ++ enable ++ "-library-coverage is obsolete! "
++ "Please use --" ++ enable ++ "-coverage instead."
let distPref = fromFlag (configDistPref cfg)
buildDir' = distPref </> "build"
verbosity = fromFlag (configVerbosity cfg)
......
......@@ -297,9 +297,12 @@ data ConfigFlags = ConfigFlags {
configTests :: Flag Bool, -- ^Enable test suite compilation
configBenchmarks :: Flag Bool, -- ^Enable benchmark compilation
configCoverage :: Flag Bool, -- ^Enable program coverage
configExactConfiguration :: Flag Bool
configLibCoverage :: Flag Bool, -- ^OBSOLETE. Just used to signal error.
configExactConfiguration :: Flag Bool,
-- ^All direct dependencies and flags are provided on the command line by
-- the user via the '--dependency' and '--flags' options.
configFlagError :: Flag String
-- ^Halt and show an error message indicating an error in flag assignment
}
deriving (Generic, Read, Show)
......@@ -338,7 +341,9 @@ defaultConfigFlags progConf = emptyConfigFlags {
configTests = Flag False,
configBenchmarks = Flag False,
configCoverage = Flag False,
configExactConfiguration = Flag False
configLibCoverage = NoFlag,
configExactConfiguration = Flag False,
configFlagError = NoFlag
}
configureCommand :: ProgramConfiguration -> CommandUI ConfigFlags
......@@ -522,6 +527,11 @@ configureOptions showOrParseArgs =
configTests (\v flags -> flags { configTests = v })
(boolOpt [] [])
,option "" ["library-coverage"]
"OBSOLETE. Please use --enable-coverage instead."
configLibCoverage (\v flags -> flags { configLibCoverage = v })
(boolOpt [] [])
,option "" ["coverage"]
"build package with Haskell Program Coverage enabled. (GHC only)"
configCoverage (\v flags -> flags { configCoverage = v })
......@@ -677,8 +687,10 @@ instance Monoid ConfigFlags where
configConfigurationsFlags = mempty,
configTests = mempty,
configCoverage = mempty,
configLibCoverage = mempty,
configExactConfiguration = mempty,
configBenchmarks = mempty
configBenchmarks = mempty,
configFlagError = mempty
}
mappend a b = ConfigFlags {
configPrograms = configPrograms b,
......@@ -714,8 +726,10 @@ instance Monoid ConfigFlags where
configConfigurationsFlags = combine configConfigurationsFlags,
configTests = combine configTests,
configCoverage = combine configCoverage,
configLibCoverage = combine configLibCoverage,
configExactConfiguration = combine configExactConfiguration,
configBenchmarks = combine configBenchmarks
configBenchmarks = combine configBenchmarks,
configFlagError = combine configFlagError
}
where combine field = field a `mappend` field b
......
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