mirror of
https://github.com/Swatinem/rust-cache
synced 2026-09-14 20:13:25 +00:00
+10
-6
@@ -15,15 +15,19 @@ export async function cleanTargetDir(targetDir: string, packages: Packages, chec
|
|||||||
for await (const dirent of dir) {
|
for await (const dirent of dir) {
|
||||||
if (dirent.isDirectory()) {
|
if (dirent.isDirectory()) {
|
||||||
let dirName = path.join(dir.path, dirent.name);
|
let dirName = path.join(dir.path, dirent.name);
|
||||||
// is it a profile dir, or a nested target dir?
|
// Target-triple directories do not contain Cargo's target directory
|
||||||
let isNestedTarget =
|
// markers, so identify profiles by their artifact directories as well.
|
||||||
(await exists(path.join(dirName, "CACHEDIR.TAG"))) || (await exists(path.join(dirName, ".rustc_info.json")));
|
const isProfile =
|
||||||
|
dirent.name === "tests" ||
|
||||||
|
(await exists(path.join(dirName, "build"))) ||
|
||||||
|
(await exists(path.join(dirName, ".fingerprint"))) ||
|
||||||
|
(await exists(path.join(dirName, "deps")));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (isNestedTarget) {
|
if (isProfile) {
|
||||||
await cleanTargetDir(dirName, packages, checkTimestamp);
|
|
||||||
} else {
|
|
||||||
await cleanProfileTarget(dirName, packages, checkTimestamp);
|
await cleanProfileTarget(dirName, packages, checkTimestamp);
|
||||||
|
} else {
|
||||||
|
await cleanTargetDir(dirName, packages, checkTimestamp);
|
||||||
}
|
}
|
||||||
} catch {}
|
} catch {}
|
||||||
} else if (dirent.name !== "CACHEDIR.TAG") {
|
} else if (dirent.name !== "CACHEDIR.TAG") {
|
||||||
|
|||||||
Reference in New Issue
Block a user