0
Commit Graph

5 Commits

Author SHA1 Message Date
Sylvain Defresne
dfbbade3b1 Fix src/build/clobber.py
The build.ninja file generated by ninja has changed and now
include a "ninja_required_version" statement. To keep the
rule to generate the build.ninja file, all the line up to
the third blank line should be kept (this is what "gn clean"
does).

Bug: 830627
Change-Id: I493cc39f484c6da8a0784d9cf2b45337cb4672d3
Reviewed-on: https://chromium-review.googlesource.com/1001902
Reviewed-by: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#549181}
2018-04-09 15:32:48 +00:00
sfiera
29acddfbe7 Don't clobber symlinks to build directories
Background: in order to use multiple build directories without the
cognitive or scripting overhead of figuring out which one is currently
in use, I keep a symlink "out/cur" pointing to the current one.

When the clobber script runs, it detects that out/cur is a build
directory (because out/cur/args.gn exists) but shutil.rmtree() fails
when applied to a symlink. This change skips the clobber when a link is
detected and leaves out/cur pointing to the real build dir. There's no
need to remove the symlink, since the original has been clobbered.

Review-Url: https://codereview.chromium.org/2642833002
Cr-Commit-Position: refs/heads/master@{#444777}
2017-01-19 17:42:58 +00:00
brucedawson
562df4f33e Fix clobber.py to restore args.gn on failure
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-Commit-Position: refs/heads/master@{#395177}
2016-05-20 22:02:33 +00:00
brucedawson
b0e768eae3 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}
2016-03-19 00:33:11 +00:00
petrcermak
af7f4c0efa Factor clobber out of build/landmines.py
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-Commit-Position: refs/heads/master@{#335491}
2015-06-22 12:42:23 +00:00