3
0
Fork 0
mirror of https://github.com/Swatinem/rust-cache synced 2025-04-18 09:49:02 +00:00

Only include env vars that are specific to Rust

This commit is contained in:
Dominik Nakamura 2022-03-14 12:28:14 +09:00
parent 5f6b32160d
commit c4f3eceb2f
No known key found for this signature in database
GPG key ID: E4C6A749B2491910
3 changed files with 37 additions and 3 deletions

13
dist/restore/index.js vendored
View file

@ -59597,8 +59597,19 @@ async function getCargoBins() {
}
function getEnvKey() {
const hasher = external_crypto_default().createHash("sha1");
const validKeys = [
/^CARGO_.+$/,
/^CC_.+$/,
/^CXX_.+$/,
/^RUSTC_.+$/,
/^RUSTC$/,
/^RUSTDOC$/,
/^RUSTDOCFLAGS$/,
/^RUSTFLAGS$/,
/^RUSTFMT$/,
];
for (const [key, value] of Object.entries(process.env)) {
if (value) {
if (validKeys.some((re) => re.test(key)) && value) {
hasher.update(`${key}=${value}`);
}
}

13
dist/save/index.js vendored
View file

@ -59597,8 +59597,19 @@ async function getCargoBins() {
}
function getEnvKey() {
const hasher = external_crypto_default().createHash("sha1");
const validKeys = [
/^CARGO_.+$/,
/^CC_.+$/,
/^CXX_.+$/,
/^RUSTC_.+$/,
/^RUSTC$/,
/^RUSTDOC$/,
/^RUSTDOCFLAGS$/,
/^RUSTFLAGS$/,
/^RUSTFMT$/,
];
for (const [key, value] of Object.entries(process.env)) {
if (value) {
if (validKeys.some((re) => re.test(key)) && value) {
hasher.update(`${key}=${value}`);
}
}

View file

@ -108,8 +108,20 @@ export async function getCargoBins(): Promise<Set<string>> {
function getEnvKey(): string {
const hasher = crypto.createHash("sha1");
const validKeys = [
/^CARGO_.+$/,
/^CC_.+$/,
/^CXX_.+$/,
/^RUSTC_.+$/,
/^RUSTC$/,
/^RUSTDOC$/,
/^RUSTDOCFLAGS$/,
/^RUSTFLAGS$/,
/^RUSTFMT$/,
];
for (const [key, value] of Object.entries(process.env)) {
if (value) {
if (validKeys.some((re) => re.test(key)) && value) {
hasher.update(`${key}=${value}`);
}
}