Commit dc0dfa4e authored by Bruce Dawson's avatar Bruce Dawson Committed by Commit Bot

Make generate_def_files.py on Windows more robust

It is now possible to run generate_def_files.py on Windows (although the
results don't match those on Linux) but it is error prone. If you run
the script under Python 3 or without dumpbin in the path then it will
fail without a clear explanation. This adds diagnostic messages for
these two conditions.

Bug: 1046390
Change-Id: I8e1d4815c77e3ec9b4edca2a2cb78484ade1fe7c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2392951
Auto-Submit: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: default avatarMirko Bonadei <mbonadei@chromium.org>
Commit-Queue: Mirko Bonadei <mbonadei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#804616}
parent e682d437
......@@ -76,6 +76,10 @@ def _GenerateDefFile(cpu, is_debug, extra_gn_args=[], suffix=None):
gn = 'gn.bat'
autoninja = 'autoninja.bat'
symbol_dumper = ['dumpbin', '/symbols']
import shutil
if not shutil.which('dumpbin'):
logging.error('dumpbin not found. Run tools\win\setenv.bat.')
exit(1)
with tempfile.TemporaryDirectory() as out_dir:
logging.info('[%s - %s] Creating tmp out dir in %s', cpu, flavor, out_dir)
subprocess.check_call([gn, 'gen', out_dir, '--args=' + ' '.join(gn_args)],
......@@ -153,6 +157,10 @@ def _GenerateDefFile(cpu, is_debug, extra_gn_args=[], suffix=None):
if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
if sys.version_info.major == 2:
logging.error('This script requires Python 3.')
exit(1)
if not os.getcwd().endswith('src') or not os.path.exists('chrome/browser'):
logging.error('Run this script from a chromium/src/ directory.')
exit(1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment