diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-03 21:58:41 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-03 21:58:41 +0000 |
commit | b10a91eb470ed96162c448b5a83b364aab23efac (patch) | |
tree | a04e22756fd925d8b83cfbe18254bc3cceac4525 /build | |
parent | 342dc54fa5921029597093fe3f9adea67cc40d9b (diff) | |
download | chromium_src-b10a91eb470ed96162c448b5a83b364aab23efac.zip chromium_src-b10a91eb470ed96162c448b5a83b364aab23efac.tar.gz chromium_src-b10a91eb470ed96162c448b5a83b364aab23efac.tar.bz2 |
Add hook to clobber header files generated by grit on Windows.
This workarounds build problem with IncrediBuild.
TEST=none
http://crbug.com/17706
Review URL: http://codereview.chromium.org/159803
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22325 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build')
-rw-r--r-- | build/win/clobber_generated_headers.py | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/build/win/clobber_generated_headers.py b/build/win/clobber_generated_headers.py new file mode 100644 index 0000000..7b90b37 --- /dev/null +++ b/build/win/clobber_generated_headers.py @@ -0,0 +1,49 @@ +#!/usr/bin/python +# Copyright (c) 2009 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# This script helps workaround IncrediBuild problem on Windows. +# See http://crbug.com/17706. + +import os +import sys + +_SRC_PATH = os.path.join(os.path.dirname(__file__), '..', '..') + +sys.path.append(os.path.join(_SRC_PATH, 'tools', 'grit')) +import grit.grd_reader + +# We need to apply the workaround only on Windows. +if os.name != 'nt': + sys.exit(0) + +def total_split(path): + components = [] + while path: + head, tail = os.path.split(path) + components.append(tail) + path = head + return list(reversed(components)) + +for path in sys.argv[1:]: + path = os.path.join('src', path) + path_components = total_split(path) + root = grit.grd_reader.Parse(path) + output_files = [node.GetOutputFilename() for node in root.GetOutputFiles()] + output_headers = [file for file in output_files if file.endswith('.h')] + for build_type in ('Debug', 'Release'): + build_path = os.path.join(_SRC_PATH, 'chrome', build_type) + + # We guess target file output based on path of the grd file (the first + # path component after 'src'). + intermediate_path = os.path.join(build_path, 'obj', + 'global_intermediate', path_components[1]) + + for header in output_headers: + full_path = os.path.join(intermediate_path, header) + try: + os.remove(full_path) + print 'Clobbered ' + full_path + except OSError: + print 'Could not remove ' + full_path + '. Continuing.'
\ No newline at end of file |