I am using Haskell Stack, and the source code for the package I am building is on git. My stack.yaml
looks like this:
packages:
- location:
git: git@github.com:mhwombat/blah-blah-blah.git
commit: master
. . .
Everything builds fine. However, suppose the source code is updated in the repository. Stack doesn't fetch the latest version; it continues to use the version it already has. My solution so far is to delete .stack-work
and do another stack build
, but of course it has to rebuild everything. When you're using lens, that takes a loooong time.
Is there a way to force Stack to fetch the latest version from git?
Already tried stack update
and stack clean
, but they don't solve this problem.
There's one way, but it is tedious instead of master as the commit, place the SHA1 of the latest commit. You can get the latest commit by running:
git rev-parse origin/master
The output should look like this: de7059a7a7c81c9c8997cad6dce7cdbd5b6c09d9
Then in your stack.yaml you would place this:
packages:
- location:
git: git@github.com:mhwombat/blah-blah-blah.git
commit: de7059a7a7c81c9c8997cad6dce7cdbd5b6c09d9
. . .
And you would have " forced " stack to fetch the latest commit when you run stack build
no need to delete .stack-work
anymore. It's not as simple as a single command but it worked for me and was not too annoying, as a bonus for me it helped me freeze a dependency. This is scriptable since it only uses git, though it wasn't tiresome enough that I made a script.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.