build: bust the deps cache on windows (#30401)

This commit is contained in:
Samuel Attard 2021-08-04 15:31:17 -07:00 committed by GitHub
parent 481b774fd7
commit 4703dc0a1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,7 +3,14 @@ const fs = require('fs');
const path = require('path');
// Fallback to blow away old cache keys
const HASH_VERSION = 3;
const FALLBACK_HASH_VERSION = 3;
// Per platform hash versions to bust the cache on different platforms
const HASH_VERSIONS = {
darwin: 3,
win32: 4,
linux: 3
};
// Base files to hash
const filesToHash = [
@ -28,7 +35,7 @@ addAllFiles(path.resolve(__dirname, '../patches'));
// Create Hash
const hasher = crypto.createHash('SHA256');
hasher.update(`HASH_VERSION:${HASH_VERSION}`);
hasher.update(`HASH_VERSION:${HASH_VERSIONS[process.platform] || FALLBACK_HASH_VERSION}`);
for (const file of filesToHash) {
hasher.update(fs.readFileSync(file));
}