Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
Packages
Cabal
Commits
d5d35ccd
Commit
d5d35ccd
authored
Oct 03, 2016
by
kristenk
Browse files
Solver DSL: Make EnableAllTests an instance of BooleanFlag.
parent
d70e6f13
Changes
1
Hide whitespace changes
Inline
Side-by-side
cabal-install/tests/UnitTests/Distribution/Solver/Modular/DSL.hs
View file @
d5d35ccd
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
-- | DSL for testing the modular solver
module
UnitTests.Distribution.Solver.Modular.DSL
(
ExampleDependency
(
..
)
...
...
@@ -43,6 +44,7 @@ import qualified Distribution.Package as C
hiding
(
HasUnitId
(
..
))
import
qualified
Distribution.PackageDescription
as
C
import
qualified
Distribution.Simple.PackageIndex
as
C.PackageIndex
import
Distribution.Simple.Setup
(
BooleanFlag
(
..
))
import
qualified
Distribution.System
as
C
import
qualified
Distribution.Version
as
C
import
Language.Haskell.Extension
(
Extension
(
..
),
Language
)
...
...
@@ -176,6 +178,7 @@ data ExampleQualifier =
-- | Whether to enable tests in all packages in a test case.
newtype
EnableAllTests
=
EnableAllTests
Bool
deriving
BooleanFlag
-- | Constructs an 'ExampleAvailable' package for the 'ExampleDb',
-- given:
...
...
@@ -476,7 +479,7 @@ exResolve :: ExampleDb
->
EnableAllTests
->
Progress
String
String
CI
.
SolverInstallPlan
.
SolverInstallPlan
exResolve
db
exts
langs
pkgConfigDb
targets
solver
mbj
indepGoals
reorder
enableBj
vars
prefs
(
EnableAllTests
enableAllTests
)
enableBj
vars
prefs
enableAllTests
=
resolveDependencies
C
.
buildPlatform
compiler
pkgConfigDb
solver
params
where
defaultCompiler
=
C
.
unknownCompilerInfo
C
.
buildCompilerId
C
.
NoAbiTag
...
...
@@ -490,10 +493,10 @@ exResolve db exts langs pkgConfigDb targets solver mbj indepGoals reorder
,
packagePreferences
=
Map
.
empty
}
enableTests
|
enableAllTests
=
fmap
(
\
p
->
PackageConstraintStanzas
(
C
.
mkPackageName
p
)
[
TestStanzas
])
(
exDbPkgs
db
)
|
otherwise
=
[]
|
asBool
enableAllTests
=
fmap
(
\
p
->
PackageConstraintStanzas
(
C
.
mkPackageName
p
)
[
TestStanzas
])
(
exDbPkgs
db
)
|
otherwise
=
[]
targets'
=
fmap
(
\
p
->
NamedPackage
(
C
.
mkPackageName
p
)
[]
)
targets
params
=
addPreferences
(
fmap
toPref
prefs
)
$
addConstraints
(
fmap
toLpc
enableTests
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment