Skip to content

Commit

Permalink
Allow the solver to treat executable components as optional
Browse files Browse the repository at this point in the history
This emulates haskell/cabal#4660 more or less
  • Loading branch information
hvr committed Aug 3, 2017
1 parent ea04c94 commit 021d3a9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
31 changes: 21 additions & 10 deletions cabal-plan.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ tested-with:
GHC==7.8.4,
GHC==7.6.3

flag exe
-- this automatic flag allows the cabal solver to disable the exe:cabal-plan component (& its build-deps);
-- IOW, emulate https://github.com/haskell/cabal/issues/4660
description: Enable @exe:cabal-plan@ component

library
default-language: Haskell2010
other-extensions: OverloadedStrings
Expand Down Expand Up @@ -53,20 +58,26 @@ executable cabal-plan

main-is: src-exe/cabal-plan.hs

-- dependencies w/ inherited version ranges via 'cabal-plan' library
build-depends: cabal-plan
, base
, text
, containers
, bytestring
if flag(exe)
-- dependencies w/ inherited version ranges via 'cabal-plan' library
build-depends: cabal-plan
, base
, text
, containers
, bytestring

-- dependencies which require version bounds
build-depends: mtl >= 2.2.1 && < 2.3
, ansi-terminal >= 0.6.2 && < 0.7
, optparse-applicative >= 0.13.0 && < 0.15
-- dependencies which require version bounds
build-depends: mtl >= 2.2.1 && < 2.3
, ansi-terminal >= 0.6.2 && < 0.7
, optparse-applicative >= 0.13.0 && < 0.15
else
buildable: False

ghc-options: -Wall

benchmark foo
main-is: src-exe/cabal-plan.hs
type: exitcode-stdio-1.0

source-repository head
type: git
Expand Down
3 changes: 3 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
packages: .

package cabal-plan
flags: +exe

0 comments on commit 021d3a9

Please sign in to comment.