This commit is contained in:
Arpad Borsos
2026-06-06 14:11:05 +02:00
19 changed files with 81 additions and 55 deletions
+6 -6
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) => {
+8 -11
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);
}
}