Solve some PATH issues on Windows

This commit is contained in:
Cheng Zhao 2018-10-24 16:43:49 +09:00
Родитель 7c995c10c0
Коммит 894260e079
2 изменённых файлов: 22 добавлений и 4 удалений

8
bootstrap.js поставляемый
Просмотреть файл

@ -28,10 +28,12 @@ if (!fs.existsSync(path.join('vendor', 'depot_tools')))
// Getting the code.
if (!skipGclient) {
let args = ''
let args = '--with_branch_heads --with_tags'
if (force)
args += ' --force'
execSync(`gclient sync --with_branch_heads --with_tags ${args}`)
// Calling gclient directly would invoke gclient.bat on Windows, which does
// not work prefectly under some shells.
execSync(`python vendor/depot_tools/gclient.py sync ${args}`)
}
// Switch to src dir.
@ -47,5 +49,5 @@ const sccachePath = path.resolve('electron', 'external_binaries', 'sccache')
for (const name in configs) {
const config = targetCpu === 'x64' ? name : `${name}_${targetCpu}`
const gnArgs = `import("//electron/build/args/${configs[name]}.gn") ${extraArgs} target_cpu="${targetCpu}" cc_wrapper="${sccachePath}"`
spawnSync('gn', ['gen', `out/${config}`, `--args=${gnArgs}`])
spawnSync('python', ['third_party/depot_tools/gn.py', 'gen', `out/${config}`, `--args=${gnArgs}`])
}

Просмотреть файл

@ -23,8 +23,24 @@ process.env.DEPOT_TOOLS_WIN_TOOLCHAIN = 0
process.env.SCCACHE_BUCKET = 'electronjs-sccache'
process.env.SCCACHE_TWO_TIER = 'true'
// Paths to toolchains.
// Help gn.py find the exe.
process.env.CHROMIUM_BUILDTOOLS_PATH = path.resolve('src', 'buildtools')
// Cleanup the cygwin paths in PATH, otherwise vpython will not work.
if (process.platform === 'win32') {
let newPaths = []
const paths = process.env.PATH.split(path.delimiter)
for (const p of paths) {
if (p.startsWith('/'))
continue
if (p.includes('cygwin'))
continue
newPaths.push(p)
}
process.env.PATH = newPaths.join(path.delimiter)
}
// Add depot_tools to PATH.
process.env.PATH = `${path.resolve('vendor', 'depot_tools')}${path.delimiter}${process.env.PATH}`
if (process.platform === 'win32') {