OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/python |
| 2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. |
| 5 |
| 6 # This script helps workaround IncrediBuild problem on Windows. |
| 7 # See http://crbug.com/17706. |
| 8 |
| 9 import os |
| 10 import sys |
| 11 |
| 12 _SRC_PATH = os.path.join(os.path.dirname(__file__), '..', '..') |
| 13 |
| 14 sys.path.append(os.path.join(_SRC_PATH, 'tools', 'grit')) |
| 15 import grit.grd_reader |
| 16 |
| 17 # We need to apply the workaround only on Windows. |
| 18 if os.name != 'nt': |
| 19 sys.exit(0) |
| 20 |
| 21 def total_split(path): |
| 22 components = [] |
| 23 while path: |
| 24 head, tail = os.path.split(path) |
| 25 components.append(tail) |
| 26 path = head |
| 27 return list(reversed(components)) |
| 28 |
| 29 for path in sys.argv[1:]: |
| 30 path = os.path.join('src', path) |
| 31 path_components = total_split(path) |
| 32 root = grit.grd_reader.Parse(path) |
| 33 output_files = [node.GetOutputFilename() for node in root.GetOutputFiles()] |
| 34 output_headers = [file for file in output_files if file.endswith('.h')] |
| 35 for build_type in ('Debug', 'Release'): |
| 36 build_path = os.path.join(_SRC_PATH, 'chrome', build_type) |
| 37 |
| 38 # We guess target file output based on path of the grd file (the first |
| 39 # path component after 'src'). |
| 40 intermediate_path = os.path.join(build_path, 'obj', |
| 41 'global_intermediate', path_components[1]) |
| 42 |
| 43 for header in output_headers: |
| 44 full_path = os.path.join(intermediate_path, header) |
| 45 try: |
| 46 os.remove(full_path) |
| 47 print 'Clobbered ' + full_path |
| 48 except OSError: |
| 49 print 'Could not remove ' + full_path + '. Continuing.' |
OLD | NEW |