-
Notifications
You must be signed in to change notification settings - Fork 848
Open
Description
Sorry, this is a weird one 🙂
Let's say you have 3 packages: a, b, and c. Both a and b depend on c. Furthermore, a and b are in separate Stack projects. Both specify c as a package in their project. This makes c a shared package between a and b.
If you build a, it will of course build c. Then make a change to c and build b, which will re-build c. Finally re-build a. I would expect that to re-build (or at least re-link) c but instead it does nothing. This means that b has the new c but a has the old c.
Here's exactly how to reproduce:
mkdir c
echo '{ name: c, library: { dependencies: base, exposed-modules: C } }' > c/package.yaml
echo 'module C where c = 1' > c/C.hs
mkdir a
echo '{ resolver: lts-8.11, packages: [., ../c] }' > a/stack.yaml
echo '{ name: a, executables: { a: { dependencies: [base, c], main: a.hs } } }' > a/package.yaml
echo 'import C; main = print c' > a/a.hs
mkdir b
echo '{ resolver: lts-8.11, packages: [., ../c] }' > b/stack.yaml
echo '{ name: b, executables: { b: { dependencies: [base, c], main: b.hs } } }' > b/package.yaml
echo 'import C; main = print c' > b/b.hs
cd a
stack build
stack exec a
# => 1
cd ..
echo 'module C where c = 2' > c/C.hs
cd b
stack build
stack exec b
# => 2
cd ..
cd a
stack build
stack exec a
# => 1
# Should be `2`!jdreaver, RichardWarfield and thomasjm