This adds a package manager for Inko, creatively called "ipm" (Inko Package Manager).
The package manager doesn't use a centralised package registry, instead it relies entirely on Git repositories. These repositories can be hosted anywhere (GitHub, GitLab, locally, etc), as long as the URL is supported by the Git CLI. For GitHub and GitLab we also support URLs that leave out the scheme, in which case we translate them to HTTPS URLs.
Packages are specified in the file inko.pkg
, which must reside at the
root directory of a project. This file is a line based file and lists
the dependencies that are required. Such a file might look as follows:
require github.com/alice/json 1.2.3 abcdef123
require gitlab.com/inko-lang/foo 1.3.0 ffee465
Adding and removing entries is done using the commands ipm add
and
ipm remove respectively
. To install the dependencies into your
project, you run ipm sync
. The result is a ./dep directory containing
all your dependencies. The compiler automatically adds this directory to
the load path, if it exists. Updating dependencies is done using ipm update
.
The package manager uses minimal version selection, as this is trivial to implement, leads to predictable builds, doesn't require a SAT solver, and doesn't require lock files. We don't allow different major versions of the same package, as this can lead to subtle bugs when data is passed between these versions.
I opted to make package management a separate process/tool as this makes it easier to build packages without an internet connection, and because it's easier to maintain. Packages are installed in a local ./dep directory because this makes it easier for the compiler to load the dependencies, and makes packaging a project including all its dependencies trivial (= just archive the entire project and off you go).
In terms of features the package manager provides, it's quite basic. Most notably, we don't support overriding packages with local copies at this time, and error/progress reporting could be improved in various places. Testing is partially done by hand, as automatic testing of the various CLI components is a bit tricky due to heavy network usage. We may improve this in the future.
Changelog: added