2019-12-17 22:00:42 +00:00
|
|
|
/*
|
|
|
|
Usage:
|
|
|
|
|
|
|
|
$ node ./script/gn-check.js [--outDir=dirName]
|
|
|
|
*/
|
|
|
|
|
2019-08-30 17:37:02 +00:00
|
|
|
const cp = require('child_process')
|
|
|
|
const path = require('path')
|
2019-12-17 22:00:42 +00:00
|
|
|
const args = require('minimist')(process.argv.slice(2), { string: ['outDir'] })
|
2019-08-30 17:37:02 +00:00
|
|
|
|
|
|
|
const { getOutDir } = require('./lib/utils')
|
|
|
|
|
|
|
|
const SOURCE_ROOT = path.normalize(path.dirname(__dirname))
|
|
|
|
const DEPOT_TOOLS = path.resolve(SOURCE_ROOT, '..', 'third_party', 'depot_tools')
|
|
|
|
|
2019-12-17 22:00:42 +00:00
|
|
|
const OUT_DIR = getOutDir({ outDir: args.outDir })
|
2019-08-30 17:37:02 +00:00
|
|
|
if (!OUT_DIR) {
|
2020-03-20 15:12:18 +00:00
|
|
|
throw new Error('No viable out dir: one of Debug, Testing, or Release must exist.')
|
2019-08-30 17:37:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const env = Object.assign({
|
|
|
|
CHROMIUM_BUILDTOOLS_PATH: path.resolve(SOURCE_ROOT, '..', 'buildtools'),
|
|
|
|
DEPOT_TOOLS_WIN_TOOLCHAIN: '0'
|
|
|
|
}, process.env)
|
|
|
|
// Users may not have depot_tools in PATH.
|
|
|
|
env.PATH = `${env.PATH}${path.delimiter}${DEPOT_TOOLS}`
|
|
|
|
|
|
|
|
const gnCheckDirs = [
|
|
|
|
'//electron:electron_lib',
|
|
|
|
'//electron:electron_app',
|
|
|
|
'//electron:manifests',
|
|
|
|
'//electron/shell/common/api:mojo'
|
|
|
|
]
|
|
|
|
|
|
|
|
for (const dir of gnCheckDirs) {
|
|
|
|
const args = ['check', `../out/${OUT_DIR}`, dir]
|
|
|
|
const result = cp.spawnSync('gn', args, { env, stdio: 'inherit' })
|
|
|
|
if (result.status !== 0) process.exit(result.status)
|
|
|
|
}
|
|
|
|
|
|
|
|
process.exit(0)
|