From 7c995c10c08921378b6028d050c7dac36ff11667 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 24 Oct 2018 14:54:09 +0900 Subject: [PATCH] Add --force to bootstrap --- README.md | 2 +- bootstrap.js | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 91b0356..ff3c17e 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Scripts to help building Electron. Bootstrap: ``` -./bootstrap.js [--skip-gclient] [--args=""] [--target-arch=x64] [--verbose] +./bootstrap.js [--skip-gclient] [--force] [--args=""] [--target-arch=x64] [--verbose] ``` Build: diff --git a/bootstrap.js b/bootstrap.js index afffe31..52a27ef 100755 --- a/bootstrap.js +++ b/bootstrap.js @@ -7,11 +7,14 @@ const path = require('path') // Parse args. let skipGclient = false +let force = false let extraArgs = '' let targetCpu = 'x64' for (const arg of argv) { if (arg === '--skip-gclient') skipGclient = true + else if (arg === '--force') + force = true else if (arg.startsWith('--args=')) extraArgs = arg.substr(arg.indexOf('=') + 1) else if (arg.startsWith('--target-cpu=')) @@ -24,8 +27,12 @@ if (!fs.existsSync(path.join('vendor', 'depot_tools'))) execSync(`git clone ${DEPOT_TOOLS_URL} vendor/depot_tools`) // Getting the code. -if (!skipGclient) - execSync('gclient sync --with_branch_heads --with_tags') +if (!skipGclient) { + let args = '' + if (force) + args += ' --force' + execSync(`gclient sync --with_branch_heads --with_tags ${args}`) +} // Switch to src dir. process.chdir('src')