Skip to content

Project config #3156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 61 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
80d600d
Bump version.
23Skidoo Feb 22, 2016
4ae7963
Fix exitcode on `upload`ing failure
Feb 23, 2016
9b585b9
Warn when 'cabal configure' cannot resolve dependencies.
grayjay Feb 24, 2016
1f8a737
Revert "Add warning about testing Cabal on Windows"
grayjay Feb 24, 2016
1c056b9
Update appveyor.yml.
23Skidoo Feb 24, 2016
961ed20
Distribution.Simple.Setup: remove job cap
mistydemeo Feb 25, 2016
4fa616e
Add `gmappend`/`gmempty` Generics-helpers (re #3169)
hvr Feb 26, 2016
2863139
Add missing `containers` Semigroup instances
hvr Feb 26, 2016
482e886
Turn 'configPrograms' field into a 'Last'-monoid
hvr Feb 27, 2016
2d94783
Make configPrograms a bit more backward compatible
hvr Feb 29, 2016
2f5eb33
Make gmappend/gmempty definitions more compact.
23Skidoo Feb 29, 2016
9d47fa4
Derive some additional Generic instances
hvr Feb 28, 2016
34afaf8
Derive some additional Generic instances (cabal-install)
hvr Feb 28, 2016
4f8caf3
Derive some Semigroup/Monoid instances via Generics
hvr Feb 28, 2016
6ee0206
Derive some Semigroup/Monoid instances via Generics (cabal-install)
hvr Feb 28, 2016
f2cf01d
Use -XDeriveFunctor for `data InstallDirs`
hvr Feb 28, 2016
c106e43
80-col violation.
23Skidoo Feb 28, 2016
df45e05
Test suite: print actual output in more cases.
23Skidoo Feb 28, 2016
acbb69e
Improve documentation.
23Skidoo Mar 2, 2016
8b609e0
'ghc-options: -Werror' is bad practice.
23Skidoo Mar 2, 2016
ed1465e
Allow inconsistent handling of missing paths in 'sandbox delete-sourc…
grayjay Mar 3, 2016
e05d553
Clean up appveyor.yml
grayjay Mar 3, 2016
1c96351
Enable cabal-install integration tests in appveyor.yml
grayjay Mar 3, 2016
bb0c651
Make 'tryCanonicalizePath' work with directory > 1.2.3.0.
23Skidoo Mar 2, 2016
5ac82bb
Remove functor instance from Dep
edsko Feb 19, 2016
152df66
Detect and reject cyclic solutions in the solver
edsko Feb 19, 2016
fc16936
Rename cycle detection phase and typos.
kosmikus Mar 3, 2016
8bb9771
Typos.
23Skidoo Mar 3, 2016
11b24a0
Change a warning type.
23Skidoo Mar 3, 2016
99f0944
Follow-up to c0ec0b36d0ef686b26f0e2d55dacedd07a78bedf
hvr Mar 3, 2016
8ca942c
Silence -Wredundant-constraints warnings
hvr Mar 3, 2016
577911d
Improve goal reorder heuristics.
kosmikus Mar 3, 2016
dd6f20d
Restore the 'Eq AllowNewer' instance.
23Skidoo Mar 4, 2016
40e3623
Changelog update.
23Skidoo Mar 4, 2016
915f6f8
Fix debugging output for infinite backjumps.
kosmikus Mar 4, 2016
2739ed7
Changelog update.
23Skidoo Mar 4, 2016
36c153c
Fix space leaks in dependency solver logging.
grayjay Nov 6, 2015
f78981a
Merge branch 'grayjay-backjumping-space-leak'
kosmikus Mar 4, 2016
a03b3da
Changelog update.
23Skidoo Mar 4, 2016
22dfa8f
Refactor 'Explore.backjumpInfo' after code review
grayjay Mar 4, 2016
ede1093
Update appveyor.yml
23Skidoo Mar 5, 2016
74561d4
Update appveyor.yml
23Skidoo Mar 5, 2016
0a29505
drop redundant constraint
hvr Mar 4, 2016
05c8f5c
Tweak regex to support GHC8's module-not-found error
hvr Mar 6, 2016
5d0c56e
(Try to) add GHC 8.0.1 to the test-matrix
hvr Feb 28, 2016
9d89cc7
update -prof Check message
gbaz Mar 8, 2016
94b727b
Don't call 'canonicalizePath' on a path we just removed.
23Skidoo Mar 9, 2016
1b9fd49
Don't use './Setup' for building 'cabal-install'.
23Skidoo Mar 10, 2016
cb855f3
Merge pull request #3218 from haskell/3197-travis-fix
23Skidoo Mar 10, 2016
06da20a
D.Text: export defaultStyle
ttuegel Mar 12, 2016
5097d82
D.S.Utils.topHandlerWith: wrap all error messages
ttuegel Mar 12, 2016
7763a55
D.S.Configure: improve ConfigStateFileError messages
ttuegel Mar 12, 2016
01fa2a2
Merge pull request #3225 from ttuegel/issue-3157-1.24
23Skidoo Mar 13, 2016
a82af44
Correct typos in the cli/config lenses
dcoutts Mar 11, 2016
7b280cd
Refactor withRepoContext so it can takes args separately
dcoutts Feb 16, 2016
2f743b6
New parse utils to help with subsections
dcoutts Feb 16, 2016
7907a55
Add new DistDirLayout module
dcoutts Feb 16, 2016
4365bcb
Add a couple glob utils
dcoutts Mar 13, 2016
d0fb249
Split FlagAssignment printer/parser out of UserConstraint ones
dcoutts Mar 13, 2016
324b324
New module for new style project configuration files
dcoutts Feb 16, 2016
e36c0e7
Add project config round trip QC tests
dcoutts Mar 13, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ env:
- GHCVER=7.6.3
- GHCVER=7.8.4
- GHCVER=7.10.3
- GHCVER=8.0.1
# TODO add PARSEC_BUNDLED=YES when it's so
- GHCVER=head

# Note: the distinction between `before_install` and `install` is not important.
before_install:
- travis_retry sudo add-apt-repository -y ppa:hvr/ghc
- travis_retry sudo apt-get update
- travis_retry sudo apt-get install cabal-install-1.22 ghc-$GHCVER-prof ghc-$GHCVER-dyn happy
- export PATH=$HOME/.cabal/bin:/opt/ghc/$GHCVER/bin:/opt/cabal/1.22/bin:$PATH
- travis_retry sudo apt-get install cabal-install-1.24 ghc-$GHCVER-prof ghc-$GHCVER-dyn happy
- export PATH=$HOME/.cabal/bin:/opt/ghc/$GHCVER/bin:/opt/cabal/1.24/bin:$PATH
- git version

install:
Expand Down Expand Up @@ -68,15 +69,12 @@ script:
- cd ../cabal-install
- ../Cabal/misc/gen-extra-source-files.sh cabal-install.cabal
- ../Cabal/misc/travis-diff-files.sh
- mkdir -p ./dist/setup
- cp Setup.hs ./dist/setup/setup.hs
- ghc --make -odir ./dist/setup -hidir ./dist/setup -i -i. ./dist/setup/setup.hs -o ./dist/setup/setup -Wall -Werror -threaded # the command cabal-install would use to build setup

- cabal install --only-dependencies --enable-tests --enable-benchmarks
- ./dist/setup/setup configure --user --ghc-option=-Werror --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging
- ./dist/setup/setup build
- ./dist/setup/setup haddock # see https://github.com/haskell/cabal/issues/2198
- ./dist/setup/setup test --show-details=streaming --test-option=--hide-successes
- cabal configure --user --ghc-option=-Werror --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging
- cabal build
- cabal haddock # see https://github.com/haskell/cabal/issues/2198
- cabal test --show-details=streaming --test-option=--hide-successes
- cabal check
- cabal sdist
- install_from_tarball
Expand Down
2 changes: 1 addition & 1 deletion Cabal/Cabal.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Cabal
version: 1.23.2.0
version: 1.24.0.0
copyright: 2003-2006, Isaac Jones
2005-2011, Duncan Coutts
license: BSD3
Expand Down
103 changes: 102 additions & 1 deletion Cabal/Distribution/Compat/Semigroup.hs
Original file line number Diff line number Diff line change
@@ -1,20 +1,39 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE TypeOperators #-}

-- | Compatibility layer for "Data.Semigroup"
module Distribution.Compat.Semigroup
( Semigroup((<>))
, Mon.Monoid(..)
, All(..)
, Any(..)

, Last'(..)

, gmappend
, gmempty
) where

import Distribution.Compat.Binary (Binary)

import Control.Applicative as App
import GHC.Generics
#if __GLASGOW_HASKELL__ >= 711
-- Data.Semigroup is available since GHC 8.0/base-4.9
import Data.Semigroup
import qualified Data.Monoid as Mon
#else
-- provide internal simplified non-exposed class for older GHCs
import Data.Monoid as Mon (Monoid(..), All(..), Any(..), Dual(..))
-- containers
import Data.Set (Set)
import Data.IntSet (IntSet)
import Data.Map (Map)
import Data.IntMap (IntMap)


class Semigroup a where
(<>) :: a -> a -> a
Expand Down Expand Up @@ -67,4 +86,86 @@ instance (Semigroup a, Semigroup b, Semigroup c, Semigroup d, Semigroup e)
=> Semigroup (a, b, c, d, e) where
(a,b,c,d,e) <> (a',b',c',d',e') = (a<>a',b<>b',c<>c',d<>d',e<>e')

-- containers instances
instance Semigroup IntSet where
(<>) = mappend

instance Ord a => Semigroup (Set a) where
(<>) = mappend

instance Semigroup (IntMap v) where
(<>) = mappend

instance Ord k => Semigroup (Map k v) where
(<>) = mappend
#endif

-- | Cabal's own 'Data.Monoid.Last' copy to avoid requiring an orphan
-- 'Binary' instance.
--
-- Once the oldest `binary` version we support provides a 'Binary'
-- instance for 'Data.Monoid.Last' we can remove this one here.
--
-- NB: 'Data.Semigroup.Last' is defined differently and not a 'Monoid'
newtype Last' a = Last' { getLast' :: Maybe a }
deriving (Eq, Ord, Read, Show, Binary,
Functor, App.Applicative, Generic)

instance Semigroup (Last' a) where
x <> Last' Nothing = x
_ <> x = x

instance Monoid (Last' a) where
mempty = Last' Nothing
mappend = (<>)

-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- Stolen from Edward Kmett's BSD3-licensed `semigroups` package

-- | Generically generate a 'Semigroup' ('<>') operation for any type
-- implementing 'Generic'. This operation will append two values
-- by point-wise appending their component fields. It is only defined
-- for product types.
--
-- @
-- 'gmappend' a ('gmappend' b c) = 'gmappend' ('gmappend' a b) c
-- @
gmappend :: (Generic a, GSemigroup (Rep a)) => a -> a -> a
gmappend x y = to (gmappend' (from x) (from y))

class GSemigroup f where
gmappend' :: f p -> f p -> f p

instance Semigroup a => GSemigroup (K1 i a) where
gmappend' (K1 x) (K1 y) = K1 (x <> y)

instance GSemigroup f => GSemigroup (M1 i c f) where
gmappend' (M1 x) (M1 y) = M1 (gmappend' x y)

instance (GSemigroup f, GSemigroup g) => GSemigroup (f :*: g) where
gmappend' (x1 :*: x2) (y1 :*: y2) = gmappend' x1 y1 :*: gmappend' x2 y2

-- | Generically generate a 'Monoid' 'mempty' for any product-like type
-- implementing 'Generic'.
--
-- It is only defined for product types.
--
-- @
-- 'gmappend' 'gmempty' a = a = 'gmappend' a 'gmempty'
-- @

gmempty :: (Generic a, GMonoid (Rep a)) => a
gmempty = to gmempty'

class GSemigroup f => GMonoid f where
gmempty' :: f p

instance (Semigroup a, Monoid a) => GMonoid (K1 i a) where
gmempty' = K1 mempty

instance GMonoid f => GMonoid (M1 i c f) where
gmempty' = M1 gmempty'

instance (GMonoid f, GMonoid g) => GMonoid (f :*: g) where
gmempty' = gmempty' :*: gmempty'
2 changes: 1 addition & 1 deletion Cabal/Distribution/InstalledPackageInfo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ installedComponentId ipi = case installedUnitId ipi of
SimpleUnitId cid -> cid

{-# DEPRECATED installedPackageId "Use installedUnitId instead" #-}
-- | Backwards compatibility with pre-Cabal 1.23.
-- | Backwards compatibility with Cabal pre-1.24.
installedPackageId :: InstalledPackageInfo -> UnitId
installedPackageId = installedUnitId

Expand Down
2 changes: 1 addition & 1 deletion Cabal/Distribution/Package.hs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ class Package pkg => HasUnitId pkg where
installedUnitId :: pkg -> UnitId

{-# DEPRECATED installedPackageId "Use installedUnitId instead" #-}
-- | Compatibility wrapper for pre-Cabal 1.23.
-- | Compatibility wrapper for Cabal pre-1.24.
installedPackageId :: HasUnitId pkg => pkg -> UnitId
installedPackageId = installedUnitId

Expand Down
17 changes: 5 additions & 12 deletions Cabal/Distribution/PackageDescription.hs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ module Distribution.PackageDescription (

import Distribution.Compat.Binary
import qualified Distribution.Compat.Semigroup as Semi ((<>))
import Distribution.Compat.Semigroup as Semi (Monoid(..), Semigroup)
import Distribution.Compat.Semigroup as Semi (Monoid(..), Semigroup, gmempty, gmappend)
import qualified Distribution.Compat.ReadP as Parse
import Distribution.Compat.ReadP ((<++))
import Distribution.Package
Expand Down Expand Up @@ -314,15 +314,12 @@ data SetupBuildInfo = SetupBuildInfo {

instance Binary SetupBuildInfo

instance Monoid SetupBuildInfo where
mempty = SetupBuildInfo {
setupDepends = Semi.mempty
}
instance Semi.Monoid SetupBuildInfo where
mempty = gmempty
mappend = (Semi.<>)

instance Semigroup SetupBuildInfo where
a <> b = SetupBuildInfo { setupDepends = combine setupDepends }
where combine field = field a `mappend` field b
(<>) = gmappend

-- ---------------------------------------------------------------------------
-- Module renaming
Expand Down Expand Up @@ -498,11 +495,7 @@ data Executable = Executable {
instance Binary Executable

instance Monoid Executable where
mempty = Executable {
exeName = mempty,
modulePath = mempty,
buildInfo = mempty
}
mempty = gmempty
mappend = (Semi.<>)

instance Semigroup Executable where
Expand Down
4 changes: 2 additions & 2 deletions Cabal/Distribution/PackageDescription/Check.hs
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ checkGhcOptions pkg =
PackageBuildWarning $
"'ghc-options: -prof' is not necessary and will lead to problems "
++ "when used on a library. Use the configure flag "
++ "--enable-library-profiling and/or --enable-executable-profiling."
++ "--enable-library-profiling and/or --enable-profiling."

, checkFlags ["-o"] $
PackageBuildWarning $
Expand Down Expand Up @@ -1052,7 +1052,7 @@ checkCabalVersion pkg =
, check (specVersion pkg < Version [1,23] []
&& isNothing (setupBuildInfo pkg)
&& buildType pkg == Just Custom) $
PackageDistSuspicious $
PackageDistSuspiciousWarn $
"From version 1.23 cabal supports specifiying explicit dependencies "
++ "for Custom setup scripts. Consider using cabal-version >= 1.23 and "
++ "adding a 'custom-setup' section with a 'setup-depends' field "
Expand Down
4 changes: 2 additions & 2 deletions Cabal/Distribution/Simple.hs
Original file line number Diff line number Diff line change
Expand Up @@ -453,9 +453,9 @@ getBuildConfig hooks verbosity distPref = do
-- Since the list of unconfigured programs is not serialized,
-- restore it to the same value as normally used at the beginning
-- of a configure run:
configPrograms = restoreProgramConfiguration
configPrograms_ = restoreProgramConfiguration
(builtinPrograms ++ hookedPrograms hooks)
(configPrograms cFlags),
`fmap` configPrograms_ cFlags,

-- Use the current, not saved verbosity level:
configVerbosity = Flag verbosity
Expand Down
58 changes: 31 additions & 27 deletions Cabal/Distribution/Simple/Configure.hs
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ import qualified System.Info
import System.IO
( hPutStrLn, hClose )
import Distribution.Text
( Text(disp), display, simpleParse )
( Text(disp), defaultStyle, display, simpleParse )
import Text.PrettyPrint
( render, (<>), ($+$), char, text, comma
, quotes, punctuate, nest, sep, hsep )
( Doc, (<>), (<+>), ($+$), char, comma, empty, hsep, nest
, punctuate, quotes, render, renderStyle, sep, text )
import Distribution.Compat.Environment ( lookupEnv )
import Distribution.Compat.Exception ( catchExit, catchIO )

Expand All @@ -136,31 +136,35 @@ data ConfigStateFileError
(Either ConfigStateFileError LocalBuildInfo) -- ^ Mismatched version.
deriving (Typeable)

-- | Format a 'ConfigStateFileError' as a user-facing error message.
dispConfigStateFileError :: ConfigStateFileError -> Doc
dispConfigStateFileError ConfigStateFileNoHeader =
text "Saved package config file header is missing."
<+> text "Re-run the 'configure' command."
dispConfigStateFileError ConfigStateFileBadHeader =
text "Saved package config file header is corrupt."
<+> text "Re-run the 'configure' command."
dispConfigStateFileError ConfigStateFileNoParse =
text "Saved package config file is corrupt."
<+> text "Re-run the 'configure' command."
dispConfigStateFileError ConfigStateFileMissing =
text "Run the 'configure' command first."
dispConfigStateFileError (ConfigStateFileBadVersion oldCabal oldCompiler _) =
text "Saved package config file is outdated:"
$+$ badCabal $+$ badCompiler
$+$ text "Re-run the 'configure' command."
where
badCabal =
text "• the Cabal version changed from"
<+> disp oldCabal <+> "to" <+> disp currentCabalId
badCompiler
| oldCompiler == currentCompilerId = empty
| otherwise =
text "• the compiler changed from"
<+> disp oldCompiler <+> "to" <+> disp currentCompilerId

instance Show ConfigStateFileError where
show ConfigStateFileNoHeader =
"Saved package config file header is missing. "
++ "Try re-running the 'configure' command."
show ConfigStateFileBadHeader =
"Saved package config file header is corrupt. "
++ "Try re-running the 'configure' command."
show ConfigStateFileNoParse =
"Saved package config file body is corrupt. "
++ "Try re-running the 'configure' command."
show ConfigStateFileMissing = "Run the 'configure' command first."
show (ConfigStateFileBadVersion oldCabal oldCompiler _) =
"You need to re-run the 'configure' command. "
++ "The version of Cabal being used has changed (was "
++ display oldCabal ++ ", now "
++ display currentCabalId ++ ")."
++ badCompiler
where
badCompiler
| oldCompiler == currentCompilerId = ""
| otherwise =
" Additionally the compiler is different (was "
++ display oldCompiler ++ ", now "
++ display currentCompilerId
++ ") which is probably the cause of the problem."
show = renderStyle defaultStyle . dispConfigStateFileError

instance Exception ConfigStateFileError

Expand Down
Loading