mirror of
https://github.com/electron/electron.git
synced 2026-10-28 11:44:46 +08:00
* fix: derive V8 cache compatibility from net patch effects Replace the custom V8 cache salt and Wasm embedded blob guard from #54234 with embedder string version hashing. Generate -electron.<16-hex fingerprint> during GN configuration from the net committed changes between Chromium's pinned V8 revision and patched HEAD. This requires no release time bookkeeping and preserves cache identities across packaging only changes to the patch series. * build: fix metadata generation and restoration * build: address review follow-ups - Keep code cache hash checks free of process global mutation - Limit the helper to DCHECK enabled builds - Make the fingerprint algorithm self contained and include it in the source cache key - Allow an explicit packager identity - Skip Wasm tests without generated assets - Correct the documentation structure * build: simplify V8 fingerprint regeneration tracking Track Git HEAD and the exported V8 patch series instead of symbolic branch refs, packed-refs, or Git directories. Detached checkout updates and patch exports trigger regeneration, while equivalent re-exports preserve the committed source fingerprint. Reject reftable storage explicitly and provide actionable diagnostics when the checkout does not contain Chromium's pinned V8 revision. * fix: gn check for release builds * chore: convert to vitest imports * chore: cleanup testing binding dependency * chore: update patches * chore: remove redundant dep declaration
51 lines
1.4 KiB
JavaScript
51 lines
1.4 KiB
JavaScript
const crypto = require('node:crypto');
|
|
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
|
|
// Per platform hash versions to bust the cache on different platforms
|
|
const HASH_VERSIONS = {
|
|
darwin: 4,
|
|
win32: 4,
|
|
linux: 4
|
|
};
|
|
|
|
// Base files to hash
|
|
const filesToHash = [
|
|
path.resolve(__dirname, '../DEPS'),
|
|
path.resolve(__dirname, '../yarn.lock'),
|
|
path.resolve(__dirname, '../script/sysroots.json'),
|
|
path.resolve(__dirname, '../.github/actions/checkout/action.yml'),
|
|
path.resolve(__dirname, '../script/v8-patch-fingerprint.py')
|
|
];
|
|
|
|
const addAllFiles = (dir) => {
|
|
for (const child of fs.readdirSync(dir).sort()) {
|
|
const childPath = path.resolve(dir, child);
|
|
if (fs.statSync(childPath).isDirectory()) {
|
|
addAllFiles(childPath);
|
|
} else {
|
|
filesToHash.push(childPath);
|
|
}
|
|
}
|
|
};
|
|
|
|
// Add all patch files to the hash
|
|
addAllFiles(path.resolve(__dirname, '../patches'));
|
|
|
|
// Create Hash
|
|
const hasher = crypto.createHash('SHA256');
|
|
const addToHashAndLog = (s) => {
|
|
return hasher.update(s);
|
|
};
|
|
addToHashAndLog(`HASH_VERSION:${HASH_VERSIONS[process.platform]}`);
|
|
for (const file of filesToHash) {
|
|
hasher.update(fs.readFileSync(file));
|
|
}
|
|
|
|
// Add the GCLIENT_EXTRA_ARGS variable to the hash
|
|
const extraArgs = process.env.GCLIENT_EXTRA_ARGS || 'no_extra_args';
|
|
addToHashAndLog(extraArgs);
|
|
|
|
// Write the hash to disk
|
|
fs.writeFileSync(path.resolve(__dirname, '../.depshash'), hasher.digest('hex'));
|