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

Unified Diff: build/gyp_chromium

Issue 207004: Avoid gyp_chromium duplicating an include that's already in the command line. (Closed)
Patch Set: Created 11 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/gyp_chromium
diff --git a/build/gyp_chromium b/build/gyp_chromium
index 0d0d75ddd4ff3eeb78d7a6419c5a03cd080896c6..69dcddae4211b99efbad93681cc9cb0b7781384f 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()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698