Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal On branch : master
http://hackage.haskell.org/trac/ghc/changeset/1e5763c5757f9637199d4d882c6d8e45c2cf3bde >--------------------------------------------------------------- commit 1e5763c5757f9637199d4d882c6d8e45c2cf3bde Author: Johan Tibell <[email protected]> Date: Wed Oct 12 14:30:34 2011 +0000 Build executable benchmarks Benchmarks are treated just like test suites in that a dummy Executable is created and built. >--------------------------------------------------------------- cabal/Distribution/Simple/Build.hs | 23 ++++++++++++++++++++++- cabal/Distribution/Simple/LocalBuildInfo.hs | 3 +++ 2 files changed, 25 insertions(+), 1 deletions(-) diff --git a/cabal/Distribution/Simple/Build.hs b/cabal/Distribution/Simple/Build.hs index 4e787b1..d33ada9 100644 --- a/cabal/Distribution/Simple/Build.hs +++ b/cabal/Distribution/Simple/Build.hs @@ -69,7 +69,8 @@ import Distribution.Simple.Compiler ( CompilerFlavor(..), compilerFlavor, PackageDB(..) ) import Distribution.PackageDescription ( PackageDescription(..), BuildInfo(..), Library(..), Executable(..) - , TestSuite(..), TestSuiteInterface(..) ) + , TestSuite(..), TestSuiteInterface(..), Benchmark(..) + , BenchmarkInterface(..) ) import qualified Distribution.InstalledPackageInfo as IPI import qualified Distribution.ModuleName as ModuleName @@ -231,6 +232,26 @@ build pkg_descr lbi flags suffixes = do TestSuiteUnsupported tt -> die $ "No support for building test suite " ++ "type " ++ display tt + CBench bm -> do + case benchmarkInterface bm of + BenchmarkExeV10 _ f -> do + let bi = benchmarkBuildInfo bm + exe = Executable + { exeName = benchmarkName bm + , modulePath = f + , buildInfo = bi + } + progs' = addInternalBuildTools pkg_descr lbi bi (withPrograms lbi) + lbi' = lbi { + withPrograms = progs', + withPackageDB = withPackageDB lbi ++ [internalPackageDB] + } + pre comp lbi' + info verbosity $ "Building benchmark " ++ benchmarkName bm ++ "..." + buildExe verbosity pkg_descr lbi' exe clbi + BenchmarkUnsupported tt -> die $ "No support for building benchmark " + ++ "type " ++ display tt + -- | Initialize a new package db file for libraries defined -- internally to the package. createInternalPackageDB :: FilePath -> IO PackageDB diff --git a/cabal/Distribution/Simple/LocalBuildInfo.hs b/cabal/Distribution/Simple/LocalBuildInfo.hs index c7290b8..b59f6ef 100644 --- a/cabal/Distribution/Simple/LocalBuildInfo.hs +++ b/cabal/Distribution/Simple/LocalBuildInfo.hs @@ -207,6 +207,9 @@ allComponentsBy pkg_descr f = ++ [ f (CTest tst) | tst <- testSuites pkg_descr , buildable (testBuildInfo tst) , testEnabled tst ] + ++ [ f (CBench bm) | bm <- benchmarks pkg_descr + , buildable (benchmarkBuildInfo bm) + , benchmarkEnabled bm ] -- |If the package description has a library section, call the given -- function with the library build info as argument. Extended version of _______________________________________________ Cvs-libraries mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-libraries
