Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(373)

Side by Side Diff: build/win/clobber_generated_headers.py

Issue 159866: Re-enable the grit hook, and make it more solid in case of failures.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« DEPS ('K') | « DEPS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 11
12 _SRC_PATH = os.path.join(os.path.dirname(__file__), '..', '..') 12 _SRC_PATH = os.path.join(os.path.dirname(__file__), '..', '..')
13 13
14 sys.path.append(os.path.join(_SRC_PATH, 'tools', 'grit')) 14 sys.path.append(os.path.join(_SRC_PATH, 'tools', 'grit'))
15 import grit.exception
15 import grit.grd_reader 16 import grit.grd_reader
16 17
17 # We need to apply the workaround only on Windows. 18 # We need to apply the workaround only on Windows.
18 if os.name != 'nt': 19 if os.name != 'nt':
19 sys.exit(0) 20 sys.exit(0)
20 21
21 def total_split(path): 22 def total_split(path):
22 components = [] 23 components = []
23 while path: 24 while path:
24 head, tail = os.path.split(path) 25 head, tail = os.path.split(path)
25 if not tail: 26 if not tail:
26 break 27 break
27 components.append(tail) 28 components.append(tail)
28 path = head 29 path = head
29 return list(reversed(components)) 30 return list(reversed(components))
30 31
31 for path in sys.argv[1:]: 32 for path in sys.argv[1:]:
32 path = os.path.join('src', path) 33 path = os.path.join('src', path)
33 path_components = total_split(path) 34 path_components = total_split(path)
34 root = grit.grd_reader.Parse(path) 35 try:
36 root = grit.grd_reader.Parse(path)
37 except grit.exception.Base, exc:
38 # 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
40 # for debugging.
41 # TODO(phajdan.jr): Make exception fatal when the root cause is fixed.
42 print 'Unexpected GRIT exception while processing ' + path
43 print exc
44 continue
35 output_files = [node.GetOutputFilename() for node in root.GetOutputFiles()] 45 output_files = [node.GetOutputFilename() for node in root.GetOutputFiles()]
36 output_headers = [file for file in output_files if file.endswith('.h')] 46 output_headers = [file for file in output_files if file.endswith('.h')]
37 for build_type in ('Debug', 'Release'): 47 for build_type in ('Debug', 'Release'):
38 build_path = os.path.join(_SRC_PATH, 'chrome', build_type) 48 build_path = os.path.join(_SRC_PATH, 'chrome', build_type)
39 49
40 # We guess target file output based on path of the grd file (the first 50 # We guess target file output based on path of the grd file (the first
41 # path component after 'src'). 51 # path component after 'src').
42 intermediate_path = os.path.join(build_path, 'obj', 52 intermediate_path = os.path.join(build_path, 'obj',
43 'global_intermediate', path_components[1]) 53 'global_intermediate', path_components[1])
44 54
45 for header in output_headers: 55 for header in output_headers:
46 full_path = os.path.join(intermediate_path, header) 56 full_path = os.path.join(intermediate_path, header)
47 try: 57 try:
48 os.remove(full_path) 58 os.remove(full_path)
49 print 'Clobbered ' + full_path 59 print 'Clobbered ' + full_path
50 except OSError: 60 except OSError:
51 print 'Could not remove ' + full_path + '. Continuing.' 61 print 'Could not remove ' + full_path + '. Continuing.'
OLDNEW
« DEPS ('K') | « DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698