| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 the V8 project authors. All rights reserved. | 2 # Copyright 2014 the V8 project 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 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 except OSError as e: | 159 except OSError as e: |
| 160 if e.errno == errno.EEXIST: | 160 if e.errno == errno.EEXIST: |
| 161 pass | 161 pass |
| 162 | 162 |
| 163 if needs_clobber(landmines_path, new_landmines): | 163 if needs_clobber(landmines_path, new_landmines): |
| 164 # Clobber contents of build directory but not directory itself: some | 164 # Clobber contents of build directory but not directory itself: some |
| 165 # checkouts have the build directory mounted. | 165 # checkouts have the build directory mounted. |
| 166 for f in os.listdir(out_dir): | 166 for f in os.listdir(out_dir): |
| 167 path = os.path.join(out_dir, f) | 167 path = os.path.join(out_dir, f) |
| 168 if os.path.basename(out_dir) == 'build': | 168 if os.path.basename(out_dir) == 'build': |
| 169 # Soft version of chromium's clobber. Only delete build directories not | 169 # Only delete build directories and files for MSVS builds as the folder |
| 170 # files in windows' build dir as the folder shares some checked out | 170 # shares some checked out files and directories. |
| 171 # files and directories. | |
| 172 if (os.path.isdir(path) and | 171 if (os.path.isdir(path) and |
| 173 re.search(r'(?:[Rr]elease)|(?:[Dd]ebug)', f)): | 172 re.search(r'(?:[Rr]elease)|(?:[Dd]ebug)', f)): |
| 174 delete_build_dir(path) | 173 delete_build_dir(path) |
| 174 elif (os.path.isfile(path) and |
| 175 (path.endswith('.sln') or |
| 176 path.endswith('.vcxproj') or |
| 177 path.endswith('.vcxproj.user'))): |
| 178 os.unlink(path) |
| 175 else: | 179 else: |
| 176 if os.path.isfile(path): | 180 if os.path.isfile(path): |
| 177 os.unlink(path) | 181 os.unlink(path) |
| 178 elif os.path.isdir(path): | 182 elif os.path.isdir(path): |
| 179 delete_build_dir(path) | 183 delete_build_dir(path) |
| 184 if os.path.basename(out_dir) == 'xcodebuild': |
| 185 # Xcodebuild puts an additional project file structure into build, |
| 186 # while the output folder is xcodebuild. |
| 187 project_dir = os.path.join(SRC_DIR, 'build', 'all.xcodeproj') |
| 188 if os.path.exists(project_dir) and os.path.isdir(project_dir): |
| 189 delete_build_dir(project_dir) |
| 180 | 190 |
| 181 # Save current set of landmines for next time. | 191 # Save current set of landmines for next time. |
| 182 with open(landmines_path, 'w') as f: | 192 with open(landmines_path, 'w') as f: |
| 183 f.writelines(new_landmines) | 193 f.writelines(new_landmines) |
| 184 | 194 |
| 185 | 195 |
| 186 def process_options(): | 196 def process_options(): |
| 187 """Returns a list of landmine emitting scripts.""" | 197 """Returns a list of landmine emitting scripts.""" |
| 188 parser = optparse.OptionParser() | 198 parser = optparse.OptionParser() |
| 189 parser.add_option( | 199 parser.add_option( |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 proc = subprocess.Popen([sys.executable, s], stdout=subprocess.PIPE) | 236 proc = subprocess.Popen([sys.executable, s], stdout=subprocess.PIPE) |
| 227 output, _ = proc.communicate() | 237 output, _ = proc.communicate() |
| 228 landmines.extend([('%s\n' % l.strip()) for l in output.splitlines()]) | 238 landmines.extend([('%s\n' % l.strip()) for l in output.splitlines()]) |
| 229 clobber_if_necessary(landmines) | 239 clobber_if_necessary(landmines) |
| 230 | 240 |
| 231 return 0 | 241 return 0 |
| 232 | 242 |
| 233 | 243 |
| 234 if __name__ == '__main__': | 244 if __name__ == '__main__': |
| 235 sys.exit(main()) | 245 sys.exit(main()) |
| OLD | NEW |