{-# LANGUAGE CPP #-}
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Simple.LHC
......@@ -90,7 +91,9 @@ import Control.Monad ( unless, when )
import Data.List
import qualified Data.Map as M ( empty )
import Data.Maybe ( catMaybes )
#if __GLASGOW_HASKELL__ < 710
import Data.Monoid ( Monoid(..) )
#endif
import System.Directory ( removeFile, renameFile,
getDirectoryContents, doesFileExist,
getTemporaryDirectory )
......
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveGeneric #-}
-----------------------------------------------------------------------------
......@@ -79,7 +80,9 @@ import qualified Data.Graph as Graph
import Data.List as List
( null, foldl', sort
, groupBy, sortBy, find, isInfixOf, nubBy, deleteBy, deleteFirstsBy )
#if __GLASGOW_HASKELL__ < 710
import Data.Monoid (Monoid(..))
#endif
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Maybe (isNothing, fromMaybe)
......
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveGeneric #-}
-----------------------------------------------------------------------------
......@@ -74,7 +75,9 @@ import Distribution.Verbosity
( Verbosity )
import Distribution.Compat.Binary (Binary(..))
#if __GLASGOW_HASKELL__ < 710
import Data.Functor ((<$>))
#endif
import Data.List
( foldl' )
import Data.Maybe
......
{-# LANGUAGE CPP #-}
module Distribution.Simple.Program.GHC (
GhcOptions(..),
GhcMode(..),
......@@ -26,7 +27,9 @@ import Distribution.Utils.NubList ( NubListR, fromNubListR )
import Language.Haskell.Extension ( Language(..), Extension(..) )
import qualified Data.Map as M
#if __GLASGOW_HASKELL__ < 710
import Data.Monoid
#endif
import Data.List ( intercalate )
-- | A structured set of GHC options/flags
......
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveGeneric #-}
-----------------------------------------------------------------------------
......@@ -103,7 +104,9 @@ import Control.Monad (liftM)
import Distribution.Compat.Binary (Binary)
import Data.List ( sort )
import Data.Char ( isSpace, isAlpha )
#if __GLASGOW_HASKELL__ < 710
import Data.Monoid ( Monoid(..) )
#endif
import GHC.Generics (Generic)
-- FIXME Not sure where this should live
......@@ -455,7 +458,18 @@ configureOptions showOrParseArgs =
,option "" ["profiling"]
"Executable profiling (requires library profiling)"
configProfExe (\v flags -> flags { configProfLib = v, configProfExe = v })
-- HACK: See #2409. Thankfully, this is 1.22-specific.
(\flags ->
case (configProfLib flags, configProfExe flags) of
(Flag a, Flag b)
| (a == b)
&& ("cabalConfProf", "/TRUE") `elem` configProgramPaths flags
-> configProfExe flags
_ -> NoFlag)
(\v flags -> flags
{ configProfLib = v, configProfExe = v
, configProgramPaths = ("cabalConfProf", "/TRUE")
: configProgramPaths flags })
(boolOpt [] [])
,option "" ["executable-profiling"]
......
{-# LANGUAGE CPP #-}
module Distribution.Utils.NubList
( NubList -- opaque
, toNubList -- smart construtor
......@@ -11,7 +12,9 @@ module Distribution.Utils.NubList
) where
import Distribution.Compat.Binary
#if __GLASGOW_HASKELL__ < 710
import Data.Monoid
#endif
import Distribution.Simple.Utils (ordNub, listUnion, ordNubRight, listUnionRight)
......
VERSION=1.22.1.2
VERSION=1.22.2.0
#KIND=devel
KIND=rc
......
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
module PackageTests.DeterministicAr.Check where
......@@ -7,13 +8,22 @@ import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BS8
import Data.Char (isSpace)
import Data.List
#if __GLASGOW_HASKELL__ < 710
import Data.Traversable
#endif
import PackageTests.PackageTester
import System.Exit
import System.FilePath
import System.IO
import Test.HUnit (Assertion, Test (TestCase), assertFailure)
import Distribution.Compiler (CompilerFlavor(..), CompilerId(..))
import Distribution.Package (packageKeyHash)
import Distribution.Version (Version(..))
import Distribution.Simple.Compiler (compilerId)
import Distribution.Simple.Configure (getPersistBuildConfig)
import Distribution.Simple.LocalBuildInfo (LocalBuildInfo, compiler, pkgKey)
-- Perhaps these should live in PackageTester.
-- For a polymorphic @IO a@ rather than @Assertion = IO ()@.
......@@ -63,15 +73,22 @@ suite ghcPath ghcPkgPath = TestCase $ do
let distBuild = dir </> "dist" </> "build"
libdir <- ghcPkg_field1 this "library-dirs" ghcPkgPath
mapM_ checkMetadata [distBuild, libdir]
lbi <- getPersistBuildConfig (dir </> "dist")
mapM_ (checkMetadata lbi) [distBuild, libdir]
unregister this ghcPkgPath
-- Almost a copypasta of Distribution.Simple.Program.Ar.wipeMetadata
checkMetadata :: FilePath -> Assertion
checkMetadata dir = withBinaryFile path ReadMode $ \ h -> do
checkMetadata :: LocalBuildInfo -> FilePath -> Assertion
checkMetadata lbi dir = withBinaryFile path ReadMode $ \ h -> do
hFileSize h >>= checkArchive h
where
path = dir </> "libHS" ++ this ++ "-0.a"
path = dir </> "libHS" ++ this ++ "-0"
++ (if ghc_7_10 then ("-" ++ packageKeyHash (pkgKey lbi)) else "")
++ ".a"
ghc_7_10 = case compilerId (compiler lbi) of
CompilerId GHC version | version >= Version [7, 10] [] -> True
_ -> False
checkError msg = assertFailure' $
"PackageTests.DeterministicAr.checkMetadata: " ++ msg ++
......
......@@ -10,11 +10,16 @@ import Test.Framework (testGroup)
import Test.Framework.Providers.HUnit (hUnitTestToTests)
import Test.HUnit hiding ( path )
import Distribution.Compiler (CompilerFlavor(..), CompilerId(..))
import Distribution.PackageDescription (package)
import Distribution.Simple.Compiler (compilerId)
import Distribution.Simple.Configure (getPersistBuildConfig)
import Distribution.Simple.LocalBuildInfo (compiler, localPkgDescr, pkgKey)
import Distribution.Simple.Hpc
import Distribution.Simple.Program.Builtin (hpcProgram)
import Distribution.Simple.Program.Db
( emptyProgramDb, configureProgram, requireProgramVersion )
import Distribution.Text (display)
import qualified Distribution.Verbosity as Verbosity
import Distribution.Version (Version(..), orLaterVersion)
......@@ -70,16 +75,20 @@ checkTestWithHpc :: FilePath -> String -> [String] -> Test
checkTestWithHpc ghcPath name extraOpts = TestCase $ do
isCorrectVersion <- correctHpcVersion
when isCorrectVersion $ do
let distPref' = dir </> "dist-" ++ name
buildAndTest ghcPath name [] ("--enable-coverage" : extraOpts)
lbi <- getPersistBuildConfig (dir </> "dist-" ++ name)
lbi <- getPersistBuildConfig distPref'
let way = guessWay lbi
CompilerId comp version = compilerId (compiler lbi)
subdir
| comp == GHC && version >= Version [7, 10] [] =
display (pkgKey lbi)
| otherwise = display (package $ localPkgDescr lbi)
mapM_ shouldExist
[ mixDir (dir </> "dist-" ++ name) way "my-0.1"
</> "my-0.1" </> "Foo.mix"
, mixDir (dir </> "dist-" ++ name) way "test-Foo" </> "Main.mix"
, tixFilePath (dir </> "dist-" ++ name) way "test-Foo"
, htmlDir (dir </> "dist-" ++ name) way "test-Foo"
</> "hpc_index.html"
[ mixDir distPref' way "my-0.1" </> subdir </> "Foo.mix"
, mixDir distPref' way "test-Foo" </> "Main.mix"
, tixFilePath distPref' way "test-Foo"
, htmlDir distPref' way "test-Foo" </> "hpc_index.html"
]
-- | Ensures that even if -fhpc is manually provided no .tix file is output.
......
{-# LANGUAGE CPP #-}
module UnitTests.Distribution.Utils.NubList
( tests
) where
#if __GLASGOW_HASKELL__ < 710
import Data.Monoid
#endif
import Distribution.Utils.NubList
import Test.Framework
import Test.Framework.Providers.HUnit (testCase)
......
{-# LANGUAGE CPP #-}
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Client.Config
......@@ -91,8 +92,10 @@ import Data.List
( partition, find, foldl' )
import Data.Maybe
( fromMaybe )
#if !MIN_VERSION_base(4,8,0)
import Data.Monoid
( Monoid(..) )
#endif
import Control.Monad
( unless, foldM, liftM, liftM2 )
import qualified Distribution.Compat.ReadP as Parse
......
{-# LANGUAGE CPP #-}
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Client.Configure
......@@ -55,7 +56,9 @@ import Distribution.Verbosity as Verbosity
import Distribution.Version
( Version(..), VersionRange, orLaterVersion )
#if !MIN_VERSION_base(4,8,0)
import Data.Monoid (Monoid(..))
#endif
-- | Choose the Cabal version such that the setup scripts compiled against this
-- version will support the given command-line flags.
......
{-# LANGUAGE CPP #-}
module Distribution.Client.Dependency.Modular.Preference where
-- Reordering or pruning the tree in order to prefer or make certain choices.
import qualified Data.List as L
import qualified Data.Map as M
#if !MIN_VERSION_base(4,8,0)
import Data.Monoid
#endif
import Data.Ord
import Distribution.Client.Dependency.Types
......
{-# LANGUAGE CPP #-}
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Client.Dependency.Types
......@@ -59,8 +60,10 @@ import Data.List
( foldl', maximumBy, minimumBy, nub, sort, sortBy, groupBy )
import Data.Maybe
( fromJust, fromMaybe, catMaybes )
#if !MIN_VERSION_base(4,8,0)
import Data.Monoid
( Monoid(mempty) )
#endif
import Control.Monad
( guard )
import qualified Data.Set as Set
......
{-# LANGUAGE CPP #-}
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Client.Dependency.TopDown.Constraints
......@@ -35,8 +36,10 @@ import Distribution.Version
import Distribution.Client.Utils
( mergeBy, MergeResult(..) )
#if !MIN_VERSION_base(4,8,0)
import Data.Monoid
( Monoid(mempty) )
#endif
import Data.Either
( partitionEithers )
import qualified Data.Map as Map
......
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveFunctor #-}
-----------------------------------------------------------------------------
-- |
......@@ -29,13 +30,20 @@ module Distribution.Client.Dependency.Types (
foldProgress,
) where
#if !MIN_VERSION_base(4,8,0)
import Control.Applicative
( Applicative(..), Alternative(..) )
( Applicative(..) )
#endif
import Control.Applicative
( Alternative(..) )
import Data.Char
( isAlpha, toLower )
#if !MIN_VERSION_base(4,8,0)
import Data.Monoid
( Monoid(..) )
#endif
import Distribution.Client.Types
( OptionalStanza(..), SourcePackage(..) )
......
{-# LANGUAGE CPP #-}
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Client.Exec
......@@ -30,8 +31,10 @@ import Distribution.System (Platform)
import Distribution.Verbosity (Verbosity)
import System.FilePath (searchPathSeparator, (</>))
#if !MIN_VERSION_base(4,8,0)
import Control.Applicative ((<$>))
import Data.Monoid (mempty)
#endif
-- | Execute the given command in the package's environment.
......
{-# LANGUAGE CPP #-}
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Client.Freeze
......@@ -54,8 +55,10 @@ import Distribution.Verbosity
import Control.Monad
( when )
import qualified Data.ByteString.Lazy.Char8 as BS.Char8
#if !MIN_VERSION_base(4,8,0)
import Data.Monoid
( mempty )
#endif
import Data.Version
( showVersion )
import Distribution.Version
......
{-# LANGUAGE CPP #-}
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Client.Get
......@@ -51,8 +52,10 @@ import Data.List
import qualified Data.Map
import Data.Maybe
( listToMaybe, mapMaybe )
#if !MIN_VERSION_base(4,8,0)
import Data.Monoid
( mempty )
#endif
import Data.Ord
( comparing )
import System.Directory
......
{-# LANGUAGE CPP #-}
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Client.IndexUtils
......@@ -63,7 +64,9 @@ import Distribution.Simple.Utils
import Data.Char (isAlphaNum)
import Data.Maybe (mapMaybe, fromMaybe)
import Data.List (isPrefixOf)
#if !MIN_VERSION_base(4,8,0)
import Data.Monoid (Monoid(..))
#endif
import qualified Data.Map as Map
import Control.Monad (MonadPlus(mplus), when, liftM)
import Control.Exception (evaluate)
......