electron/script/generate-deps-hash.js
Samuel Attard 6bcf67e051
feat: enable builtin spellchecker (#20692)
* chore: add code required to use chromes spellchecker

* chore: fix linting

* chore: manifests needs buildflags now

* chore: add dictionarySuggestions to the context menu event when the spellchecker is active

* chore: enable by default for windows builds

* chore: add patch to remove incognito usage in the spellchecker

* chore: add dependencies on spellcheck common and flags

* chore: conditionally include spell check panel impl

* chore: fix deps for spellcheck feature flags

* chore: add patch for electron resources

* chore: add dependency on //components/language/core/browser

* chore: patches to make hunspell work on windows

* build: collect hunspell dictionaries into a zip file and publish

* chore: clean up patches

* chore: add docs and set spell checker url method

* chore: fix error handling

* chore: fix hash logic

* build: update hunspell filename generator

* fix: default spellchecker list to the current system locale if we can

* docs: document the language getter

* chore: patch IDS_ resources for linux builds

* feat: add spellcheck webpref flag to disable the builtin spellchecker

* chore: fix docs typo

* chore: clean up spellchecker impl as per feedback

* remove unneeded deps
2019-10-31 13:11:51 -07:00

41 lines
1.1 KiB
JavaScript

const crypto = require('crypto')
const fs = require('fs')
const path = require('path')
// Fallback to blow away old cache keys
const HASH_VERSION = 1
// Base files to hash
const filesToHash = [
path.resolve(__dirname, '../DEPS'),
path.resolve(__dirname, '../yarn.lock'),
path.resolve(__dirname, '../script/external-binaries.json'),
path.resolve(__dirname, '../script/sysroots.json')
]
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')
hasher.update(`HASH_VERSION:${HASH_VERSION}`)
for (const file of filesToHash) {
hasher.update(fs.readFileSync(file))
}
// Add the GCLIENT_EXTRA_ARGS variable to the hash
hasher.update(process.env.GCLIENT_EXTRA_ARGS || 'no_extra_args')
// Write the hash to disk
fs.writeFileSync(path.resolve(__dirname, '../.depshash'), hasher.digest('hex'))