diff options
author | brucedawson <brucedawson@chromium.org> | 2016-03-18 17:30:51 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-19 00:33:11 +0000 |
commit | b0e768eae38f683886600ba869e31054273ebeab (patch) | |
tree | 92d8cdc4a2c4e469bbd4fb3574f4476c0a4e2395 /build | |
parent | 43af555e8068ecc2af5dc6dcccbd5044b89b088a (diff) | |
download | chromium_src-b0e768eae38f683886600ba869e31054273ebeab.zip chromium_src-b0e768eae38f683886600ba869e31054273ebeab.tar.gz chromium_src-b0e768eae38f683886600ba869e31054273ebeab.tar.bz2 |
Use rmdir /s/q instead of flaky shutil.rmtree on Windows
For unknown reasons (Windows!) shutil.rmtree has been failing frequently
when the landmines change due to a toolchain change. This avoids the
the problem. This is necessary because manually deleting the 'out'
directory causes args.gn to get lost, which is a hassle.
This was noticed because the VS 2015 toolchain upgrades kept failing
to clobber the out directory on multiple machines.
Review URL: https://codereview.chromium.org/1812673003
Cr-Commit-Position: refs/heads/master@{#382140}
Diffstat (limited to 'build')
-rwxr-xr-x | build/clobber.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/build/clobber.py b/build/clobber.py index 785011a..c05f524 100755 --- a/build/clobber.py +++ b/build/clobber.py @@ -8,6 +8,7 @@ import argparse import os import shutil +import subprocess import sys @@ -35,11 +36,20 @@ def extract_gn_build_commands(build_ninja_file): return result +def delete_dir(build_dir): + # For unknown reasons (anti-virus?) rmtree of Chromium build directories + # often fails on Windows. + if sys.platform.startswith('win'): + subprocess.check_call(['rmdir', '/s', '/q', build_dir], shell=True) + else: + shutil.rmtree(build_dir) + + def delete_build_dir(build_dir): # GN writes a build.ninja.d file. Note that not all GN builds have args.gn. build_ninja_d_file = os.path.join(build_dir, 'build.ninja.d') if not os.path.exists(build_ninja_d_file): - shutil.rmtree(build_dir) + delete_dir(build_dir) return # GN builds aren't automatically regenerated when you sync. To avoid @@ -56,7 +66,7 @@ def delete_build_dir(build_dir): except IOError: args_contents = '' - shutil.rmtree(build_dir) + delete_dir(build_dir) # Put back the args file (if any). os.mkdir(build_dir) |