Automatically run "pkg sync" when running "inko build", but only if the list of dependencies has changed
yorickpeterse opened this issue · comments
Description
Users currently need to manually run inko pkg sync
when updating the list of dependencies, before running inko build
. It's too easy to forget this, so we should run this automatically when necessary.
To implement this, we need to do to the following:
- We maintain a file called
./dep/hash
, which contains a blake2 hash (similar to the other places where we currently do this in the compiler) of the contents ofinko.pkg
. - When running
inko build
, we hashinko.pkg
and compare the hash to./dep/hash
. If the hash differs or./dep/hash
doesn't exist, we runinko pkg sync
first. If the hashes are the same, we just build as usual. - If
inko.pkg
doesn't exist, we don't do anything
For this to work, the logic of inko pkg sync
needs to be extracted into a separate file such that we can use it for both the inko build
and inko pkg sync
commands. We should not run a shell command to sync the packages.
The inko pkg sync
command continues to exist, and remains useful when one wants to sync the packages ahead of time (e.g. when they're going offline, such as on a long flight), but users won't need to use it explicitly most of the time.
Related work
No response