OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 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 # This script helps workaround IncrediBuild problem on Windows. | 6 # This script helps workaround IncrediBuild problem on Windows. |
7 # See http://crbug.com/17706. | 7 # See http://crbug.com/17706. |
8 | 8 |
9 import os | 9 import os |
10 import sys | 10 import sys |
(...skipping 25 matching lines...) Expand all Loading... |
36 except grit.exception.Base, exc: | 36 except grit.exception.Base, exc: |
37 # This hook exploded badly a few times on the buildbot with exception | 37 # This hook exploded badly a few times on the buildbot with exception |
38 # at this point. Do not exit with an error, just print more information | 38 # at this point. Do not exit with an error, just print more information |
39 # for debugging. | 39 # for debugging. |
40 # TODO(phajdan.jr): Make exception fatal when the root cause is fixed. | 40 # TODO(phajdan.jr): Make exception fatal when the root cause is fixed. |
41 print 'Unexpected GRIT exception while processing ' + path | 41 print 'Unexpected GRIT exception while processing ' + path |
42 print exc | 42 print exc |
43 continue | 43 continue |
44 output_files = [node.GetOutputFilename() for node in root.GetOutputFiles()] | 44 output_files = [node.GetOutputFilename() for node in root.GetOutputFiles()] |
45 output_headers = [file for file in output_files if file.endswith('.h')] | 45 output_headers = [file for file in output_files if file.endswith('.h')] |
46 for build_type in ('Debug', 'Release'): | 46 # Build output can be in any subdirectory of src. |
47 build_path = os.path.join(_SRC_PATH, 'chrome', build_type) | 47 paths = [d for d in os.listdir(_SRC_PATH) if |
| 48 os.path.isdir(os.path.join(_SRC_PATH, d))] |
| 49 for out_dir in paths: |
| 50 for build_type in ('Debug', 'Release'): |
| 51 build_path = os.path.join(_SRC_PATH, out_dir, build_type) |
48 | 52 |
49 # We guess target file output based on path of the grd file (the first | 53 # We guess target file output based on path of the grd file (the first |
50 # path component after 'src'). | 54 # path component after 'src'). |
51 intermediate_path = os.path.join(build_path, 'obj', | 55 intermediate_path = os.path.join(build_path, 'obj', |
52 'global_intermediate', path_components[1]) | 56 'global_intermediate', path_components[1]) |
53 | 57 |
54 for header in output_headers: | 58 for header in output_headers: |
55 full_path = os.path.normpath(os.path.join(intermediate_path, header)) | 59 full_path = os.path.normpath(os.path.join(intermediate_path, header)) |
56 if os.path.exists(full_path): | 60 if os.path.exists(full_path): |
57 try: | 61 try: |
58 os.remove(full_path) | 62 os.remove(full_path) |
59 except OSError, e: | 63 except OSError, e: |
60 fmt = 'Could not remove %s: %s. Continuing.\n' | 64 fmt = 'Could not remove %s: %s. Continuing.\n' |
61 sys.stderr.write(fmt % (full_path, e)) | 65 sys.stderr.write(fmt % (full_path, e)) |
62 else: | 66 else: |
63 print 'Clobbered ' + full_path | 67 print 'Clobbered ' + full_path |
OLD | NEW |