If delete_dir or os.mkdir throw an exception then the code to restore
args.gn, build.ninja, and build.ninja.d will not run. This breaks a
design goal of gn which is that the args.gn files should not be
deleted.
The fix is to catch the exception and raise it after the files have
been restored.
To test the code leave chrome.exe or base_unittests.exe running in one
window and run this in another:
python build\clobber.py d:\src\chromium\src\out
Note that if you do this without the patch applied then all args.gn
files may be deleted, so consider backing them up. Also note that
args.gn files won't be restored unless build.ninja and build.ninja.d
files are also present, so back them up.
Just apply the patch first - it's easier.
BUG=612940
Review-Url: https://codereview.chromium.org/1996833002
Cr-Original-Commit-Position: refs/heads/master@{#395177}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 562df4f33e0a29669b83d451d33c81648a9e023e
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-Original-Commit-Position: refs/heads/master@{#382140}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: b0e768eae38f683886600ba869e31054273ebeab
This patch factors clobbering functionality from build/landmines.py
into build/clobber.py (new file). This will allow us to reuse existing
code in the cr tool.
BUG=493023
Review URL: https://codereview.chromium.org/1199933004
Cr-Original-Commit-Position: refs/heads/master@{#335491}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: af7f4c0efa1389e3989041b3f50a9f647fe2d478