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

Side by Side Diff: pylib/gyp/xcode_ninja.py

Issue 1410113002: Make ninja work with XCTests for iOS. (Closed) Base URL: https://chromium.googlesource.com/external/gyp@master
Patch Set: make work without certs Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 # Copyright (c) 2014 Google Inc. All rights reserved. 1 # Copyright (c) 2014 Google Inc. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Xcode-ninja wrapper project file generator. 5 """Xcode-ninja wrapper project file generator.
6 6
7 This updates the data structures passed to the Xcode gyp generator to build 7 This updates the data structures passed to the Xcode gyp generator to build
8 with ninja instead. The Xcode project itself is transformed into a list of 8 with ninja instead. The Xcode project itself is transformed into a list of
9 executable targets, each with a build step to build with ninja, and a target 9 executable targets, each with a build step to build with ninja, and a target
10 with every source and resource file. This appears to sidestep some of the 10 with every source and resource file. This appears to sidestep some of the
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 "%s/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)" % ninja_toplevel 85 "%s/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)" % ninja_toplevel
86 86
87 if 'configurations' in old_spec: 87 if 'configurations' in old_spec:
88 for config in old_spec['configurations'].iterkeys(): 88 for config in old_spec['configurations'].iterkeys():
89 old_xcode_settings = \ 89 old_xcode_settings = \
90 old_spec['configurations'][config].get('xcode_settings', {}) 90 old_spec['configurations'][config].get('xcode_settings', {})
91 if 'IPHONEOS_DEPLOYMENT_TARGET' in old_xcode_settings: 91 if 'IPHONEOS_DEPLOYMENT_TARGET' in old_xcode_settings:
92 new_xcode_settings['CODE_SIGNING_REQUIRED'] = "NO" 92 new_xcode_settings['CODE_SIGNING_REQUIRED'] = "NO"
93 new_xcode_settings['IPHONEOS_DEPLOYMENT_TARGET'] = \ 93 new_xcode_settings['IPHONEOS_DEPLOYMENT_TARGET'] = \
94 old_xcode_settings['IPHONEOS_DEPLOYMENT_TARGET'] 94 old_xcode_settings['IPHONEOS_DEPLOYMENT_TARGET']
95 for key in ['BUNDLE_LOADER', 'TEST_HOST']:
96 if key in old_xcode_settings:
97 new_xcode_settings[key] = old_xcode_settings[key]
98
95 ninja_target['configurations'][config] = {} 99 ninja_target['configurations'][config] = {}
96 ninja_target['configurations'][config]['xcode_settings'] = \ 100 ninja_target['configurations'][config]['xcode_settings'] = \
97 new_xcode_settings 101 new_xcode_settings
98 102
99 ninja_target['mac_bundle'] = old_spec.get('mac_bundle', 0) 103 ninja_target['mac_bundle'] = old_spec.get('mac_bundle', 0)
104 ninja_target['mac_xctest_bundle'] = old_spec.get('mac_xctest_bundle', 0)
100 ninja_target['ios_app_extension'] = old_spec.get('ios_app_extension', 0) 105 ninja_target['ios_app_extension'] = old_spec.get('ios_app_extension', 0)
101 ninja_target['ios_watchkit_extension'] = \ 106 ninja_target['ios_watchkit_extension'] = \
102 old_spec.get('ios_watchkit_extension', 0) 107 old_spec.get('ios_watchkit_extension', 0)
103 ninja_target['ios_watchkit_app'] = old_spec.get('ios_watchkit_app', 0) 108 ninja_target['ios_watchkit_app'] = old_spec.get('ios_watchkit_app', 0)
104 ninja_target['type'] = old_spec['type'] 109 ninja_target['type'] = old_spec['type']
105 if ninja_toplevel: 110 if ninja_toplevel:
106 ninja_target['actions'] = [ 111 ninja_target['actions'] = [
107 { 112 {
108 'action_name': 'Compile and copy %s via ninja' % target_name, 113 'action_name': 'Compile and copy %s via ninja' % target_name,
109 'inputs': [], 114 'inputs': [],
(...skipping 21 matching lines...) Expand all
131 Arguments: 136 Arguments:
132 target_extras: Regular expression to always add, matching any target. 137 target_extras: Regular expression to always add, matching any target.
133 executable_target_pattern: Regular expression limiting executable targets. 138 executable_target_pattern: Regular expression limiting executable targets.
134 spec: Specifications for target. 139 spec: Specifications for target.
135 """ 140 """
136 target_name = spec.get('target_name') 141 target_name = spec.get('target_name')
137 # Always include targets matching target_extras. 142 # Always include targets matching target_extras.
138 if target_extras is not None and re.search(target_extras, target_name): 143 if target_extras is not None and re.search(target_extras, target_name):
139 return True 144 return True
140 145
141 # Otherwise just show executable targets. 146 # Otherwise just show executable targets and xc_tests.
142 if spec.get('type', '') == 'executable' and \ 147 if (int(spec.get('mac_xctest_bundle', 0)) != 0 or
143 spec.get('product_extension', '') != 'bundle': 148 (spec.get('type', '') == 'executable' and
149 spec.get('product_extension', '') != 'bundle')):
144 150
145 # If there is a filter and the target does not match, exclude the target. 151 # If there is a filter and the target does not match, exclude the target.
146 if executable_target_pattern is not None: 152 if executable_target_pattern is not None:
147 if not re.search(executable_target_pattern, target_name): 153 if not re.search(executable_target_pattern, target_name):
148 return False 154 return False
149 return True 155 return True
150 return False 156 return False
151 157
152 def CreateWrapper(target_list, target_dicts, data, params): 158 def CreateWrapper(target_list, target_dicts, data, params):
153 """Initialize targets for the ninja wrapper. 159 """Initialize targets for the ninja wrapper.
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 new_data[sources_gyp] = {} 267 new_data[sources_gyp] = {}
262 new_data[sources_gyp]['targets'] = [] 268 new_data[sources_gyp]['targets'] = []
263 new_data[sources_gyp]['included_files'] = [] 269 new_data[sources_gyp]['included_files'] = []
264 new_data[sources_gyp]['xcode_settings'] = \ 270 new_data[sources_gyp]['xcode_settings'] = \
265 data[orig_gyp].get('xcode_settings', {}) 271 data[orig_gyp].get('xcode_settings', {})
266 new_data[sources_gyp]['targets'].append(new_data_target) 272 new_data[sources_gyp]['targets'].append(new_data_target)
267 273
268 # Write workspace to file. 274 # Write workspace to file.
269 _WriteWorkspace(main_gyp, sources_gyp, params) 275 _WriteWorkspace(main_gyp, sources_gyp, params)
270 return (new_target_list, new_target_dicts, new_data) 276 return (new_target_list, new_target_dicts, new_data)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698