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

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

Issue 1745173002: Add support for iOS Frameworks with header maps. (Closed) Base URL: https://chromium.googlesource.com/external/gyp.git@master
Patch Set: Spacing nits Created 4 years, 9 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
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 _plist_cache = {} 155 _plist_cache = {}
156 156
157 # Populated lazily by GetIOSPostbuilds. Shared by all XcodeSettings, so 157 # Populated lazily by GetIOSPostbuilds. Shared by all XcodeSettings, so
158 # cached at class-level for efficiency. 158 # cached at class-level for efficiency.
159 _codesigning_key_cache = {} 159 _codesigning_key_cache = {}
160 160
161 def __init__(self, spec): 161 def __init__(self, spec):
162 self.spec = spec 162 self.spec = spec
163 163
164 self.isIOS = False 164 self.isIOS = False
165 self.header_map_path = None
165 166
166 # Per-target 'xcode_settings' are pushed down into configs earlier by gyp. 167 # Per-target 'xcode_settings' are pushed down into configs earlier by gyp.
167 # This means self.xcode_settings[config] always contains all settings 168 # This means self.xcode_settings[config] always contains all settings
168 # for that config -- the per-target settings as well. Settings that are 169 # for that config -- the per-target settings as well. Settings that are
169 # the same for all configs are implicitly per-target settings. 170 # the same for all configs are implicitly per-target settings.
170 self.xcode_settings = {} 171 self.xcode_settings = {}
171 configs = spec['configurations'] 172 configs = spec['configurations']
172 for configname, config in configs.iteritems(): 173 for configname, config in configs.iteritems():
173 self.xcode_settings[configname] = config.get('xcode_settings', {}) 174 self.xcode_settings[configname] = config.get('xcode_settings', {})
174 self._ConvertConditionalKeys(configname) 175 self._ConvertConditionalKeys(configname)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 def _WarnUnimplemented(self, test_key): 216 def _WarnUnimplemented(self, test_key):
216 if test_key in self._Settings(): 217 if test_key in self._Settings():
217 print 'Warning: Ignoring not yet implemented key "%s".' % test_key 218 print 'Warning: Ignoring not yet implemented key "%s".' % test_key
218 219
219 def IsBinaryOutputFormat(self, configname): 220 def IsBinaryOutputFormat(self, configname):
220 default = "binary" if self.isIOS else "xml" 221 default = "binary" if self.isIOS else "xml"
221 format = self.xcode_settings[configname].get('INFOPLIST_OUTPUT_FORMAT', 222 format = self.xcode_settings[configname].get('INFOPLIST_OUTPUT_FORMAT',
222 default) 223 default)
223 return format == "binary" 224 return format == "binary"
224 225
226 def IsIosFramework(self):
227 return self.spec['type'] == 'shared_library' and self._IsBundle() and \
228 self.isIOS
229
225 def _IsBundle(self): 230 def _IsBundle(self):
226 return int(self.spec.get('mac_bundle', 0)) != 0 or self._IsXCTest() 231 return int(self.spec.get('mac_bundle', 0)) != 0 or self._IsXCTest()
227 232
228 def _IsXCTest(self): 233 def _IsXCTest(self):
229 return int(self.spec.get('mac_xctest_bundle', 0)) != 0 234 return int(self.spec.get('mac_xctest_bundle', 0)) != 0
230 235
231 def _IsIosAppExtension(self): 236 def _IsIosAppExtension(self):
232 return int(self.spec.get('ios_app_extension', 0)) != 0 237 return int(self.spec.get('ios_app_extension', 0)) != 0
233 238
234 def _IsIosWatchKitExtension(self): 239 def _IsIosWatchKitExtension(self):
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 # This functions (and the similar ones below) do not offer complete 487 # This functions (and the similar ones below) do not offer complete
483 # emulation of all xcode_settings keys. They're implemented on demand. 488 # emulation of all xcode_settings keys. They're implemented on demand.
484 489
485 self.configname = configname 490 self.configname = configname
486 cflags = [] 491 cflags = []
487 492
488 sdk_root = self._SdkPath() 493 sdk_root = self._SdkPath()
489 if 'SDKROOT' in self._Settings() and sdk_root: 494 if 'SDKROOT' in self._Settings() and sdk_root:
490 cflags.append('-isysroot %s' % sdk_root) 495 cflags.append('-isysroot %s' % sdk_root)
491 496
497 if self.header_map_path:
498 cflags.append('-I%s' % self.header_map_path)
499
492 if self._Test('CLANG_WARN_CONSTANT_CONVERSION', 'YES', default='NO'): 500 if self._Test('CLANG_WARN_CONSTANT_CONVERSION', 'YES', default='NO'):
493 cflags.append('-Wconstant-conversion') 501 cflags.append('-Wconstant-conversion')
494 502
495 if self._Test('GCC_CHAR_IS_UNSIGNED_CHAR', 'YES', default='NO'): 503 if self._Test('GCC_CHAR_IS_UNSIGNED_CHAR', 'YES', default='NO'):
496 cflags.append('-funsigned-char') 504 cflags.append('-funsigned-char')
497 505
498 if self._Test('GCC_CW_ASM_SYNTAX', 'YES', default='YES'): 506 if self._Test('GCC_CW_ASM_SYNTAX', 'YES', default='YES'):
499 cflags.append('-fasm-blocks') 507 cflags.append('-fasm-blocks')
500 508
501 if 'GCC_DYNAMIC_NO_PIC' in self._Settings(): 509 if 'GCC_DYNAMIC_NO_PIC' in self._Settings():
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 # dSYMs need to build before stripping happens. 996 # dSYMs need to build before stripping happens.
989 return ( 997 return (
990 self._GetDebugInfoPostbuilds(configname, output, output_binary, quiet) + 998 self._GetDebugInfoPostbuilds(configname, output, output_binary, quiet) +
991 self._GetStripPostbuilds(configname, output_binary, quiet)) 999 self._GetStripPostbuilds(configname, output_binary, quiet))
992 1000
993 def _GetIOSPostbuilds(self, configname, output_binary): 1001 def _GetIOSPostbuilds(self, configname, output_binary):
994 """Return a shell command to codesign the iOS output binary so it can 1002 """Return a shell command to codesign the iOS output binary so it can
995 be deployed to a device. This should be run as the very last step of the 1003 be deployed to a device. This should be run as the very last step of the
996 build.""" 1004 build."""
997 if not (self.isIOS and 1005 if not (self.isIOS and
998 (self.spec['type'] == 'executable' or self._IsXCTest())): 1006 (self.spec['type'] == 'executable' or self._IsXCTest()) or
1007 self.IsIosFramework()):
999 return [] 1008 return []
1000 1009
1001 settings = self.xcode_settings[configname] 1010 settings = self.xcode_settings[configname]
1002 key = self._GetIOSCodeSignIdentityKey(settings) 1011 key = self._GetIOSCodeSignIdentityKey(settings)
1003 if not key: 1012 if not key:
1004 return [] 1013 return []
1005 1014
1006 # Warn for any unimplemented signing xcode keys. 1015 # Warn for any unimplemented signing xcode keys.
1007 unimpl = ['OTHER_CODE_SIGN_FLAGS'] 1016 unimpl = ['OTHER_CODE_SIGN_FLAGS']
1008 unimpl = set(unimpl) & set(self.xcode_settings[configname].keys()) 1017 unimpl = set(unimpl) & set(self.xcode_settings[configname].keys())
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
1655 if toolset == 'target': 1664 if toolset == 'target':
1656 iphoneos_config_dict['xcode_settings']['SDKROOT'] = 'iphoneos' 1665 iphoneos_config_dict['xcode_settings']['SDKROOT'] = 'iphoneos'
1657 return targets 1666 return targets
1658 1667
1659 def CloneConfigurationForDeviceAndEmulator(target_dicts): 1668 def CloneConfigurationForDeviceAndEmulator(target_dicts):
1660 """If |target_dicts| contains any iOS targets, automatically create -iphoneos 1669 """If |target_dicts| contains any iOS targets, automatically create -iphoneos
1661 targets for iOS device builds.""" 1670 targets for iOS device builds."""
1662 if _HasIOSTarget(target_dicts): 1671 if _HasIOSTarget(target_dicts):
1663 return _AddIOSDeviceConfigurations(target_dicts) 1672 return _AddIOSDeviceConfigurations(target_dicts)
1664 return target_dicts 1673 return target_dicts
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698