Skip to content
Snippets Groups Projects
Commit ea832f7c authored by sgk@google.com's avatar sgk@google.com
Browse files

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
parent cceb9e3d
No related branches found
No related tags found
No related merge requests found
...@@ -18,6 +18,35 @@ chrome_src = os.path.normpath(os.path.join(script_dir, os.pardir)) ...@@ -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')) sys.path.append(os.path.join(chrome_src, 'tools', 'gyp', 'pylib'))
import gyp 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__': if __name__ == '__main__':
args = sys.argv[1:] args = sys.argv[1:]
...@@ -40,26 +69,7 @@ if __name__ == '__main__': ...@@ -40,26 +69,7 @@ if __name__ == '__main__':
else: else:
args.append(os.path.join(script_dir, 'all.gyp')) args.append(os.path.join(script_dir, 'all.gyp'))
# Avoid duplicating an include that's already in the command line. This args.extend(['-I' + i for i in additional_include_files(args)])
# 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)
print 'Updating projects from gyp files...' print 'Updating projects from gyp files...'
sys.stdout.flush() sys.stdout.flush()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment