Skip to content

Commit e236017

Browse files
authored
Merge pull request #3536 from commercialhaskell/3533-extra-deps-solver
Ensure solver does not put local packages in extra-deps #3533
2 parents 2d97213 + 7037981 commit e236017

File tree

8 files changed

+57
-0
lines changed

8 files changed

+57
-0
lines changed

src/Stack/Solver.hs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,15 @@ solveResolverSpec stackYaml cabalDirs
421421
-- returned versions or flags different from the snapshot.
422422
inSnapChanged = Map.differenceWith diffConstraints
423423
inSnap snapConstraints
424+
425+
-- If a package appears in both the
426+
-- snapshot and locally, we don't want to
427+
-- include it in extra-deps. This makes
428+
-- sure we filter out such packages. See:
429+
-- https://github.com/commercialhaskell/stack/issues/3533
430+
431+
`Map.difference` srcConstraints
432+
424433
-- Packages neither in snapshot, nor srcs
425434
extra = Map.difference deps (Map.union srcConstraints
426435
snapConstraints)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import StackTest
2+
import System.Directory
3+
4+
main :: IO ()
5+
main = do
6+
copyFile "orig-stack.yaml" "stack.yaml"
7+
stack ["--resolver", "lts-9.11", "solver", "--update-config"]
8+
stack ["build"]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.stack-work/
2+
*.cabal
3+
stack.yaml
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: mmorph
2+
version: 1.2.0
3+
4+
dependencies:
5+
- base
6+
- acme-missiles
7+
8+
library:
9+
source-dirs:
10+
- src
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module Lib
2+
( someFunc
3+
) where
4+
5+
someFunc :: IO ()
6+
someFunc = putStrLn "someFunc"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
resolver: lts-9.11
2+
3+
packages:
4+
- ./local-mmorph
5+
- ./uses-mmorph
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: uses-mmorph
2+
version: 1.2.0
3+
4+
dependencies:
5+
- base
6+
- mmorph >= 1.1
7+
8+
library:
9+
source-dirs:
10+
- src
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module Lib
2+
( someFunc
3+
) where
4+
5+
someFunc :: IO ()
6+
someFunc = putStrLn "someFunc"

0 commit comments

Comments
 (0)