3
0
Fork 0
mirror of https://github.com/Swatinem/rust-cache synced 2025-04-27 21:55:52 +00:00

lol, dependency check was reversed

This commit is contained in:
Arpad Borsos 2022-07-09 17:37:48 +02:00
parent 7c190ef171
commit 07a2ee71bc
No known key found for this signature in database
GPG key ID: FC7BCA77824B3298
5 changed files with 32 additions and 53 deletions

23
dist/restore/index.js vendored
View file

@ -61646,7 +61646,7 @@ class Workspace {
cwd: this.root,
}));
for (const pkg of meta.packages) {
if (!pkg.manifest_path.startsWith(this.root)) {
if (pkg.manifest_path.startsWith(this.root)) {
continue;
}
const targets = pkg.targets.filter((t) => t.kind[0] === "lib").map((t) => t.name);
@ -61875,7 +61875,7 @@ async function cleanTargetDir(targetDir, packages) {
if (dirent.isDirectory()) {
let dirName = external_path_default().join(dir.path, dirent.name);
// is it a profile dir, or a nested target dir?
let isNestedTarget = await exists(external_path_default().join(dirName, "CACHEDIR.TAG"));
let isNestedTarget = (await exists(external_path_default().join(dirName, "CACHEDIR.TAG"))) || (await exists(external_path_default().join(dirName, ".rustc_info.json")));
try {
if (isNestedTarget) {
await cleanTargetDir(dirName, packages);
@ -61891,19 +61891,10 @@ async function cleanTargetDir(targetDir, packages) {
}
}
await external_fs_default().promises.unlink(external_path_default().join(targetDir, "./.rustc_info.json"));
// TODO: remove all unknown files, clean all directories like profiles
try {
await cleanProfileTarget(external_path_default().join(targetDir, "debug"), packages);
}
catch { }
try {
await cleanProfileTarget(external_path_default().join(targetDir, "release"), packages);
}
catch { }
}
async function cleanProfileTarget(profileDir, packages) {
await lib_io.rmRF(external_path_default().join(profileDir, "./examples"));
await lib_io.rmRF(external_path_default().join(profileDir, "./incremental"));
await lib_io.rmRF(external_path_default().join(profileDir, "examples"));
await lib_io.rmRF(external_path_default().join(profileDir, "incremental"));
let dir;
// remove all *files* from the profile directory
dir = await external_fs_default().promises.opendir(profileDir);
@ -61913,8 +61904,8 @@ async function cleanProfileTarget(profileDir, packages) {
}
}
const keepPkg = new Set(packages.map((p) => p.name));
await rmExcept(external_path_default().join(profileDir, "./build"), keepPkg);
await rmExcept(external_path_default().join(profileDir, "./.fingerprint"), keepPkg);
await rmExcept(external_path_default().join(profileDir, "build"), keepPkg);
await rmExcept(external_path_default().join(profileDir, ".fingerprint"), keepPkg);
const keepDeps = new Set(packages.flatMap((p) => {
const names = [];
for (const n of [p.name, ...p.targets]) {
@ -61923,7 +61914,7 @@ async function cleanProfileTarget(profileDir, packages) {
}
return names;
}));
await rmExcept(external_path_default().join(profileDir, "./deps"), keepDeps);
await rmExcept(external_path_default().join(profileDir, "deps"), keepDeps);
}
async function cleanBin(config) {
const bins = await config.getCargoBins();