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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 '(target %s)' % self.spec['target_name']) | 330 '(target %s)' % self.spec['target_name']) |
327 return 'com.apple.product-type.app-extension' | 331 return 'com.apple.product-type.app-extension' |
328 if self._IsIosWatchKitExtension(): | 332 if self._IsIosWatchKitExtension(): |
329 assert self._IsBundle(), ('ios_watchkit_extension flag requires ' | 333 assert self._IsBundle(), ('ios_watchkit_extension flag requires ' |
330 'mac_bundle (target %s)' % self.spec['target_name']) | 334 'mac_bundle (target %s)' % self.spec['target_name']) |
331 return 'com.apple.product-type.watchkit-extension' | 335 return 'com.apple.product-type.watchkit-extension' |
332 if self._IsIosWatchApp(): | 336 if self._IsIosWatchApp(): |
333 assert self._IsBundle(), ('ios_watch_app flag requires mac_bundle ' | 337 assert self._IsBundle(), ('ios_watch_app flag requires mac_bundle ' |
334 '(target %s)' % self.spec['target_name']) | 338 '(target %s)' % self.spec['target_name']) |
335 return 'com.apple.product-type.application.watchapp' | 339 return 'com.apple.product-type.application.watchapp' |
| 340 if self._IsXCUiTest(): |
| 341 assert self._IsBundle(), ('mac_xcuitest_bundle flag requires mac_bundle ' |
| 342 '(target %s)' % self.spec['target_name']) |
| 343 return 'com.apple.product-type.bundle.ui-testing' |
336 if self._IsBundle(): | 344 if self._IsBundle(): |
337 return { | 345 return { |
338 'executable': 'com.apple.product-type.application', | 346 'executable': 'com.apple.product-type.application', |
339 'loadable_module': 'com.apple.product-type.bundle', | 347 'loadable_module': 'com.apple.product-type.bundle', |
340 'shared_library': 'com.apple.product-type.framework', | 348 'shared_library': 'com.apple.product-type.framework', |
341 }[self.spec['type']] | 349 }[self.spec['type']] |
342 else: | 350 else: |
343 return { | 351 return { |
344 'executable': 'com.apple.product-type.tool', | 352 'executable': 'com.apple.product-type.tool', |
345 'loadable_module': 'com.apple.product-type.library.dynamic', | 353 'loadable_module': 'com.apple.product-type.library.dynamic', |
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1413 config['xcode_settings'] = new_settings | 1421 config['xcode_settings'] = new_settings |
1414 | 1422 |
1415 | 1423 |
1416 def IsMacBundle(flavor, spec): | 1424 def IsMacBundle(flavor, spec): |
1417 """Returns if |spec| should be treated as a bundle. | 1425 """Returns if |spec| should be treated as a bundle. |
1418 | 1426 |
1419 Bundles are directories with a certain subdirectory structure, instead of | 1427 Bundles are directories with a certain subdirectory structure, instead of |
1420 just a single file. Bundle rules do not produce a binary but also package | 1428 just a single file. Bundle rules do not produce a binary but also package |
1421 resources into that directory.""" | 1429 resources into that directory.""" |
1422 is_mac_bundle = int(spec.get('mac_xctest_bundle', 0)) != 0 or \ | 1430 is_mac_bundle = int(spec.get('mac_xctest_bundle', 0)) != 0 or \ |
| 1431 int(spec.get('mac_xcuitest_bundle', 0)) != 0 or \ |
1423 (int(spec.get('mac_bundle', 0)) != 0 and flavor == 'mac') | 1432 (int(spec.get('mac_bundle', 0)) != 0 and flavor == 'mac') |
1424 | 1433 |
1425 if is_mac_bundle: | 1434 if is_mac_bundle: |
1426 assert spec['type'] != 'none', ( | 1435 assert spec['type'] != 'none', ( |
1427 'mac_bundle targets cannot have type none (target "%s")' % | 1436 'mac_bundle targets cannot have type none (target "%s")' % |
1428 spec['target_name']) | 1437 spec['target_name']) |
1429 return is_mac_bundle | 1438 return is_mac_bundle |
1430 | 1439 |
1431 | 1440 |
1432 def GetMacBundleResources(product_dir, xcode_settings, resources): | 1441 def GetMacBundleResources(product_dir, xcode_settings, resources): |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1709 if toolset == 'target': | 1718 if toolset == 'target': |
1710 iphoneos_config_dict['xcode_settings']['SDKROOT'] = 'iphoneos' | 1719 iphoneos_config_dict['xcode_settings']['SDKROOT'] = 'iphoneos' |
1711 return targets | 1720 return targets |
1712 | 1721 |
1713 def CloneConfigurationForDeviceAndEmulator(target_dicts): | 1722 def CloneConfigurationForDeviceAndEmulator(target_dicts): |
1714 """If |target_dicts| contains any iOS targets, automatically create -iphoneos | 1723 """If |target_dicts| contains any iOS targets, automatically create -iphoneos |
1715 targets for iOS device builds.""" | 1724 targets for iOS device builds.""" |
1716 if _HasIOSTarget(target_dicts): | 1725 if _HasIOSTarget(target_dicts): |
1717 return _AddIOSDeviceConfigurations(target_dicts) | 1726 return _AddIOSDeviceConfigurations(target_dicts) |
1718 return target_dicts | 1727 return target_dicts |
OLD | NEW |