3
0
Fork 0
mirror of https://github.com/Swatinem/rust-cache synced 2025-06-24 09:13:42 +00:00
Commit graph

72 commits

Author SHA1 Message Date
Filippo Neysofu Costa
67c46e7159
Support for trybuild and similar macro testing tools (#168)
Signed-off-by: Filippo Costa <filippo@neysofu.me>
2023-09-12 19:32:03 +02:00
Jiahao XU
ab6b2769d1
dep: Use smol-toml instead of toml (#164)
Fixed #162 #163

The former is listed on
https://github.com/toml-lang/toml/wiki#implementations and is toml 1.0
compliant.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-19 12:23:03 +02:00
Jiahao XU
c0e052c18c
Fix hashing of parsed Cargo.toml (#160)
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>
2023-08-12 12:34:30 +02:00
Jiahao XU
4e0f4b19dd
Fix typo in hashing parsed Cargo.lock (#159)
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>
2023-08-10 19:50:14 +02:00
Jiahao XU
b919e1427f
feat: Add logging to Cargo.lock/Cargo.toml hashing (#156)
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>
2023-08-04 12:39:02 +02:00
Arpad Borsos
80c47cc945
Clean up credentials.toml 2023-08-02 12:54:48 +02:00
Arpad Borsos
3312b3ab47
Slightly improve docs 2023-08-02 12:46:45 +02:00
Arpad Borsos
f6987ea139
Improve errors and cleanup
- 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
2023-08-02 12:15:14 +02:00
Jordan Oroshiba
b00faf5858
Add BuildJet Option (#154) 2023-08-01 09:01:11 +02:00
Jiahao XU
be7377e68e
fix src/config.ts: Remove sort_object (#152)
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>
2023-06-27 08:55:56 +02:00
Jiahao XU
715970feed
feat: Add hash of .cargo/config.toml to key (#149)
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>
2023-06-18 10:12:25 +02:00
Jiahao XU
3d4000164d
feat: Rm workspace crates version before caching (#147)
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>
2023-06-18 09:29:44 +02:00
Steven Hartland
bb80d0f127
chore: use 8 character hash components (#143)
Use 8 character hash components to reduce the key length, making it
more readable.

Fixes #97
2023-05-19 20:30:37 +02:00
Steven Hartland
ad97570a01
fix: cache key stability (#142)
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: #138
Fixes #140
2023-05-18 22:48:40 +02:00
Steven Hartland
def0926359
feat: add option to cache all crates (#137)
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.
2023-05-11 23:15:09 +02:00
Steven Hartland
827c240e23
fix: cache key dependency on installed packages (#138)
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.
2023-05-11 23:12:12 +02:00
Steven Hartland
5e9fae966f
fix: cache restore failures (#136)
Fix cache restore failures to to upstream bug.

Fixes #119
2023-05-11 09:01:27 +02:00
Felix Riegger
99229f978c
Fix EISDIR error due to globbed directories (#1) (#132) 2023-05-02 21:49:27 +02:00
Lucas Fernandes Nogueira
ecee04e7b3
feat: add save-if option, closes #66 (#91) 2022-11-06 19:15:00 +01:00
Arpad Borsos
e78327dd9e
small code style improvements, README and CHANGELOG updates 2022-11-06 09:50:33 +01:00
Lucas Fernandes Nogueira
ccdddcc049
only hash Cargo.toml/Cargo.lock that belong to a configured workspace (#90) 2022-11-05 21:18:04 +01:00
Arpad Borsos
3f2513fdf4
avoid calling cargo metadata on pre-cleanup 2022-11-03 11:26:22 +01:00
Mikhail Katychev
b8e72aae83
Added prefix-key cache-directories and cache-targets options (#85) 2022-10-18 23:05:42 +02:00
Arpad Borsos
0d72e5f9a0
revert explicit dir close 2022-09-04 13:22:47 +02:00
Arpad Borsos
be4be3720d
explicitly close dir handles, add more logging, cleanups 2022-09-04 13:10:36 +02:00
Arpad Borsos
622616010e
prepare v2 2022-07-16 12:38:38 +02:00
Arpad Borsos
0497f9301f
improve registry cleanpu 2022-07-09 19:20:02 +02:00
Arpad Borsos
7b8626742a
update registry cleaning 2022-07-09 18:51:34 +02:00
Arpad Borsos
911d8e9e55
test sparse registry 2022-07-09 17:49:43 +02:00
Arpad Borsos
07a2ee71bc
lol, dependency check was reversed 2022-07-09 17:37:48 +02:00
Arpad Borsos
86bae2494f
clean nested and arbitrary profile and target directories 2022-07-09 16:14:38 +02:00
Arpad Borsos
827b33fbd0
pretty printing and fix workspace package retrieval 2022-07-09 15:51:45 +02:00
Arpad Borsos
36af5cb1ae
fix pretty printing and selftest 2022-07-09 15:39:43 +02:00
Arpad Borsos
cb43a50800
fix env filtering 2022-07-09 15:31:33 +02:00
Arpad Borsos
11be10514b
fix pretty printing 2022-07-09 15:25:09 +02:00
Arpad Borsos
6ed4c28a7c
rewrite it all 2022-07-09 15:19:29 +02:00
Arpad Borsos
fc84c9d9a3
move selftests to subdirectory and run more selftests 2022-07-09 12:23:37 +02:00
Nick Mosher
260a713186
Cache multiple target directories from 'target-dir' 2022-07-09 11:58:11 +02:00
Dominik Nakamura
fa61956921
Include env vars in the generated cache key 2022-07-09 11:53:57 +02:00
Vlad-Shcherbina
5040f39404
Skip registry cleaning if no registry was found (#65)
This fixes #64.

When Cargo is run in sparse-registry mode, it doesn't create
  ~/.cargo/registry/index/github.com-1ecc6299db9ec823/
directory.
2022-06-26 10:51:36 +02:00
Vlad-Shcherbina
2055a01dcd
Improve diagnostics: show exception stack trace (#63)
Also add logging to the quiet exception handlers.
2022-06-25 23:20:01 +02:00
Arpad Borsos
74e8e24b6d
Update dependencies, clean both debug and release targets 2022-04-08 17:25:03 +02:00
Arpad Borsos
d127014599
update dependencies 2021-09-28 17:49:43 +02:00
Tom Parker-Shemilt
536c94f32c
Cache-on-failure support (#22) 2021-06-28 23:18:07 +02:00
Arpad Borsos
31c41a926e
Handle missing cargo installs gracefully
fixes #17
2021-05-30 10:55:21 +02:00
Arpad Borsos
3b8bbcb11d
add description 2021-05-19 10:10:43 +02:00
Rik Nauta
f82d41bcc2
feat: allow for configurable target-dir 2021-05-19 10:06:31 +02:00
Caleb Maclennan
da42bbe56d Additionally key on Rust toolchain file(s) if present 2021-03-15 14:07:46 +01:00
Arpad Borsos
b495963495 Add a selftest and support for .cargo/bin 2021-02-16 09:06:04 +01:00
Austin Jones
27793b3b80 Add support for the cache-hit output 2021-01-28 18:39:18 +01:00