The values for the dependencies could be strings intead of objects, so
add a `try` block to take care of that.
Also set `dep.path` to `""` if the dependency contains a key `path` to
make sure that the cache isn't invalidated due to change in workspace.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This simple mistake caused the entire `Cargo.lock` to be ignored (JS
treats having no return as `false`).
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
There are a few problems in cargo-binstall where sometimes change to
`Cargo.lock` does not invalidate the cache.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
- Silence errors and do not create error annotations, fixes#144
- Implement cleanup for new sparse registry
- Do not clean `-sys` dependencies from `registry/src`, hopefully fixes #150
Fixed#151
I've tried running manually load and parse `Cargo.lock` and it runs fine
until `sort_object` is called.
Since `Cargo.lock` is auto-generated and usually sorted, I think there
is no need for sorting.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Also:
- Add and use `sort_and_uniq` to make sure `globFile` resulting
and `keyFiles` does not contain duplicates.
- Only returns regular file in function `globFile`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Fixed#146
- Set all `package.version` in `Cargo.toml` to `0.0.0`
- Set `{build-, dev-, }dependencies` of workspace crates to `0.0.0`
- Remove workspace crates from `Cargo.lock` before caching
- Sort all toml objects before hashing them as json
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Ensure consistency of main and post configuration by storing and
restoring it from state, which in turn ensures cache key stability.
Also:
* Fixed some typos.
* Use core.error for logging errors.
* Fix inverted condition on cache-all-crates.
Reverts: #138Fixes#140
Add cache-all-crates option which allows all crates to be cached instead
of just the dependency crates. This is useful when additional crates are
required for CI tooling.
Add the installed packages to the environment element of the cache key
so that CI tooling is considered. This ensures that rust CI tooling is
cached correctly when changes occur. Prior to this a manual key change
or cache expiry would need to occur before CI tools were correctly
cached.