| 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 12 matching lines...) Expand all Loading... |
| 23 components = [] | 23 components = [] |
| 24 while path: | 24 while path: |
| 25 head, tail = os.path.split(path) | 25 head, tail = os.path.split(path) |
| 26 if not tail: | 26 if not tail: |
| 27 break | 27 break |
| 28 components.append(tail) | 28 components.append(tail) |
| 29 path = head | 29 path = head |
| 30 return list(reversed(components)) | 30 return list(reversed(components)) |
| 31 | 31 |
| 32 for path in sys.argv[1:]: | 32 for path in sys.argv[1:]: |
| 33 path = os.path.join('src', path) | |
| 34 path_components = total_split(path) | 33 path_components = total_split(path) |
| 35 try: | 34 try: |
| 36 root = grit.grd_reader.Parse(path) | 35 root = grit.grd_reader.Parse(path) |
| 37 except grit.exception.Base, exc: | 36 except grit.exception.Base, exc: |
| 38 # 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 |
| 39 # 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 |
| 40 # for debugging. | 39 # for debugging. |
| 41 # 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. |
| 42 print 'Unexpected GRIT exception while processing ' + path | 41 print 'Unexpected GRIT exception while processing ' + path |
| 43 print exc | 42 print exc |
| 44 continue | 43 continue |
| 45 output_files = [node.GetOutputFilename() for node in root.GetOutputFiles()] | 44 output_files = [node.GetOutputFilename() for node in root.GetOutputFiles()] |
| 46 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')] |
| 47 for build_type in ('Debug', 'Release'): | 46 for build_type in ('Debug', 'Release'): |
| 48 build_path = os.path.join(_SRC_PATH, 'chrome', build_type) | 47 build_path = os.path.join(_SRC_PATH, 'chrome', build_type) |
| 49 | 48 |
| 50 # We guess target file output based on path of the grd file (the first | 49 # We guess target file output based on path of the grd file (the first |
| 51 # path component after 'src'). | 50 # path component after 'src'). |
| 52 intermediate_path = os.path.join(build_path, 'obj', | 51 intermediate_path = os.path.join(build_path, 'obj', |
| 53 'global_intermediate', path_components[1]) | 52 'global_intermediate', path_components[1]) |
| 54 | 53 |
| 55 for header in output_headers: | 54 for header in output_headers: |
| 56 full_path = os.path.join(intermediate_path, header) | 55 full_path = os.path.join(intermediate_path, header) |
| 57 try: | 56 try: |
| 58 os.remove(full_path) | 57 os.remove(full_path) |
| 59 print 'Clobbered ' + full_path | 58 print 'Clobbered ' + full_path |
| 60 except OSError: | 59 except OSError: |
| 61 print 'Could not remove ' + full_path + '. Continuing.' | 60 print 'Could not remove ' + full_path + '. Continuing.' |
| OLD | NEW |