Commit 296026e2 authored by Dave Laing's avatar Dave Laing

Adds --enable-tests and --enable-benchmarks to 'cabal fetch'.

parent 4abf81f8
-----------------------------------------------------------------------------
-- |
------------------------------------------------------------------------------- |
-- Module : Distribution.Client.Fetch
-- Copyright : (c) David Himmelstrup 2005
-- Duncan Coutts 2011
......@@ -25,6 +24,9 @@ import qualified Distribution.Client.SolverInstallPlan as SolverInstallPlan
import Distribution.Client.Setup
( GlobalFlags(..), FetchFlags(..), RepoContext(..) )
import Distribution.Solver.Types.ConstraintSource
import Distribution.Solver.Types.LabeledPackageConstraint
import Distribution.Solver.Types.OptionalStanza
import Distribution.Solver.Types.PkgConfigDb ( PkgConfigDb, readPkgConfigDb )
import Distribution.Solver.Types.SolverPackage
import Distribution.Solver.Types.SourcePackage
......@@ -37,7 +39,7 @@ import Distribution.Simple.PackageIndex (InstalledPackageIndex)
import Distribution.Simple.Program
( ProgramDb )
import Distribution.Simple.Setup
( fromFlag )
( fromFlag, fromFlagOrDefault )
import Distribution.Simple.Utils
( die', notice, debug )
import Distribution.System
......@@ -168,6 +170,13 @@ planPackages verbosity comp platform fetchFlags
. setSolverVerbosity verbosity
. addConstraints
[ let pc = PackageConstraint
(scopeToplevel $ pkgSpecifierTarget pkgSpecifier)
(PackagePropertyStanzas stanzas)
in LabeledPackageConstraint pc ConstraintSourceConfigFlagOrTarget
| pkgSpecifier <- pkgSpecifiers ]
-- Reinstall the targets given on the command line so that the dep
-- resolver will decide that they need fetching, even if they're
-- already installed. Since we want to get the source packages of
......@@ -179,6 +188,11 @@ planPackages verbosity comp platform fetchFlags
includeDependencies = fromFlag (fetchDeps fetchFlags)
logMsg message rest = debug verbosity message >> rest
stanzas = [ TestStanzas | testsEnabled ]
++ [ BenchStanzas | benchmarksEnabled ]
testsEnabled = fromFlagOrDefault False $ fetchTests fetchFlags
benchmarksEnabled = fromFlagOrDefault False $ fetchBenchmarks fetchFlags
reorderGoals = fromFlag (fetchReorderGoals fetchFlags)
countConflicts = fromFlag (fetchCountConflicts fetchFlags)
independentGoals = fromFlag (fetchIndependentGoals fetchFlags)
......
......@@ -765,6 +765,8 @@ data FetchFlags = FetchFlags {
fetchShadowPkgs :: Flag ShadowPkgs,
fetchStrongFlags :: Flag StrongFlags,
fetchAllowBootLibInstalls :: Flag AllowBootLibInstalls,
fetchTests :: Flag Bool,
fetchBenchmarks :: Flag Bool,
fetchVerbosity :: Flag Verbosity
}
......@@ -781,6 +783,8 @@ defaultFetchFlags = FetchFlags {
fetchShadowPkgs = Flag (ShadowPkgs False),
fetchStrongFlags = Flag (StrongFlags False),
fetchAllowBootLibInstalls = Flag (AllowBootLibInstalls False),
fetchTests = toFlag False,
fetchBenchmarks = toFlag False,
fetchVerbosity = toFlag normal
}
......@@ -818,6 +822,16 @@ fetchCommand = CommandUI {
fetchDryRun (\v flags -> flags { fetchDryRun = v })
trueArg
, option "" ["tests"]
"dependency checking and compilation for test suites listed in the package description file."
fetchTests (\v flags -> flags { fetchTests = v })
(boolOpt [] [])
, option "" ["benchmarks"]
"dependency checking and compilation for benchmarks listed in the package description file."
fetchBenchmarks (\v flags -> flags { fetchBenchmarks = v })
(boolOpt [] [])
] ++
optionSolver fetchSolver (\v flags -> flags { fetchSolver = v }) :
......
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