diff options
author | sgk@google.com <sgk@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-23 03:49:50 +0000 |
---|---|---|
committer | sgk@google.com <sgk@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-23 03:49:50 +0000 |
commit | ea832f7c6f6760c95e1029196f34f355ff69b38e (patch) | |
tree | 9af3a98cdd1f001a64e8ab5f6481d68b3b334461 /build | |
parent | cceb9e3d7e26c19b344bcbe84e6d08398653a306 (diff) | |
download | chromium_src-ea832f7c6f6760c95e1029196f34f355ff69b38e.zip chromium_src-ea832f7c6f6760c95e1029196f34f355ff69b38e.tar.gz chromium_src-ea832f7c6f6760c95e1029196f34f355ff69b38e.tar.bz2 |
Create a separate function that returns the list of additional
files to be included in the build (common.gypi and */supplement.gypi).
BUG=none
TEST=successful "gclient runhooks"
Review URL: http://codereview.chromium.org/214058
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26901 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build')
-rwxr-xr-x | build/gyp_chromium | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/build/gyp_chromium b/build/gyp_chromium index 69dcdda..ff7ba1b 100755 --- a/build/gyp_chromium +++ b/build/gyp_chromium @@ -18,6 +18,35 @@ chrome_src = os.path.normpath(os.path.join(script_dir, os.pardir)) 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,26 +69,7 @@ if __name__ == '__main__': 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 - 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) + args.extend(['-I' + i for i in additional_include_files(args)]) print 'Updating projects from gyp files...' sys.stdout.flush() |