{"action":"created","issue":{"url":"https://api.github.com/repos/commercialhaskell/stack/issues/855","labels_url":"https://api.github.com/repos/commercialhaskell/stack/issues/855/labels{/name}","comments_url":"https://api.github.com/repos/commercialhaskell/stack/issues/855/comments","events_url":"https://api.github.com/repos/commercialhaskell/stack/issues/855/events","html_url":"https://github.com/commercialhaskell/stack/issues/855","id":103241877,"number":855,"title":"Rebuild cache problems with multiple projects depending on a shared one","user":{"login":"k-bx","id":107968,"avatar_url":"https://avatars.githubusercontent.com/u/107968?v=3","gravatar_id":"","url":"https://api.github.com/users/k-bx","html_url":"https://github.com/k-bx","followers_url":"https://api.github.com/users/k-bx/followers","following_url":"https://api.github.com/users/k-bx/following{/other_user}","gists_url":"https://api.github.com/users/k-bx/gists{/gist_id}","starred_url":"https://api.github.com/users/k-bx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/k-bx/subscriptions","organizations_url":"https://api.github.com/users/k-bx/orgs","repos_url":"https://api.github.com/users/k-bx/repos","events_url":"https://api.github.com/users/k-bx/events{/privacy}","received_events_url":"https://api.github.com/users/k-bx/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-08-26T11:23:52Z","updated_at":"2015-08-31T11:39:14Z","closed_at":null,"body":"There is an unfortunate caching issue I'm hitting on our production projects with stack.\r\n\r\nImagine having this structure:\r\n```\r\n➜  stack-cache-bug  tree -L 2 .\r\n.\r\n├── proj-shared\r\n│   ├── ...\r\n│   └── stack.yaml\r\n├── proj1\r\n│   ├── ...\r\n│   └── stack.yaml\r\n└── proj2\r\n    ├── ...\r\n    └── stack.yaml\r\n```\r\n\r\n`proj1` and `proj2` both depend on `proj-shared`, so their `stack.yaml` look like this:\r\n\r\n```\r\n➜  stack-cache-bug  cat proj1/stack.yaml\r\nflags: {}\r\npackages:\r\n- '.'\r\n- '../proj-shared'\r\nextra-deps: []\r\nresolver: lts-2.16\r\n```\r\n\r\nNow, you build `proj1` and `proj2`, they build just fine. Then, you introduce some new symbol (or a change) in `proj-shared`, and you rebuild `proj1`. Stack notices the change, rebuilds `proj-shared` and `proj1`.\r\n\r\nThen, you also use that new symbol in `proj2`, rebuild it (`stack build` inside `proj2` dir), and... you get a type-error:\r\n\r\n```\r\n➜  proj2  stack build\r\nproj2-0.1.0.0-94fd113381d8ff555d333eae46ae6dac: unregistering (local file changes)\r\nproj2-0.1.0.0: configure\r\nproj2-0.1.0.0: build\r\n\r\n--  While building package proj2-0.1.0.0 using:\r\n      /Users/kb/.stack/setup-exe-cache/setup-Simple-Cabal-1.18.1.5-x86_64-osx-ghc-7.8.4 --builddir=.stack-work/dist/x86_64-osx/Cabal-1.18.1.5/ build lib:proj2 exe:proj2-exe --ghc-options -hpcdir .stack-work/dist/x86_64-osx/Cabal-1.18.1.5/hpc/.hpc/ -ddump-hi -ddump-to-file\r\n    Process exited with code: ExitFailure 1\r\n    Logs have been written to: /Users/kb/workspace/stack-cache-bug/proj2/.stack-work/logs/proj2-0.1.0.0.log\r\n\r\n    Configuring proj2-0.1.0.0...\r\n    Preprocessing library proj2-0.1.0.0...\r\n    In-place registering proj2-0.1.0.0...\r\n    Preprocessing executable 'proj2-exe' for proj2-0.1.0.0...\r\n    [1 of 1] Compiling Main             ( app/Main.hs, .stack-work/dist/x86_64-osx/Cabal-1.18.1.5/build/proj2-exe/proj2-exe-tmp/Main.o )\r\n\r\n    app/Main.hs:8:19:\r\n        Not in scope: data constructor ‘SomeNewType2’\r\n        Perhaps you meant ‘SomeNewType’ (imported from LibShared)\r\n```\r\n\r\nIt doesn't see that `proj-shared` changed.\r\n\r\nThe worst is that I don't know any better way of invalidating cache than `stack clean`, because after `stack clean` my `stack build` will have to reinstall all local-database packages (the ones which are not in lts), which takes quite some time."},"comment":{"url":"https://api.github.com/repos/commercialhaskell/stack/issues/comments/136344652","html_url":"https://github.com/commercialhaskell/stack/issues/855#issuecomment-136344652","issue_url":"https://api.github.com/repos/commercialhaskell/stack/issues/855","id":136344652,"user":{"login":"k-bx","id":107968,"avatar_url":"https://avatars.githubusercontent.com/u/107968?v=3","gravatar_id":"","url":"https://api.github.com/users/k-bx","html_url":"https://github.com/k-bx","followers_url":"https://api.github.com/users/k-bx/followers","following_url":"https://api.github.com/users/k-bx/following{/other_user}","gists_url":"https://api.github.com/users/k-bx/gists{/gist_id}","starred_url":"https://api.github.com/users/k-bx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/k-bx/subscriptions","organizations_url":"https://api.github.com/users/k-bx/orgs","repos_url":"https://api.github.com/users/k-bx/repos","events_url":"https://api.github.com/users/k-bx/events{/privacy}","received_events_url":"https://api.github.com/users/k-bx/received_events","type":"User","site_admin":false},"created_at":"2015-08-31T11:39:14Z","updated_at":"2015-08-31T11:39:14Z","body":"So, is this considered to be \"by design\"? To me this would seem very unfortunate, as:\r\n\r\n- this project structure looks quite natural. subfolders with different projects in repository's root, as opposed to putting dependencies in sub-folders. would one need to have multiple copies of shared projects? I don't have full understanding on how things should work properly in current scenario.\r\n- it worked with cabal-install, e.g. it was able to determine that add-source'd project changed\r\n"}}