2019-12-17 22:00:42 +00:00
|
|
|
/*
|
|
|
|
Usage:
|
|
|
|
|
|
|
|
$ node ./script/gn-check.js [--outDir=dirName]
|
|
|
|
*/
|
|
|
|
|
2024-10-03 02:10:44 +00:00
|
|
|
const minimist = require('minimist');
|
|
|
|
|
2023-06-22 14:21:42 +00:00
|
|
|
const cp = require('node:child_process');
|
|
|
|
const path = require('node:path');
|
2024-10-03 02:10:44 +00:00
|
|
|
|
|
|
|
const args = minimist(process.argv.slice(2), { string: ['outDir'] });
|
2019-08-30 17:37:02 +00:00
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
const { getOutDir } = require('./lib/utils');
|
2019-08-30 17:37:02 +00:00
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
const SOURCE_ROOT = path.normalize(path.dirname(__dirname));
|
|
|
|
const DEPOT_TOOLS = path.resolve(SOURCE_ROOT, '..', 'third_party', 'depot_tools');
|
2019-08-30 17:37:02 +00:00
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
const OUT_DIR = getOutDir({ outDir: args.outDir });
|
2019-08-30 17:37:02 +00:00
|
|
|
if (!OUT_DIR) {
|
2020-03-20 20:28:31 +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
|
|
|
}
|
|
|
|
|
2022-06-27 08:29:18 +00:00
|
|
|
const env = {
|
2019-08-30 17:37:02 +00:00
|
|
|
CHROMIUM_BUILDTOOLS_PATH: path.resolve(SOURCE_ROOT, '..', 'buildtools'),
|
2022-06-27 08:29:18 +00:00
|
|
|
DEPOT_TOOLS_WIN_TOOLCHAIN: '0',
|
|
|
|
...process.env
|
|
|
|
};
|
2019-08-30 17:37:02 +00:00
|
|
|
// Users may not have depot_tools in PATH.
|
2020-03-20 20:28:31 +00:00
|
|
|
env.PATH = `${env.PATH}${path.delimiter}${DEPOT_TOOLS}`;
|
2019-08-30 17:37:02 +00:00
|
|
|
|
|
|
|
const gnCheckDirs = [
|
|
|
|
'//electron:electron_lib',
|
|
|
|
'//electron:electron_app',
|
2024-08-12 08:28:33 +00:00
|
|
|
'//electron/shell/common:mojo',
|
|
|
|
'//electron/shell/common:plugin'
|
2020-03-20 20:28:31 +00:00
|
|
|
];
|
2019-08-30 17:37:02 +00:00
|
|
|
|
|
|
|
for (const dir of gnCheckDirs) {
|
2020-03-20 20:28:31 +00:00
|
|
|
const args = ['check', `../out/${OUT_DIR}`, dir];
|
|
|
|
const result = cp.spawnSync('gn', args, { env, stdio: 'inherit' });
|
|
|
|
if (result.status !== 0) process.exit(result.status);
|
2019-08-30 17:37:02 +00:00
|
|
|
}
|
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
process.exit(0);
|