Skip to content

Commit

Permalink
Enable tests and benchmarks in cabal-install without modifications to…
Browse files Browse the repository at this point in the history
… the Cabal library.
  • Loading branch information
ttuegel committed Feb 8, 2012
1 parent db220a5 commit ff883a0
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions cabal-install/Distribution/Client/Types.hs
Expand Up @@ -18,9 +18,10 @@ import Distribution.Package
import Distribution.InstalledPackageInfo
( InstalledPackageInfo )
import Distribution.PackageDescription
( GenericPackageDescription, FlagAssignment )
( Benchmark(..), GenericPackageDescription(..), FlagAssignment
, TestSuite(..) )
import Distribution.PackageDescription.Configuration
( enableBenchmarks, enableTests )
( mapTreeData )
import Distribution.Client.PackageIndex
( PackageIndex )
import Distribution.Version
Expand Down Expand Up @@ -110,9 +111,15 @@ enableStanzas
:: [OptionalStanza]
-> GenericPackageDescription
-> GenericPackageDescription
enableStanzas stanzas
= enableTests (TestStanzas `elem` stanzas)
. enableBenchmarks (BenchStanzas `elem` stanzas)
enableStanzas stanzas gpkg = gpkg
{ condBenchmarks = flagBenchmarks $ condBenchmarks gpkg
, condTestSuites = flagTests $ condTestSuites gpkg
}
where
enableTest t = t { testEnabled = TestStanzas `elem` stanzas }
enableBenchmark bm = bm { benchmarkEnabled = BenchStanzas `elem` stanzas }
flagBenchmarks = map (\(n, bm) -> (n, mapTreeData enableBenchmark bm))
flagTests = map (\(n, t) -> (n, mapTreeData enableTest t))

-- ------------------------------------------------------------
-- * Package locations and repositories
Expand Down

0 comments on commit ff883a0

Please sign in to comment.