diff options
author | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-16 23:16:05 +0000 |
---|---|---|
committer | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-16 23:16:05 +0000 |
commit | 94b0231a016f3136e8675d3532773342239977c3 (patch) | |
tree | 5d1ed6a64ad1e74f3c1e6d7e83c1596e7ed25e92 /build | |
parent | d1039ff56adb7ca0d9fcb1283e40a020a94e6943 (diff) | |
download | chromium_src-94b0231a016f3136e8675d3532773342239977c3.zip chromium_src-94b0231a016f3136e8675d3532773342239977c3.tar.gz chromium_src-94b0231a016f3136e8675d3532773342239977c3.tar.bz2 |
Avoid gyp_chromium duplicating an include that's already in the command line.
Fixes automatic makefile regeneration from duplicating gcc flags and causing a full rebuild each time.
BUG=none
TEST=make && touch chrome/chrome.gyp && make
Review URL: http://codereview.chromium.org/207004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26415 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build')
-rwxr-xr-x | build/gyp_chromium | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/build/gyp_chromium b/build/gyp_chromium index 0d0d75d..69dcdda 100755 --- a/build/gyp_chromium +++ b/build/gyp_chromium @@ -21,23 +21,45 @@ import gyp if __name__ == '__main__': args = sys.argv[1:] + # This could give false positives since it doesn't actually do real option + # parsing. Oh well. + gyp_file_specified = False + for arg in args: + if arg.endswith('.gyp'): + gyp_file_specified = True + break + # If we didn't get a file, check an env var, and then fall back to # assuming 'all.gyp' from the same directory as the script. - gyp_file = os.environ.get('CHROMIUM_GYP_FILE') - if gyp_file: - # Note that CHROMIUM_GYP_FILE values can't have backslashes as - # path separators even on Windows due to the use of shlex.split(). - args.extend(shlex.split(gyp_file)) - else: - args.append(os.path.join(script_dir, 'all.gyp')) + if not gyp_file_specified: + gyp_file = os.environ.get('CHROMIUM_GYP_FILE') + if gyp_file: + # Note that CHROMIUM_GYP_FILE values can't have backslashes as + # path separators even on Windows due to the use of shlex.split(). + args.extend(shlex.split(gyp_file)) + else: + args.append(os.path.join(script_dir, 'all.gyp')) + + # Avoid duplicating an include that's already in the command line. This + # doesn't cover all the different option formats you can use, but it's mainly + # intended to avoid duplicating flags on the automatic makefile regeneration + # which only uses this format. + specified_includes = set() + for arg in args: + if arg.startswith('-I') and len(arg) > 2: + specified_includes.add(os.path.realpath(arg[2:])) + + def AddInclude(path): + if os.path.realpath(path) not in specified_includes: + args.append('-I' + path) # Always include common.gypi - args += ['-I', os.path.join(script_dir, 'common.gypi')] + AddInclude(os.path.join(script_dir, 'common.gypi')) # Optionally add supplemental .gypi files if present. supplements = glob.glob(os.path.join(chrome_src, '*', 'supplement.gypi')) for supplement in supplements: - args += ['-I', supplement] + AddInclude(supplement) print 'Updating projects from gyp files...' sys.stdout.flush() |