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

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

Issue 27035003: ninja/mac: Add iOS fields to ExtraPlistItems for ninja builds. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 # Convert that to '0463', '4H1503'. 785 # Convert that to '0463', '4H1503'.
786 version_list = self._GetStdout(['xcodebuild', '-version']).splitlines() 786 version_list = self._GetStdout(['xcodebuild', '-version']).splitlines()
787 version = version_list[0] 787 version = version_list[0]
788 build = version_list[-1] 788 build = version_list[-1]
789 # Be careful to convert "4.2" to "0420": 789 # Be careful to convert "4.2" to "0420":
790 version = version.split()[-1].replace('.', '') 790 version = version.split()[-1].replace('.', '')
791 version = (version + '0' * (3 - len(version))).zfill(4) 791 version = (version + '0' * (3 - len(version))).zfill(4)
792 build = build.split()[-1] 792 build = build.split()[-1]
793 return version, build 793 return version, build
794 794
795 def _XcodeIOSDeviceFamily(self, configname):
796 family = self.xcode_settings[configname].get('TARGETED_DEVICE_FAMILY')
Nico 2013/10/11 20:20:49 return self.xcode_settings[configname].get('TARGET
justincohen 2013/10/12 14:52:28 Almost, I needed to add an int(x) for x in foo. P
797 if family == '1,2':
798 return [1,2]
799 elif family == '2':
800 return [2]
801 return [1]
802
795 def GetExtraPlistItems(self, configname=None): 803 def GetExtraPlistItems(self, configname=None):
796 """Returns a dictionary with extra items to insert into Info.plist.""" 804 """Returns a dictionary with extra items to insert into Info.plist."""
797 if not XcodeSettings._plist_cache: 805 if configname not in XcodeSettings._plist_cache:
798 cache = XcodeSettings._plist_cache 806 cache = {}
799 cache['BuildMachineOSBuild'] = self._BuildMachineOSBuild() 807 cache['BuildMachineOSBuild'] = self._BuildMachineOSBuild()
800 808
801 xcode, xcode_build = self._XcodeVersion() 809 xcode, xcode_build = self._XcodeVersion()
802 cache['DTXcode'] = xcode 810 cache['DTXcode'] = xcode
803 cache['DTXcodeBuild'] = xcode_build 811 cache['DTXcodeBuild'] = xcode_build
804 812
805 sdk_root = self._SdkRoot(configname) 813 sdk_root = self._SdkRoot(configname)
806 cache['DTSDKName'] = sdk_root 814 cache['DTSDKName'] = sdk_root
807 if xcode >= '0430': 815 if xcode >= '0430':
808 cache['DTSDKBuild'] = self._GetSdkVersionInfoItem( 816 cache['DTSDKBuild'] = self._GetSdkVersionInfoItem(
809 sdk_root, 'ProductBuildVersion') 817 sdk_root, 'ProductBuildVersion')
810 else: 818 else:
811 cache['DTSDKBuild'] = cache['BuildMachineOSBuild'] 819 cache['DTSDKBuild'] = cache['BuildMachineOSBuild']
812 820
813 return XcodeSettings._plist_cache 821 if self.isIOS:
822 cache['UIDeviceFamily'] = self._XcodeIOSDeviceFamily(configname)
823 if configname.endswith("iphoneos"):
824 cache['CFBundleSupportedPlatforms'] = ['iPhoneOS']
825 else:
826 cache['CFBundleSupportedPlatforms'] = ['iPhoneSimulator']
827 XcodeSettings._plist_cache[configname] = cache
828 return XcodeSettings._plist_cache[configname]
814 829
815 830
816 class MacPrefixHeader(object): 831 class MacPrefixHeader(object):
817 """A class that helps with emulating Xcode's GCC_PREFIX_HEADER feature. 832 """A class that helps with emulating Xcode's GCC_PREFIX_HEADER feature.
818 833
819 This feature consists of several pieces: 834 This feature consists of several pieces:
820 * If GCC_PREFIX_HEADER is present, all compilations in that project get an 835 * If GCC_PREFIX_HEADER is present, all compilations in that project get an
821 additional |-include path_to_prefix_header| cflag. 836 additional |-include path_to_prefix_header| cflag.
822 * If GCC_PRECOMPILE_PREFIX_HEADER is present too, then the prefix header is 837 * If GCC_PRECOMPILE_PREFIX_HEADER is present too, then the prefix header is
823 instead compiled, and all other compilations in the project get an 838 instead compiled, and all other compilations in the project get an
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 new_config_dict['xcode_settings']['SDKROOT'] = 'iphoneos' 1231 new_config_dict['xcode_settings']['SDKROOT'] = 'iphoneos'
1217 target_dict['configurations'][new_config_name] = new_config_dict 1232 target_dict['configurations'][new_config_name] = new_config_dict
1218 return targets 1233 return targets
1219 1234
1220 def CloneConfigurationForDeviceAndEmulator(target_dicts): 1235 def CloneConfigurationForDeviceAndEmulator(target_dicts):
1221 """If |target_dicts| contains any iOS targets, automatically create -iphoneos 1236 """If |target_dicts| contains any iOS targets, automatically create -iphoneos
1222 targets for iOS device builds.""" 1237 targets for iOS device builds."""
1223 if _HasIOSTarget(target_dicts): 1238 if _HasIOSTarget(target_dicts):
1224 return _AddIOSDeviceConfigurations(target_dicts) 1239 return _AddIOSDeviceConfigurations(target_dicts)
1225 return target_dicts 1240 return target_dicts
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698