Chromium Code Reviews| Index: pylib/gyp/xcode_ninja.py |
| diff --git a/pylib/gyp/xcode_ninja.py b/pylib/gyp/xcode_ninja.py |
| index c8867989a0d724ea812f35a589be6216c10ef36a..f99aacc2bcdb02605d6d43f57c3ccf9e82497682 100644 |
| --- a/pylib/gyp/xcode_ninja.py |
| +++ b/pylib/gyp/xcode_ninja.py |
| @@ -112,6 +112,32 @@ def _TargetFromSpec(old_spec, params): |
| ninja_target['actions'][0]['action'].extend(('-j', jobs)) |
| return ninja_target |
| +def IsValidTargetForWrapper(target_additions, target_filter, spec): |
| + """Limit targets for Xcode wrapper. |
| + |
| + Xcode seems to perform poorly with too many targets, so only included |
|
Mark Mentovai
2014/04/15 16:55:46
included -> include
justincohen
2014/04/15 17:21:05
Done.
|
| + proper executable targets, with filters to customize. |
| + Arguments: |
| + target_additions: Regular expression to always add, matching any target. |
| + target_filter: Regular expression limiting executable targets. |
| + spec: Specifications for target. |
| + """ |
| + target_name = spec.get('target_name') |
| + # Always include targets matching target_additions. |
| + if target_additions is not None and re.search(target_additions, target_name): |
| + return True |
| + |
| + # Otherwise just show executable targets. |
| + if spec.get('type', '') == 'executable' and \ |
| + spec.get('product_extension', '') != 'bundle': |
| + |
| + # If there is a filter and the target does not match, exclude the target. |
| + if target_filter is not None: |
| + if not re.search(target_filter, target_name): |
| + return False; |
| + return True; |
|
Mark Mentovai
2014/04/15 16:55:46
No semicolons. Previous and next lines too.
justincohen
2014/04/15 17:21:05
Done.
|
| + return False; |
| + |
| def CreateWrapper(target_list, target_dicts, data, params): |
| """Initialize targets for the ninja wrapper. |
| @@ -148,20 +174,14 @@ def CreateWrapper(target_list, target_dicts, data, params): |
| new_data[main_gyp]['xcode_settings'] = \ |
| data[orig_gyp].get('xcode_settings', {}) |
| + target_additions = generator_flags.get('xcode_ninja_target_additions', None) |
| + target_filter = generator_flags.get('xcode_ninja_target_filter', None) |
|
Mark Mentovai
2014/04/15 16:55:46
“filter” sounds like something that can filter to
justincohen
2014/04/15 17:21:05
Neither of these patters really mean exclude.
One
|
| + |
| for old_qualified_target in target_list: |
| spec = target_dicts[old_qualified_target] |
| - if spec.get('type', '') == 'executable' and \ |
| - spec.get('product_extension', '') != 'bundle': |
| - |
| + if IsValidTargetForWrapper(target_additions, target_filter, spec): |
| # Add to new_target_list. |
| target_name = spec.get('target_name') |
| - |
| - # Filter target names if requested. |
| - target_filter = generator_flags.get('xcode_ninja_target_filter', None) |
| - if target_filter is not None: |
| - if not re.search(target_filter, target_name): |
| - continue; |
| - |
| new_target_name = '%s:%s#target' % (main_gyp, target_name) |
| new_target_list.append(new_target_name) |