Add optional verbose switch '-v' to build script. (#12118)
* Add optional verbose switch '-v' to build script. * Remove tracer comment. * Add --ninja-path switch. For compatiblity with https://github.com/electron/electron/pull/12120
This commit is contained in:
parent
e9808d138f
commit
642dc96956
1 changed files with 26 additions and 7 deletions
|
@ -5,7 +5,8 @@ import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from lib.config import MIPS64EL_GCC, get_target_arch, build_env
|
from lib.config import MIPS64EL_GCC, get_target_arch, build_env, \
|
||||||
|
enable_verbose_mode, is_verbose_mode
|
||||||
from lib.util import electron_gyp, import_vs_env
|
from lib.util import electron_gyp, import_vs_env
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,14 +21,25 @@ GCLIENT_DONE = os.path.join(SOURCE_ROOT, '.gclient_done')
|
||||||
def main():
|
def main():
|
||||||
os.chdir(SOURCE_ROOT)
|
os.chdir(SOURCE_ROOT)
|
||||||
|
|
||||||
|
args = parse_args()
|
||||||
|
if args.verbose:
|
||||||
|
enable_verbose_mode()
|
||||||
|
|
||||||
# Update the VS build env.
|
# Update the VS build env.
|
||||||
import_vs_env(get_target_arch())
|
import_vs_env(get_target_arch())
|
||||||
|
|
||||||
ninja = os.path.join('vendor', 'depot_tools', 'ninja')
|
# decide which ninja executable to use
|
||||||
|
ninja_path = args.ninja_path
|
||||||
|
if not ninja_path:
|
||||||
|
ninja_path = os.path.join('vendor', 'depot_tools', 'ninja')
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
ninja += '.exe'
|
ninja_path += '.exe'
|
||||||
|
|
||||||
|
# decide how to invoke ninja
|
||||||
|
ninja = [ninja_path]
|
||||||
|
if is_verbose_mode():
|
||||||
|
ninja.append('-v')
|
||||||
|
|
||||||
args = parse_args()
|
|
||||||
if args.libcc:
|
if args.libcc:
|
||||||
if ('D' not in args.configuration
|
if ('D' not in args.configuration
|
||||||
or not os.path.exists(GCLIENT_DONE)
|
or not os.path.exists(GCLIENT_DONE)
|
||||||
|
@ -39,12 +51,12 @@ def main():
|
||||||
script = os.path.join(LIBCC_SOURCE_ROOT, 'script', 'build')
|
script = os.path.join(LIBCC_SOURCE_ROOT, 'script', 'build')
|
||||||
subprocess.check_call([sys.executable, script, '-D', '-t',
|
subprocess.check_call([sys.executable, script, '-D', '-t',
|
||||||
get_target_arch()])
|
get_target_arch()])
|
||||||
subprocess.check_call([ninja, '-C', LIBCC_DIST_MAIN])
|
subprocess.check_call(ninja + ['-C', LIBCC_DIST_MAIN])
|
||||||
|
|
||||||
env = build_env()
|
env = build_env()
|
||||||
for config in args.configuration:
|
for config in args.configuration:
|
||||||
build_path = os.path.join('out', config[0])
|
build_path = os.path.join('out', config[0])
|
||||||
ret = subprocess.call([ninja, '-C', build_path, args.target], env=env)
|
ret = subprocess.call(ninja + ['-C', build_path, args.target], env=env)
|
||||||
if ret != 0:
|
if ret != 0:
|
||||||
sys.exit(ret)
|
sys.exit(ret)
|
||||||
|
|
||||||
|
@ -56,6 +68,10 @@ def parse_args():
|
||||||
nargs='+',
|
nargs='+',
|
||||||
default=CONFIGURATIONS,
|
default=CONFIGURATIONS,
|
||||||
required=False)
|
required=False)
|
||||||
|
parser.add_argument('-v', '--verbose',
|
||||||
|
action='store_true',
|
||||||
|
default=False,
|
||||||
|
help='Verbose output')
|
||||||
parser.add_argument('-t', '--target',
|
parser.add_argument('-t', '--target',
|
||||||
help='Build specified target',
|
help='Build specified target',
|
||||||
default=electron_gyp()['project_name%'],
|
default=electron_gyp()['project_name%'],
|
||||||
|
@ -67,6 +83,9 @@ def parse_args():
|
||||||
'-d --debug_libchromiumcontent.'
|
'-d --debug_libchromiumcontent.'
|
||||||
),
|
),
|
||||||
action='store_true', default=False)
|
action='store_true', default=False)
|
||||||
|
parser.add_argument('--ninja-path',
|
||||||
|
help='Path of ninja command to use.',
|
||||||
|
required=False)
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue