mirror of
https://github.com/Swatinem/rust-cache
synced 2025-06-22 16:23:42 +00:00
Only key by Cargo.toml
and Cargo.lock
files of workspace members (#180)
This commit is contained in:
parent
b1db5f9d5f
commit
d30f1144e8
7 changed files with 88 additions and 62 deletions
|
@ -8,7 +8,7 @@ import path from "path";
|
|||
import * as toml from "smol-toml";
|
||||
|
||||
import { getCargoBins } from "./cleanup";
|
||||
import { CacheProvider, getCmdOutput } from "./utils";
|
||||
import { CacheProvider, exists, getCmdOutput } from "./utils";
|
||||
import { Workspace } from "./workspace";
|
||||
|
||||
const HOME = os.homedir();
|
||||
|
@ -142,7 +142,9 @@ export class CacheConfig {
|
|||
)),
|
||||
);
|
||||
|
||||
const cargo_manifests = sort_and_uniq(await globFiles(`${root}/**/Cargo.toml`));
|
||||
const workspaceMembers = await workspace.getWorkspaceMembers();
|
||||
|
||||
const cargo_manifests = sort_and_uniq(workspaceMembers.map(member => path.join(member.path, "Cargo.toml")));
|
||||
|
||||
for (const cargo_manifest of cargo_manifests) {
|
||||
try {
|
||||
|
@ -189,9 +191,8 @@ export class CacheConfig {
|
|||
}
|
||||
}
|
||||
|
||||
const cargo_locks = sort_and_uniq(await globFiles(`${root}/**/Cargo.lock`));
|
||||
|
||||
for (const cargo_lock of cargo_locks) {
|
||||
const cargo_lock = path.join(workspace.root, "Cargo.lock");
|
||||
if (await exists(cargo_lock)) {
|
||||
try {
|
||||
const content = await fs_promises.readFile(cargo_lock, { encoding: "utf8" });
|
||||
const parsed = toml.parse(content);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue