mirror of
https://github.com/Swatinem/rust-cache
synced 2025-08-07 13:51:24 +00:00
move target clean
This commit is contained in:
parent
3231cccdde
commit
0381560ff9
4 changed files with 83 additions and 84 deletions
14
dist/restore/index.js
vendored
14
dist/restore/index.js
vendored
|
@ -87075,10 +87075,13 @@ async function cleanProfileTarget(profileDir, packages, checkTimestamp, incremen
|
|||
}
|
||||
catch { }
|
||||
// Delete everything else.
|
||||
let except = new Set(["target", "trybuild"]);
|
||||
await rmExcept(profileDir, new Set(["target", "trybuild"]), checkTimestamp);
|
||||
return;
|
||||
}
|
||||
let keepProfile = new Set(["build", ".fingerprint", "deps"]);
|
||||
// Keep the incremental folder if incremental builds are enabled
|
||||
if (incremental) {
|
||||
except.add("incremental");
|
||||
keepProfile.add("incremental");
|
||||
// Traverse the incremental folder recursively and collect the modified times in a map
|
||||
const incrementalDir = external_path_default().join(profileDir, "incremental");
|
||||
const modifiedTimes = new Map();
|
||||
|
@ -87097,13 +87100,10 @@ async function cleanProfileTarget(profileDir, packages, checkTimestamp, incremen
|
|||
};
|
||||
await fillModifiedTimes(incrementalDir);
|
||||
// Write the modified times to the incremental folder
|
||||
lib_core.debug(`writing incremental-restore.json for ${incrementalDir} with ${modifiedTimes} files`);
|
||||
const contents = JSON.stringify({ modifiedTimes });
|
||||
await external_fs_default().promises.writeFile(external_path_default().join(incrementalDir, "incremental-restore.json"), contents);
|
||||
}
|
||||
await rmExcept(profileDir, except, checkTimestamp);
|
||||
return;
|
||||
}
|
||||
let keepProfile = new Set(["build", ".fingerprint", "deps"]);
|
||||
await rmExcept(profileDir, keepProfile);
|
||||
const keepPkg = new Set(packages.map((p) => p.name));
|
||||
await rmExcept(external_path_default().join(profileDir, "build"), keepPkg, checkTimestamp);
|
||||
|
@ -87437,7 +87437,7 @@ async function run() {
|
|||
// pre-clean the target directory on cache mismatch
|
||||
for (const workspace of config.workspaces) {
|
||||
try {
|
||||
await cleanTargetDir(workspace.target, [], true, false);
|
||||
await cleanTargetDir(workspace.target, [], true, config.incremental);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
|
12
dist/save/index.js
vendored
12
dist/save/index.js
vendored
|
@ -87075,10 +87075,13 @@ async function cleanProfileTarget(profileDir, packages, checkTimestamp, incremen
|
|||
}
|
||||
catch { }
|
||||
// Delete everything else.
|
||||
let except = new Set(["target", "trybuild"]);
|
||||
await rmExcept(profileDir, new Set(["target", "trybuild"]), checkTimestamp);
|
||||
return;
|
||||
}
|
||||
let keepProfile = new Set(["build", ".fingerprint", "deps"]);
|
||||
// Keep the incremental folder if incremental builds are enabled
|
||||
if (incremental) {
|
||||
except.add("incremental");
|
||||
keepProfile.add("incremental");
|
||||
// Traverse the incremental folder recursively and collect the modified times in a map
|
||||
const incrementalDir = external_path_default().join(profileDir, "incremental");
|
||||
const modifiedTimes = new Map();
|
||||
|
@ -87097,13 +87100,10 @@ async function cleanProfileTarget(profileDir, packages, checkTimestamp, incremen
|
|||
};
|
||||
await fillModifiedTimes(incrementalDir);
|
||||
// Write the modified times to the incremental folder
|
||||
core.debug(`writing incremental-restore.json for ${incrementalDir} with ${modifiedTimes} files`);
|
||||
const contents = JSON.stringify({ modifiedTimes });
|
||||
await external_fs_default().promises.writeFile(external_path_default().join(incrementalDir, "incremental-restore.json"), contents);
|
||||
}
|
||||
await rmExcept(profileDir, except, checkTimestamp);
|
||||
return;
|
||||
}
|
||||
let keepProfile = new Set(["build", ".fingerprint", "deps"]);
|
||||
await rmExcept(profileDir, keepProfile);
|
||||
const keepPkg = new Set(packages.map((p) => p.name));
|
||||
await rmExcept(external_path_default().join(profileDir, "build"), keepPkg, checkTimestamp);
|
||||
|
|
|
@ -51,11 +51,15 @@ async function cleanProfileTarget(profileDir: string, packages: Packages, checkT
|
|||
} catch { }
|
||||
|
||||
// Delete everything else.
|
||||
let except = new Set(["target", "trybuild"]);
|
||||
await rmExcept(profileDir, new Set(["target", "trybuild"]), checkTimestamp);
|
||||
return;
|
||||
}
|
||||
|
||||
let keepProfile = new Set(["build", ".fingerprint", "deps"]);
|
||||
|
||||
// Keep the incremental folder if incremental builds are enabled
|
||||
if (incremental) {
|
||||
except.add("incremental");
|
||||
keepProfile.add("incremental");
|
||||
|
||||
// Traverse the incremental folder recursively and collect the modified times in a map
|
||||
const incrementalDir = path.join(profileDir, "incremental");
|
||||
|
@ -75,16 +79,11 @@ async function cleanProfileTarget(profileDir: string, packages: Packages, checkT
|
|||
await fillModifiedTimes(incrementalDir);
|
||||
|
||||
// Write the modified times to the incremental folder
|
||||
core.debug(`writing incremental-restore.json for ${incrementalDir} with ${modifiedTimes} files`);
|
||||
const contents = JSON.stringify({ modifiedTimes });
|
||||
await fs.promises.writeFile(path.join(incrementalDir, "incremental-restore.json"), contents);
|
||||
}
|
||||
|
||||
await rmExcept(profileDir, except, checkTimestamp);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
let keepProfile = new Set(["build", ".fingerprint", "deps"]);
|
||||
await rmExcept(profileDir, keepProfile);
|
||||
|
||||
const keepPkg = new Set(packages.map((p) => p.name));
|
||||
|
|
|
@ -60,7 +60,7 @@ async function run() {
|
|||
// pre-clean the target directory on cache mismatch
|
||||
for (const workspace of config.workspaces) {
|
||||
try {
|
||||
await cleanTargetDir(workspace.target, [], true, false);
|
||||
await cleanTargetDir(workspace.target, [], true, config.incremental);
|
||||
} catch { }
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue