Skip to content

Commit d06c48f

Browse files
committed
cabal-version: >=1.7.0
With cabal versions prior to 1.7.1 the build-depends of any executable stanzas are included in the build depends which are registered with ghc-pkg. Cabal's resolver therefore has a complete set of build-depends when it selects the installed version of foo. `./test.sh` does not exhibit the bug described in haskell/cabal#1896.
0 parents  commit d06c48f

File tree

9 files changed

+93
-0
lines changed

9 files changed

+93
-0
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.cabal-sandbox/
2+
.hpc/
3+
cabal.sandbox.config
4+
dist/
5+
tests.tix
6+
bar/freeze.after
7+
bar/freeze.before

bar/Setup.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import Distribution.Simple
2+
main = defaultMain

bar/bar.cabal

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: bar
2+
version: 0.0.0.1
3+
cabal-version: >=1.4
4+
build-type: Simple
5+
license: MIT
6+
7+
library
8+
build-depends:
9+
base -any,
10+
foo ==0.0.0.1
11+

bar/test.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
set -x
4+
set -e
5+
6+
cabal sandbox delete
7+
cabal clean
8+
cabal sandbox init
9+
cabal sandbox add-source ../foo
10+
11+
cabal freeze --dry-run > freeze.before
12+
13+
cabal install --only-dependencies
14+
15+
cabal freeze --dry-run > freeze.after
16+
17+
diff -u freeze.before freeze.after

foo/LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2014 Ben Armston <[email protected]>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.
22+

foo/Main.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module Main where
2+
3+
main :: IO ()
4+
main = putStrLn "foo"

foo/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Cabal packages demonstrating cabal issue 1896
2+
3+
This repository demonstrates the bug at https://github.com/haskell/cabal/issues/1896
4+
5+
There are three tags of interest `cabal-1.7.0`, `cabal-1.7.1` and `no-lib`.
6+
The commit message for each along with the discussion on the above ticket
7+
explain what they are and what they do.
8+
9+
The bug can be exercised by running `test.sh`. Note only `cabal-1.7.1` will
10+
exercise the bug.

foo/Setup.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import Distribution.Simple
2+
main = defaultMain

foo/foo.cabal

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: foo
2+
version: 0.0.0.1
3+
cabal-version: >=1.7.0
4+
build-type: Simple
5+
license: MIT
6+
synopsis: Has both libarary and executable stanzas both of which have dependencies.
7+
8+
library
9+
build-depends:
10+
base >=4.4 && <5
11+
hs-source-dirs: src
12+
13+
executable foo
14+
build-depends:
15+
base >=4 && <5,
16+
old-time >=1.0 && <1.2
17+
main-is: Main.hs
18+

0 commit comments

Comments
 (0)