You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
stack will recompile packages when the root of a project is moved. This hinders use cases where, in a CI system, a big project is recompiled each time in a different directory, but one would still like to cache the .stack-work directory to speed-up builds.
A possible solution is to use relative rather than absolute paths for directories that are at the same level or below the stack.yaml file. Keep paths that are specified as absolute in the stack.yaml file as absolute, and ditto for relative paths.
Steps to reproduce
Go into any stack project, remove .stack-work directory.
Run command stack build
Stuff happens.
Run command stack build again.
Nothing happens, because all the work has been done already.
Go to parent directory. Rename the directory containing the stack project to something else.
Go back into the stack project.
Run stack buildagain.
Expected
Nothing happens, because there is no more work to do.
Actual
<project-name>-<project-version>: unregistering (switching from <old-dir-name> to <new-dir-name>)
Afterwards the entire project is recompiled.
Stack version
$ stack --version
Version 1.5.1 x86_64
Installed via stack upgrade.
The text was updated successfully, but these errors were encountered:
I understand the desire to be able to do this. Unfortunately it is not feasible for a couple reasons:
Cabal generates a Paths_* module for each package which includes absolute paths to the install location. This kinda sucks, but it's how things work currently. See this issue about making packages relocatable - Support relocatable packages haskell/cabal#462
In Local version of package is not rebuild / removed #2147 , there's an issue where changing package location is included in the project doesn't cause rebuild. This is because each package got built and so is considered to be not dirty. Fix for now is to pay attention to if the path changed.
It would take quite a bit of upstream and stack work to make this happen.
This hinders use cases where, in a CI system, a big project is recompiled each time in a different directory, but one would still like to cache the .stack-work directory to speed-up builds.
Why is this happening? I don't get it, why would you recompile it with different directoreis? You should be able to cache .stack-work directories. Note that you will also probably want to cache the ones that are relative to the package dirs themselves.
stack
will recompile packages when the root of a project is moved. This hinders use cases where, in a CI system, a big project is recompiled each time in a different directory, but one would still like to cache the.stack-work
directory to speed-up builds.A possible solution is to use relative rather than absolute paths for directories that are at the same level or below the
stack.yaml
file. Keep paths that are specified as absolute in thestack.yaml
file as absolute, and ditto for relative paths.Steps to reproduce
.stack-work
directory.stack build
stack build
again.stack build
again.Expected
Nothing happens, because there is no more work to do.
Actual
Afterwards the entire project is recompiled.
Stack version
Installed via
stack upgrade
.The text was updated successfully, but these errors were encountered: