3
0
Fork 0
mirror of https://github.com/Swatinem/rust-cache synced 2026-06-10 02:37:12 +00:00
This commit is contained in:
Arpad Borsos 2026-06-06 14:07:54 +02:00
commit 1fe0a60026
No known key found for this signature in database
GPG key ID: FC7BCA77824B3298
19 changed files with 81 additions and 55 deletions

12
dist/restore.js vendored
View file

@ -332343,7 +332343,7 @@ async function exists(path) {
}
}
const SAVE_TARGETS = new Set(["lib", "proc-macro"]);
const SAVE_TARGETS = new Set(["lib", "cdylib", "dylib", "rlib", "staticlib", "proc-macro"]);
class Workspace {
root;
target;
@ -332682,10 +332682,10 @@ function digest(hasher) {
async function getCargoBins() {
const bins = new Set();
try {
const { installs } = JSON.parse(await fs$2.readFile(path__default.join(CARGO_HOME, ".crates2.json"), "utf8"));
for (const pkg of Object.values(installs)) {
for (const bin of pkg.bins) {
bins.add(bin);
const dir = await fs$2.opendir(path__default.join(CARGO_HOME, "bin"));
for await (const dirent of dir) {
if (dirent.isFile()) {
bins.add(dirent.name);
}
}
}
@ -332803,7 +332803,7 @@ async function cleanProfileTarget(profileDir, packages, checkTimestamp = false)
}
let keepProfile = new Set(["build", ".fingerprint", "deps"]);
await rmExcept(profileDir, keepProfile);
const keepPkg = new Set(packages.map((p) => p.name));
const keepPkg = new Set(packages.flatMap((p) => [p.name, ...p.targets.map((t) => t.replace(/-/g, "_"))]));
await rmExcept(path__default.join(profileDir, "build"), keepPkg, checkTimestamp);
await rmExcept(path__default.join(profileDir, ".fingerprint"), keepPkg, checkTimestamp);
const keepDeps = new Set(packages.flatMap((p) => {

19
dist/save.js vendored
View file

@ -332310,7 +332310,7 @@ async function exists(path) {
}
}
const SAVE_TARGETS = new Set(["lib", "proc-macro"]);
const SAVE_TARGETS = new Set(["lib", "cdylib", "dylib", "rlib", "staticlib", "proc-macro"]);
class Workspace {
root;
target;
@ -332657,10 +332657,10 @@ function digest(hasher) {
async function getCargoBins() {
const bins = new Set();
try {
const { installs } = JSON.parse(await fs$2.readFile(path__default.join(CARGO_HOME, ".crates2.json"), "utf8"));
for (const pkg of Object.values(installs)) {
for (const bin of pkg.bins) {
bins.add(bin);
const dir = await fs$2.opendir(path__default.join(CARGO_HOME, "bin"));
for await (const dirent of dir) {
if (dirent.isFile()) {
bins.add(dirent.name);
}
}
}
@ -332778,7 +332778,7 @@ async function cleanProfileTarget(profileDir, packages, checkTimestamp = false)
}
let keepProfile = new Set(["build", ".fingerprint", "deps"]);
await rmExcept(profileDir, keepProfile);
const keepPkg = new Set(packages.map((p) => p.name));
const keepPkg = new Set(packages.flatMap((p) => [p.name, ...p.targets.map((t) => t.replace(/-/g, "_"))]));
await rmExcept(path__default.join(profileDir, "build"), keepPkg, checkTimestamp);
await rmExcept(path__default.join(profileDir, ".fingerprint"), keepPkg, checkTimestamp);
const keepDeps = new Set(packages.flatMap((p) => {
@ -332798,13 +332798,10 @@ async function cleanProfileTarget(profileDir, packages, checkTimestamp = false)
* @param oldBins The binaries that existed when the action started.
*/
async function cleanBin(oldBins) {
const bins = await getCargoBins();
for (const bin of oldBins) {
bins.delete(bin);
}
const binsToRemove = new Set(oldBins);
const dir = await fs__default.promises.opendir(path__default.join(CARGO_HOME, "bin"));
for await (const dirent of dir) {
if (dirent.isFile() && !bins.has(dirent.name)) {
if (dirent.isFile() && binsToRemove.has(dirent.name)) {
await rm(dir.path, dirent);
}
}