mirror of
https://github.com/Swatinem/rust-cache
synced 2025-05-01 23:55:54 +00:00
fix accidentally deleting ache
This commit is contained in:
parent
6f58383b83
commit
bd6c4068e7
5 changed files with 24 additions and 25 deletions
16
dist/restore/index.js
vendored
16
dist/restore/index.js
vendored
|
@ -87114,7 +87114,7 @@ function sort_and_uniq(a) {
|
|||
|
||||
|
||||
|
||||
async function cleanTargetDir(targetDir, packages, checkTimestamp, incremental) {
|
||||
async function cleanTargetDir(targetDir, packages, checkTimestamp) {
|
||||
lib_core.debug(`cleaning target directory "${targetDir}"`);
|
||||
// remove all *files* from the profile directory
|
||||
let dir = await external_fs_default().promises.opendir(targetDir);
|
||||
|
@ -87125,10 +87125,10 @@ async function cleanTargetDir(targetDir, packages, checkTimestamp, incremental)
|
|||
let isNestedTarget = (await utils_exists(external_path_default().join(dirName, "CACHEDIR.TAG"))) || (await utils_exists(external_path_default().join(dirName, ".rustc_info.json")));
|
||||
try {
|
||||
if (isNestedTarget) {
|
||||
await cleanTargetDir(dirName, packages, checkTimestamp, incremental);
|
||||
await cleanTargetDir(dirName, packages, checkTimestamp);
|
||||
}
|
||||
else {
|
||||
await cleanProfileTarget(dirName, packages, checkTimestamp, incremental);
|
||||
await cleanProfileTarget(dirName, packages, checkTimestamp);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
@ -87138,7 +87138,7 @@ async function cleanTargetDir(targetDir, packages, checkTimestamp, incremental)
|
|||
}
|
||||
}
|
||||
}
|
||||
async function cleanProfileTarget(profileDir, packages, checkTimestamp, incremental) {
|
||||
async function cleanProfileTarget(profileDir, packages, checkTimestamp) {
|
||||
lib_core.debug(`cleaning profile directory "${profileDir}"`);
|
||||
// Quite a few testing utility crates store compilation artifacts as nested
|
||||
// workspaces under `target/tests`. Notably, `target/tests/target` and
|
||||
|
@ -87147,12 +87147,12 @@ async function cleanProfileTarget(profileDir, packages, checkTimestamp, incremen
|
|||
try {
|
||||
// https://github.com/vertexclique/kaos/blob/9876f6c890339741cc5be4b7cb9df72baa5a6d79/src/cargo.rs#L25
|
||||
// https://github.com/eupn/macrotest/blob/c4151a5f9f545942f4971980b5d264ebcd0b1d11/src/cargo.rs#L27
|
||||
cleanTargetDir(external_path_default().join(profileDir, "target"), packages, checkTimestamp, incremental);
|
||||
cleanTargetDir(external_path_default().join(profileDir, "target"), packages, checkTimestamp);
|
||||
}
|
||||
catch { }
|
||||
try {
|
||||
// https://github.com/dtolnay/trybuild/blob/eec8ca6cb9b8f53d0caf1aa499d99df52cae8b40/src/cargo.rs#L50
|
||||
cleanTargetDir(external_path_default().join(profileDir, "trybuild"), packages, checkTimestamp, incremental);
|
||||
cleanTargetDir(external_path_default().join(profileDir, "trybuild"), packages, checkTimestamp);
|
||||
}
|
||||
catch { }
|
||||
// Delete everything else.
|
||||
|
@ -87445,11 +87445,11 @@ async function run() {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!match || config.isIncrementalMissing()) {
|
||||
if (!match) {
|
||||
// pre-clean the target directory on cache mismatch
|
||||
for (const workspace of config.workspaces) {
|
||||
try {
|
||||
await cleanTargetDir(workspace.target, [], true, config.incremental);
|
||||
await cleanTargetDir(workspace.target, [], true);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
|
14
dist/save/index.js
vendored
14
dist/save/index.js
vendored
|
@ -87114,7 +87114,7 @@ function sort_and_uniq(a) {
|
|||
|
||||
|
||||
|
||||
async function cleanTargetDir(targetDir, packages, checkTimestamp, incremental) {
|
||||
async function cleanTargetDir(targetDir, packages, checkTimestamp) {
|
||||
lib_core.debug(`cleaning target directory "${targetDir}"`);
|
||||
// remove all *files* from the profile directory
|
||||
let dir = await external_fs_default().promises.opendir(targetDir);
|
||||
|
@ -87125,10 +87125,10 @@ async function cleanTargetDir(targetDir, packages, checkTimestamp, incremental)
|
|||
let isNestedTarget = (await utils_exists(external_path_default().join(dirName, "CACHEDIR.TAG"))) || (await utils_exists(external_path_default().join(dirName, ".rustc_info.json")));
|
||||
try {
|
||||
if (isNestedTarget) {
|
||||
await cleanTargetDir(dirName, packages, checkTimestamp, incremental);
|
||||
await cleanTargetDir(dirName, packages, checkTimestamp);
|
||||
}
|
||||
else {
|
||||
await cleanProfileTarget(dirName, packages, checkTimestamp, incremental);
|
||||
await cleanProfileTarget(dirName, packages, checkTimestamp);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
@ -87138,7 +87138,7 @@ async function cleanTargetDir(targetDir, packages, checkTimestamp, incremental)
|
|||
}
|
||||
}
|
||||
}
|
||||
async function cleanProfileTarget(profileDir, packages, checkTimestamp, incremental) {
|
||||
async function cleanProfileTarget(profileDir, packages, checkTimestamp) {
|
||||
lib_core.debug(`cleaning profile directory "${profileDir}"`);
|
||||
// Quite a few testing utility crates store compilation artifacts as nested
|
||||
// workspaces under `target/tests`. Notably, `target/tests/target` and
|
||||
|
@ -87147,12 +87147,12 @@ async function cleanProfileTarget(profileDir, packages, checkTimestamp, incremen
|
|||
try {
|
||||
// https://github.com/vertexclique/kaos/blob/9876f6c890339741cc5be4b7cb9df72baa5a6d79/src/cargo.rs#L25
|
||||
// https://github.com/eupn/macrotest/blob/c4151a5f9f545942f4971980b5d264ebcd0b1d11/src/cargo.rs#L27
|
||||
cleanTargetDir(external_path_default().join(profileDir, "target"), packages, checkTimestamp, incremental);
|
||||
cleanTargetDir(external_path_default().join(profileDir, "target"), packages, checkTimestamp);
|
||||
}
|
||||
catch { }
|
||||
try {
|
||||
// https://github.com/dtolnay/trybuild/blob/eec8ca6cb9b8f53d0caf1aa499d99df52cae8b40/src/cargo.rs#L50
|
||||
cleanTargetDir(external_path_default().join(profileDir, "trybuild"), packages, checkTimestamp, incremental);
|
||||
cleanTargetDir(external_path_default().join(profileDir, "trybuild"), packages, checkTimestamp);
|
||||
}
|
||||
catch { }
|
||||
// Delete everything else.
|
||||
|
@ -87448,7 +87448,7 @@ async function run() {
|
|||
allPackages.push(...packages);
|
||||
try {
|
||||
lib_core.info(`... Cleaning ${workspace.target} ...`);
|
||||
await cleanTargetDir(workspace.target, packages, false, config.incremental);
|
||||
await cleanTargetDir(workspace.target, packages, false);
|
||||
}
|
||||
catch (e) {
|
||||
lib_core.debug(`${e.stack}`);
|
||||
|
|
|
@ -7,7 +7,7 @@ import { CARGO_HOME } from "./config";
|
|||
import { exists } from "./utils";
|
||||
import { Packages } from "./workspace";
|
||||
|
||||
export async function cleanTargetDir(targetDir: string, packages: Packages, checkTimestamp: boolean, incremental: boolean) {
|
||||
export async function cleanTargetDir(targetDir: string, packages: Packages, checkTimestamp: boolean) {
|
||||
core.debug(`cleaning target directory "${targetDir}"`);
|
||||
|
||||
// remove all *files* from the profile directory
|
||||
|
@ -21,9 +21,9 @@ export async function cleanTargetDir(targetDir: string, packages: Packages, chec
|
|||
|
||||
try {
|
||||
if (isNestedTarget) {
|
||||
await cleanTargetDir(dirName, packages, checkTimestamp, incremental);
|
||||
await cleanTargetDir(dirName, packages, checkTimestamp);
|
||||
} else {
|
||||
await cleanProfileTarget(dirName, packages, checkTimestamp, incremental);
|
||||
await cleanProfileTarget(dirName, packages, checkTimestamp);
|
||||
}
|
||||
} catch { }
|
||||
} else if (dirent.name !== "CACHEDIR.TAG") {
|
||||
|
@ -32,7 +32,7 @@ export async function cleanTargetDir(targetDir: string, packages: Packages, chec
|
|||
}
|
||||
}
|
||||
|
||||
async function cleanProfileTarget(profileDir: string, packages: Packages, checkTimestamp: boolean, incremental: boolean) {
|
||||
async function cleanProfileTarget(profileDir: string, packages: Packages, checkTimestamp: boolean) {
|
||||
core.debug(`cleaning profile directory "${profileDir}"`);
|
||||
|
||||
// Quite a few testing utility crates store compilation artifacts as nested
|
||||
|
@ -42,12 +42,11 @@ async function cleanProfileTarget(profileDir: string, packages: Packages, checkT
|
|||
try {
|
||||
// https://github.com/vertexclique/kaos/blob/9876f6c890339741cc5be4b7cb9df72baa5a6d79/src/cargo.rs#L25
|
||||
// https://github.com/eupn/macrotest/blob/c4151a5f9f545942f4971980b5d264ebcd0b1d11/src/cargo.rs#L27
|
||||
cleanTargetDir(path.join(profileDir, "target"), packages, checkTimestamp, incremental);
|
||||
cleanTargetDir(path.join(profileDir, "target"), packages, checkTimestamp);
|
||||
} catch { }
|
||||
|
||||
try {
|
||||
// https://github.com/dtolnay/trybuild/blob/eec8ca6cb9b8f53d0caf1aa499d99df52cae8b40/src/cargo.rs#L50
|
||||
cleanTargetDir(path.join(profileDir, "trybuild"), packages, checkTimestamp, incremental);
|
||||
cleanTargetDir(path.join(profileDir, "trybuild"), packages, checkTimestamp);
|
||||
} catch { }
|
||||
|
||||
// Delete everything else.
|
||||
|
|
|
@ -60,11 +60,11 @@ async function run() {
|
|||
}
|
||||
}
|
||||
|
||||
if (!match || config.isIncrementalMissing()) {
|
||||
if (!match) {
|
||||
// pre-clean the target directory on cache mismatch
|
||||
for (const workspace of config.workspaces) {
|
||||
try {
|
||||
await cleanTargetDir(workspace.target, [], true, config.incremental);
|
||||
await cleanTargetDir(workspace.target, [], true);
|
||||
} catch { }
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ async function run() {
|
|||
allPackages.push(...packages);
|
||||
try {
|
||||
core.info(`... Cleaning ${workspace.target} ...`);
|
||||
await cleanTargetDir(workspace.target, packages, false, config.incremental);
|
||||
await cleanTargetDir(workspace.target, packages, false);
|
||||
} catch (e) {
|
||||
core.debug(`${(e as any).stack}`);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue