File tree Expand file tree Collapse file tree 4 files changed +28
-0
lines changed Expand file tree Collapse file tree 4 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ This cache is automatically keyed by:
95
95
- the value of some compiler-specific environment variables (eg. RUSTFLAGS, etc), and
96
96
- a hash of all `Cargo.lock` / `Cargo.toml` files found anywhere in the repository (if present).
97
97
- a hash of all `rust-toolchain` / `rust-toolchain.toml` files in the root of the repository (if present).
98
+ - a hash of installed packages as generated by `cargo install --list`.
98
99
99
100
An additional input `key` can be provided if the builtin keys are not sufficient.
100
101
Original file line number Diff line number Diff line change @@ -60055,6 +60055,9 @@ class CacheConfig {
60055
60055
}
60056
60056
}
60057
60057
self.keyEnvs = keyEnvs;
60058
+ // Installed packages and their versions are also considered for the key.
60059
+ const packages = await getPackages();
60060
+ hasher.update(packages);
60058
60061
key += `-${hasher.digest("hex")}`;
60059
60062
self.restoreKey = key;
60060
60063
// Construct the lockfiles portion of the key:
@@ -60146,6 +60149,11 @@ async function getRustVersion() {
60146
60149
.filter((s) => s.length === 2);
60147
60150
return Object.fromEntries(splits);
60148
60151
}
60152
+ async function getPackages() {
60153
+ let stdout = await getCmdOutput("cargo", ["install", "--list"]);
60154
+ // Make OS independent.
60155
+ return stdout.split(/[\n\r]+/).join("\n");
60156
+ }
60149
60157
async function globFiles(pattern) {
60150
60158
const globber = await glob.create(pattern, {
60151
60159
followSymbolicLinks: false,
Original file line number Diff line number Diff line change @@ -60055,6 +60055,9 @@ class CacheConfig {
60055
60055
}
60056
60056
}
60057
60057
self.keyEnvs = keyEnvs;
60058
+ // Installed packages and their versions are also considered for the key.
60059
+ const packages = await getPackages();
60060
+ hasher.update(packages);
60058
60061
key += `-${hasher.digest("hex")}`;
60059
60062
self.restoreKey = key;
60060
60063
// Construct the lockfiles portion of the key:
@@ -60146,6 +60149,11 @@ async function getRustVersion() {
60146
60149
.filter((s) => s.length === 2);
60147
60150
return Object.fromEntries(splits);
60148
60151
}
60152
+ async function getPackages() {
60153
+ let stdout = await getCmdOutput("cargo", ["install", "--list"]);
60154
+ // Make OS independent.
60155
+ return stdout.split(/[\n\r]+/).join("\n");
60156
+ }
60149
60157
async function globFiles(pattern) {
60150
60158
const globber = await glob.create(pattern, {
60151
60159
followSymbolicLinks: false,
Original file line number Diff line number Diff line change @@ -103,6 +103,11 @@ export class CacheConfig {
103
103
}
104
104
105
105
self . keyEnvs = keyEnvs ;
106
+
107
+ // Installed packages and their versions are also considered for the key.
108
+ const packages = await getPackages ( ) ;
109
+ hasher . update ( packages ) ;
110
+
106
111
key += `-${ hasher . digest ( "hex" ) } ` ;
107
112
108
113
self . restoreKey = key ;
@@ -220,6 +225,12 @@ async function getRustVersion(): Promise<RustVersion> {
220
225
return Object . fromEntries ( splits ) ;
221
226
}
222
227
228
+ async function getPackages ( ) : Promise < string > {
229
+ let stdout = await getCmdOutput ( "cargo" , [ "install" , "--list" ] ) ;
230
+ // Make OS independent.
231
+ return stdout . split ( / [ \n \r ] + / ) . join ( "\n" ) ;
232
+ }
233
+
223
234
async function globFiles ( pattern : string ) : Promise < string [ ] > {
224
235
const globber = await glob . create ( pattern , {
225
236
followSymbolicLinks : false ,
You can’t perform that action at this time.
0 commit comments