OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """ | 6 """ |
7 This script runs every build as the first hook (See DEPS). If it detects that | 7 This script runs every build as the first hook (See DEPS). If it detects that |
8 the build should be clobbered, it will delete the contents of the build | 8 the build should be clobbered, it will delete the contents of the build |
9 directory. | 9 directory. |
10 | 10 |
11 A landmine is tripped when a builder checks out a different revision, and the | 11 A landmine is tripped when a builder checks out a different revision, and the |
12 diff between the new landmines and the old ones is non-null. At this point, the | 12 diff between the new landmines and the old ones is non-null. At this point, the |
13 build is clobbered. | 13 build is clobbered. |
| 14 |
| 15 Before adding or changing a landmine consider the consequences of doing so. |
| 16 Doing so will wipe out every output directory on every Chrome developer's |
| 17 machine. This can be particularly problematic on Windows where the directory |
| 18 deletion may well fail (locked files, command prompt in the directory, etc.), |
| 19 and generated .sln and .vcxproj files will be deleted. |
| 20 |
| 21 This output directory deletion will be repated when going back and forth across |
| 22 the change that added the landmine, adding to the cost. There are usually less |
| 23 troublesome alternatives. |
14 """ | 24 """ |
15 | 25 |
16 import difflib | 26 import difflib |
17 import errno | 27 import errno |
18 import gyp_environment | 28 import gyp_environment |
19 import logging | 29 import logging |
20 import optparse | 30 import optparse |
21 import os | 31 import os |
22 import sys | 32 import sys |
23 import subprocess | 33 import subprocess |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 proc = subprocess.Popen([sys.executable, s], stdout=subprocess.PIPE) | 139 proc = subprocess.Popen([sys.executable, s], stdout=subprocess.PIPE) |
130 output, _ = proc.communicate() | 140 output, _ = proc.communicate() |
131 landmines.extend([('%s\n' % l.strip()) for l in output.splitlines()]) | 141 landmines.extend([('%s\n' % l.strip()) for l in output.splitlines()]) |
132 clobber_if_necessary(landmines, options.src_dir) | 142 clobber_if_necessary(landmines, options.src_dir) |
133 | 143 |
134 return 0 | 144 return 0 |
135 | 145 |
136 | 146 |
137 if __name__ == '__main__': | 147 if __name__ == '__main__': |
138 sys.exit(main()) | 148 sys.exit(main()) |
OLD | NEW |