automate-git: Windows: Patch VS toolchain scripts before runhooks

Split `gclient sync` into separate `gclient sync --nohooks` and
`gclient runhooks` steps so that we can optionally apply patches
from `runhooks.patch` in-between. This is necessary because the
src/tools/clang/scripts/update.py script is run via a hook and has
dependencies on the VS toolchain scripts which must be patched to
properly consider the GYP_MSVS_VERSION environment variable.
This commit is contained in:
Marshall Greenblatt
2020-03-04 15:00:17 -05:00
parent 9d9ee8b45f
commit 06a5ef3cd8
4 changed files with 103 additions and 81 deletions

View File

@ -295,7 +295,7 @@ def remove_deps_entry(path, entry):
def apply_deps_patch():
""" Patch the Chromium DEPS file if necessary. """
""" Patch the Chromium DEPS file before `gclient sync` if necessary. """
# Starting with 43.0.2357.126 the DEPS file is now 100% Git and the .DEPS.git
# file is no longer created. Look for the older file first in case we're
# building an older branch version.
@ -325,6 +325,17 @@ def apply_deps_patch():
raise Exception("Path does not exist: %s" % (deps_path))
def apply_runhooks_patch():
""" Patch the Chromium runhooks files before `gclient runhooks` if necessary. """
patch_file = os.path.join(cef_dir, 'patch', 'patches', 'runhooks')
if os.path.exists(patch_file + ".patch"):
# Attempt to apply the runhooks patch file.
patch_tool = os.path.join(cef_dir, 'tools', 'patcher.py')
run('%s %s --patch-file "%s" --patch-dir "%s"' %
(python_exe, patch_tool, patch_file,
chromium_src_dir), chromium_src_dir, depot_tools_dir)
def run_patch_updater(args='', output_file=None):
""" Run the patch updater script. """
tool = os.path.join(cef_src_dir, 'tools', 'patch_updater.py')
@ -1452,9 +1463,15 @@ if chromium_checkout_changed:
os.environ['GYP_CHROMIUM_NO_ACTION'] = '1'
# Update third-party dependencies including branch/tag information.
run("gclient sync %s--with_branch_heads --jobs 16" % \
run("gclient sync %s--nohooks --with_branch_heads --jobs 16" % \
('--reset ' if discard_local_changes else ''), chromium_dir, depot_tools_dir)
# Patch the Chromium runhooks scripts if necessary.
apply_runhooks_patch()
# Runs hooks for files that have been modified in the local working copy.
run("gclient runhooks --jobs 16", chromium_dir, depot_tools_dir)
# Clear the GYP_CHROMIUM_NO_ACTION value.
del os.environ['GYP_CHROMIUM_NO_ACTION']