In a virtual workspace the root `Cargo.toml` is not a package, so the cache key hashed only the
members' manifests and left out the root's `[profile]`, `[patch]` and `[workspace.dependencies]`
(#268). Editing one of those, such as a `[profile.dev]` opt-level, kept the same key: every run
restored the stale cache as an exact hit, rebuilt what the edit invalidated, and saved nothing, so
the rebuild repeated on every run until something else changed the key.
This change hashes the root manifest of the workspace `cargo metadata` reports, along with its
members' manifests. It ignores `workspace.package.version` and the paths and versions of path
dependencies in `[workspace.dependencies]`, as it already does for members, so a release version
bump still keeps the key. It also reads `Cargo.lock` from that root, so a `workspaces` entry that
points at a member directory now hashes the lockfile that builds it. A workspace whose root is a
package keeps its key, and a virtual workspace gets a new one once.
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.