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

Unified Diff: pylib/gyp/xcode_ninja.py

Issue 234843005: Add xcode_ninja_target_pattern to xcode-ninja generator (Closed) Base URL: http://gyp.googlecode.com/svn/trunk
Patch Set: Update flag names and comments Created 6 years, 8 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: pylib/gyp/xcode_ninja.py
diff --git a/pylib/gyp/xcode_ninja.py b/pylib/gyp/xcode_ninja.py
index c8867989a0d724ea812f35a589be6216c10ef36a..d04a039aae4ebe873b0e056bfe120b8482156f71 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_extras, target_whitelist, spec):
+ """Limit targets for Xcode wrapper.
+
+ Xcode seems to perform poorly with too many targets, so only include
+ proper executable targets, with filters to customize.
+ Arguments:
+ target_extras: Regular expression to always add, matching any target.
+ target_whitelist: Regular expression limiting executable targets.
+ spec: Specifications for target.
+ """
+ target_name = spec.get('target_name')
+ # Always include targets matching target_extras.
+ if target_extras is not None and re.search(target_extras, 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_whitelist is not None:
+ if not re.search(target_whitelist, target_name):
+ return False
+ return True
+ return False
+
def CreateWrapper(target_list, target_dicts, data, params):
"""Initialize targets for the ninja wrapper.
@@ -148,20 +174,20 @@ def CreateWrapper(target_list, target_dicts, data, params):
new_data[main_gyp]['xcode_settings'] = \
data[orig_gyp].get('xcode_settings', {})
+ # Normally the xcode-ninja generator only shows valid executable targets.
+ # If |xcode_ninja_target_whitelist| is set, only include executable targets
+ # that match it's regular expression will appear.
Mark Mentovai 2014/04/15 18:24:01 Can you reread and revise this sentence?
justincohen 2014/04/15 18:36:26 Done.
+ target_whitelist = generator_flags.get('xcode_ninja_target_whitelist', None)
+
+ # For including other non-executable targets, add the matching target name
+ # to the |xcode_ninja_target_extras| regular expression.
+ target_extras = generator_flags.get('xcode_ninja_target_extras', None)
+
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_extras, target_whitelist, 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)
« 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