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

Unified Diff: build/gyp_chromium

Issue 214058: Create a separate function that returns the list of additional... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
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
===================================================================
--- build/gyp_chromium (revision 26811)
+++ build/gyp_chromium (working copy)
@@ -18,6 +18,35 @@
sys.path.append(os.path.join(chrome_src, 'tools', 'gyp', 'pylib'))
import gyp
+def additional_include_files(args=[]):
+ """
+ Returns a list of additional (.gypi) files to include, without
+ duplicating ones that are already specified on the command line.
+ """
+ # Determine the include files specified on 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:]))
+
+ result = []
+ def AddInclude(path):
+ if os.path.realpath(path) not in specified_includes:
+ result.append(path)
+
+ # Always include 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:
+ AddInclude(supplement)
+
+ return result
+
if __name__ == '__main__':
args = sys.argv[1:]
@@ -40,27 +69,8 @@
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:]))
+ args.extend(['-I' + i for i in additional_include_files(args)])
- def AddInclude(path):
- if os.path.realpath(path) not in specified_includes:
- args.append('-I' + path)
-
- # Always include 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:
- 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