|
| 1 | +const cp = require('child_process') |
| 2 | +const path = require('path') |
| 3 | + |
| 4 | +const { getOutDir } = require('./lib/utils') |
| 5 | + |
| 6 | +const SOURCE_ROOT = path.normalize(path.dirname(__dirname)) |
| 7 | +const DEPOT_TOOLS = path.resolve(SOURCE_ROOT, '..', 'third_party', 'depot_tools') |
| 8 | +const OUT_DIR = getOutDir() |
| 9 | + |
| 10 | +if (!OUT_DIR) { |
| 11 | + throw new Error(`No viable out dir: one of Debug, Testing, or Release must exist.`) |
| 12 | +} |
| 13 | + |
| 14 | +const env = Object.assign({ |
| 15 | + CHROMIUM_BUILDTOOLS_PATH: path.resolve(SOURCE_ROOT, '..', 'buildtools'), |
| 16 | + DEPOT_TOOLS_WIN_TOOLCHAIN: '0' |
| 17 | +}, process.env) |
| 18 | +// Users may not have depot_tools in PATH. |
| 19 | +env.PATH = `${env.PATH}${path.delimiter}${DEPOT_TOOLS}` |
| 20 | + |
| 21 | +const gnCheckDirs = [ |
| 22 | + '//electron:electron_lib', |
| 23 | + '//electron:electron_app', |
| 24 | + '//electron:manifests', |
| 25 | + '//electron/shell/common/api:mojo' |
| 26 | +] |
| 27 | + |
| 28 | +for (const dir of gnCheckDirs) { |
| 29 | + const args = ['check', `../out/${OUT_DIR}`, dir] |
| 30 | + const result = cp.spawnSync('gn', args, { env, stdio: 'inherit' }) |
| 31 | + if (result.status !== 0) process.exit(result.status) |
| 32 | +} |
| 33 | + |
| 34 | +process.exit(0) |
0 commit comments