OLD | NEW |
1 # Copyright (c) 2012 Google Inc. All rights reserved. | 1 # Copyright (c) 2012 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 """ | 5 """ |
6 This module contains classes that help to emulate xcodebuild behavior on top of | 6 This module contains classes that help to emulate xcodebuild behavior on top of |
7 other build systems, such as make and ninja. | 7 other build systems, such as make and ninja. |
8 """ | 8 """ |
9 | 9 |
10 import copy | 10 import copy |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 default = "binary" if self.isIOS else "xml" | 222 default = "binary" if self.isIOS else "xml" |
223 format = self.xcode_settings[configname].get('INFOPLIST_OUTPUT_FORMAT', | 223 format = self.xcode_settings[configname].get('INFOPLIST_OUTPUT_FORMAT', |
224 default) | 224 default) |
225 return format == "binary" | 225 return format == "binary" |
226 | 226 |
227 def IsIosFramework(self): | 227 def IsIosFramework(self): |
228 return self.spec['type'] == 'shared_library' and self._IsBundle() and \ | 228 return self.spec['type'] == 'shared_library' and self._IsBundle() and \ |
229 self.isIOS | 229 self.isIOS |
230 | 230 |
231 def _IsBundle(self): | 231 def _IsBundle(self): |
232 return int(self.spec.get('mac_bundle', 0)) != 0 or self._IsXCTest() | 232 return int(self.spec.get('mac_bundle', 0)) != 0 or self._IsXCTest() or \ |
| 233 self._IsXCUiTest() |
233 | 234 |
234 def _IsXCTest(self): | 235 def _IsXCTest(self): |
235 return int(self.spec.get('mac_xctest_bundle', 0)) != 0 | 236 return int(self.spec.get('mac_xctest_bundle', 0)) != 0 |
236 | 237 |
| 238 def _IsXCUiTest(self): |
| 239 return int(self.spec.get('mac_xcuitest_bundle', 0)) != 0 |
| 240 |
237 def _IsIosAppExtension(self): | 241 def _IsIosAppExtension(self): |
238 return int(self.spec.get('ios_app_extension', 0)) != 0 | 242 return int(self.spec.get('ios_app_extension', 0)) != 0 |
239 | 243 |
240 def _IsIosWatchKitExtension(self): | 244 def _IsIosWatchKitExtension(self): |
241 return int(self.spec.get('ios_watchkit_extension', 0)) != 0 | 245 return int(self.spec.get('ios_watchkit_extension', 0)) != 0 |
242 | 246 |
243 def _IsIosWatchApp(self): | 247 def _IsIosWatchApp(self): |
244 return int(self.spec.get('ios_watch_app', 0)) != 0 | 248 return int(self.spec.get('ios_watch_app', 0)) != 0 |
245 | 249 |
246 def GetFrameworkVersion(self): | 250 def GetFrameworkVersion(self): |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 '(target %s)' % self.spec['target_name']) | 329 '(target %s)' % self.spec['target_name']) |
326 return 'com.apple.product-type.app-extension' | 330 return 'com.apple.product-type.app-extension' |
327 if self._IsIosWatchKitExtension(): | 331 if self._IsIosWatchKitExtension(): |
328 assert self._IsBundle(), ('ios_watchkit_extension flag requires ' | 332 assert self._IsBundle(), ('ios_watchkit_extension flag requires ' |
329 'mac_bundle (target %s)' % self.spec['target_name']) | 333 'mac_bundle (target %s)' % self.spec['target_name']) |
330 return 'com.apple.product-type.watchkit-extension' | 334 return 'com.apple.product-type.watchkit-extension' |
331 if self._IsIosWatchApp(): | 335 if self._IsIosWatchApp(): |
332 assert self._IsBundle(), ('ios_watch_app flag requires mac_bundle ' | 336 assert self._IsBundle(), ('ios_watch_app flag requires mac_bundle ' |
333 '(target %s)' % self.spec['target_name']) | 337 '(target %s)' % self.spec['target_name']) |
334 return 'com.apple.product-type.application.watchapp' | 338 return 'com.apple.product-type.application.watchapp' |
| 339 if self._IsXCUiTest(): |
| 340 assert self._IsBundle(), ('mac_xcuitest_bundle flag requires mac_bundle ' |
| 341 '(target %s)' % self.spec['target_name']) |
| 342 return 'com.apple.product-type.bundle.ui-testing' |
335 if self._IsBundle(): | 343 if self._IsBundle(): |
336 return { | 344 return { |
337 'executable': 'com.apple.product-type.application', | 345 'executable': 'com.apple.product-type.application', |
338 'loadable_module': 'com.apple.product-type.bundle', | 346 'loadable_module': 'com.apple.product-type.bundle', |
339 'shared_library': 'com.apple.product-type.framework', | 347 'shared_library': 'com.apple.product-type.framework', |
340 }[self.spec['type']] | 348 }[self.spec['type']] |
341 else: | 349 else: |
342 return { | 350 return { |
343 'executable': 'com.apple.product-type.tool', | 351 'executable': 'com.apple.product-type.tool', |
344 'loadable_module': 'com.apple.product-type.library.dynamic', | 352 'loadable_module': 'com.apple.product-type.library.dynamic', |
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1372 config['xcode_settings'] = new_settings | 1380 config['xcode_settings'] = new_settings |
1373 | 1381 |
1374 | 1382 |
1375 def IsMacBundle(flavor, spec): | 1383 def IsMacBundle(flavor, spec): |
1376 """Returns if |spec| should be treated as a bundle. | 1384 """Returns if |spec| should be treated as a bundle. |
1377 | 1385 |
1378 Bundles are directories with a certain subdirectory structure, instead of | 1386 Bundles are directories with a certain subdirectory structure, instead of |
1379 just a single file. Bundle rules do not produce a binary but also package | 1387 just a single file. Bundle rules do not produce a binary but also package |
1380 resources into that directory.""" | 1388 resources into that directory.""" |
1381 is_mac_bundle = int(spec.get('mac_xctest_bundle', 0)) != 0 or \ | 1389 is_mac_bundle = int(spec.get('mac_xctest_bundle', 0)) != 0 or \ |
| 1390 int(spec.get('mac_xcuitest_bundle', 0)) != 0 or \ |
1382 (int(spec.get('mac_bundle', 0)) != 0 and flavor == 'mac') | 1391 (int(spec.get('mac_bundle', 0)) != 0 and flavor == 'mac') |
1383 | 1392 |
1384 if is_mac_bundle: | 1393 if is_mac_bundle: |
1385 assert spec['type'] != 'none', ( | 1394 assert spec['type'] != 'none', ( |
1386 'mac_bundle targets cannot have type none (target "%s")' % | 1395 'mac_bundle targets cannot have type none (target "%s")' % |
1387 spec['target_name']) | 1396 spec['target_name']) |
1388 return is_mac_bundle | 1397 return is_mac_bundle |
1389 | 1398 |
1390 | 1399 |
1391 def GetMacBundleResources(product_dir, xcode_settings, resources): | 1400 def GetMacBundleResources(product_dir, xcode_settings, resources): |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1668 if toolset == 'target': | 1677 if toolset == 'target': |
1669 iphoneos_config_dict['xcode_settings']['SDKROOT'] = 'iphoneos' | 1678 iphoneos_config_dict['xcode_settings']['SDKROOT'] = 'iphoneos' |
1670 return targets | 1679 return targets |
1671 | 1680 |
1672 def CloneConfigurationForDeviceAndEmulator(target_dicts): | 1681 def CloneConfigurationForDeviceAndEmulator(target_dicts): |
1673 """If |target_dicts| contains any iOS targets, automatically create -iphoneos | 1682 """If |target_dicts| contains any iOS targets, automatically create -iphoneos |
1674 targets for iOS device builds.""" | 1683 targets for iOS device builds.""" |
1675 if _HasIOSTarget(target_dicts): | 1684 if _HasIOSTarget(target_dicts): |
1676 return _AddIOSDeviceConfigurations(target_dicts) | 1685 return _AddIOSDeviceConfigurations(target_dicts) |
1677 return target_dicts | 1686 return target_dicts |
OLD | NEW |