inko-lang / inko

A language for building concurrent software with confidence

Home Page:http://inko-lang.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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:

  1. 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 of inko.pkg.
  2. When running inko build, we hash inko.pkg and compare the hash to ./dep/hash. If the hash differs or ./dep/hash doesn't exist, we run inko pkg sync first. If the hashes are the same, we just build as usual.
  3. 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