Currently stack build will emit warnings if I do not specify size and sha256 for github dependencies in stack.yaml.
Running stack freeze will output the relevant information that I then can add to stack.yaml manually.
I propose to write the information that is currently produced by stack freeze to a .lock file after every successful build (e.g. pantry.lock):
- when the
.lock file exists then for each listed dependency:
stack uses the information as if it were directly listed in stack.yaml; specifically it errors out on any hash mismatches
- when
stack detects that a dependency was updated in stack.yaml it silently ignores the information from the .lock file
- after a successful build
stack creates the .lock file, overwriting any existing versions (which in effect means that we remove unused entries and add missing entries)
Regarding revision control, we can follow conventions that have been developed elsewhere:
When developing an application, the .lock file should be checked into revision control. When developing a library, the .lock file should be added to .gitignore.
A word on naming: If we expect the .lock file to be specific to stack we may want to name it stack.lock (or possibly .stack.lock to not interfere with file name completion); if on the other hand we think that it will be relevant for other build tools that implement support for pantry then we could name it pantry.lock.
Assuming we adopt this approach we can:
- remove any warnings related to pantry hashes
- remove the
stack freeze command
CC @snoyberg
Currently
stack buildwill emit warnings if I do not specifysizeandsha256forgithubdependencies instack.yaml.Running
stack freezewill output the relevant information that I then can add tostack.yamlmanually.I propose to write the information that is currently produced by
stack freezeto a.lockfile after every successful build (e.g.pantry.lock):.lockfile exists then for each listed dependency:stackuses the information as if it were directly listed instack.yaml; specifically it errors out on any hash mismatchesstackdetects that a dependency was updated instack.yamlit silently ignores the information from the.lockfilestackcreates the.lockfile, overwriting any existing versions (which in effect means that we remove unused entries and add missing entries)Regarding revision control, we can follow conventions that have been developed elsewhere:
When developing an application, the
.lockfile should be checked into revision control. When developing a library, the.lockfile should be added to.gitignore.A word on naming: If we expect the
.lockfile to be specific tostackwe may want to name itstack.lock(or possibly.stack.lockto not interfere with file name completion); if on the other hand we think that it will be relevant for other build tools that implement support forpantrythen we could name itpantry.lock.Assuming we adopt this approach we can:
stack freezecommandCC @snoyberg