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

Unified Diff: pylib/gyp/xcode_emulation.py

Issue 376603002: This CL adds support for extension in GYP. (Closed) Base URL: https://chromium.googlesource.com/external/gyp.git@master
Patch Set: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: pylib/gyp/xcode_emulation.py
diff --git a/pylib/gyp/xcode_emulation.py b/pylib/gyp/xcode_emulation.py
index 859cd5a93722e9c1efb9f4cb210be180e03e7b11..d5be1a618082be1acb054c64c1e7642502fca150 100644
--- a/pylib/gyp/xcode_emulation.py
+++ b/pylib/gyp/xcode_emulation.py
@@ -238,6 +238,8 @@ class XcodeSettings(object):
return '.' + self.spec.get('product_extension', wrapper_extension)
elif self.spec['type'] == 'executable':
return '.' + self.spec.get('product_extension', 'app')
+ elif self.spec['type'] == 'extension':
+ return '.' + self.spec.get('product_extension', 'appex')
else:
assert False, "Don't know extension for '%s', target '%s'" % (
self.spec['type'], self.spec['target_name'])
@@ -284,7 +286,7 @@ class XcodeSettings(object):
"""Returns the qualified path to the bundle's plist file. E.g.
Chromium.app/Contents/Info.plist. Only valid for bundles."""
assert self._IsBundle()
- if self.spec['type'] in ('executable', 'loadable_module'):
+ if self.spec['type'] in ('executable', 'extension', 'loadable_module'):
return os.path.join(self.GetBundleContentsFolderPath(), 'Info.plist')
else:
return os.path.join(self.GetBundleContentsFolderPath(),
@@ -295,12 +297,14 @@ class XcodeSettings(object):
if self._IsBundle():
return {
'executable': 'com.apple.product-type.application',
+ 'extension': 'com.apple.product-type.app-extension',
'loadable_module': 'com.apple.product-type.bundle',
'shared_library': 'com.apple.product-type.framework',
}[self.spec['type']]
else:
return {
'executable': 'com.apple.product-type.tool',
+ 'extension': 'com.apple.product-type.app-extension',
'loadable_module': 'com.apple.product-type.library.dynamic',
'shared_library': 'com.apple.product-type.library.dynamic',
'static_library': 'com.apple.product-type.library.static',
@@ -309,10 +313,12 @@ class XcodeSettings(object):
def GetMachOType(self):
"""Returns the MACH_O_TYPE of this target."""
# Weird, but matches Xcode.
- if not self._IsBundle() and self.spec['type'] == 'executable':
+ if not self._IsBundle() and (self.spec['type'] == 'executable' or
+ self.spec['type'] == 'extension'):
return ''
return {
'executable': 'mh_execute',
+ 'extension': 'mh_execute',
'static_library': 'staticlib',
'shared_library': 'mh_dylib',
'loadable_module': 'mh_bundle',
@@ -324,7 +330,7 @@ class XcodeSettings(object):
assert self._IsBundle()
if self.spec['type'] in ('shared_library') or self.isIOS:
path = self.GetBundleContentsFolderPath()
- elif self.spec['type'] in ('executable', 'loadable_module'):
+ elif self.spec['type'] in ('executable', 'extension', 'loadable_module'):
path = os.path.join(self.GetBundleContentsFolderPath(), 'MacOS')
return os.path.join(path, self.GetExecutableName())
@@ -333,6 +339,7 @@ class XcodeSettings(object):
return '.' + self.spec['product_extension']
return {
'executable': '',
+ 'extension': '',
'static_library': '.a',
'shared_library': '.dylib',
'loadable_module': '.so',
@@ -341,6 +348,7 @@ class XcodeSettings(object):
def _GetStandaloneExecutablePrefix(self):
return self.spec.get('product_prefix', {
'executable': '',
+ 'extension': '',
'static_library': 'lib',
'shared_library': 'lib',
# Non-bundled loadable_modules are called foo.so for some reason
@@ -352,8 +360,8 @@ class XcodeSettings(object):
"""Returns the name of the non-bundle binary represented by this target.
E.g. hello_world. Only valid for non-bundles."""
assert not self._IsBundle()
- assert self.spec['type'] in (
- 'executable', 'shared_library', 'static_library', 'loadable_module'), (
+ assert self.spec['type'] in ('executable', 'extension', 'shared_library',
+ 'static_library', 'loadable_module'), (
'Unexpected type %s' % self.spec['type'])
target = self.spec['target_name']
if self.spec['type'] == 'static_library':
@@ -794,6 +802,12 @@ class XcodeSettings(object):
for directory in framework_dirs:
ldflags.append('-F' + directory.replace('$(SDKROOT)', sdk_root))
+ if sdk_root and self.spec['type'] == "extension":
+ ldflags.append('-lpkstart ' + sdk_root +
+ '/System/Library/PrivateFrameworks/PlugInKit.framework/PlugInKit')
justincohen 2014/07/07 14:13:58 Maybe a comment on why this has to be hard coded,
olivierrobin 2014/07/07 14:36:35 Done.
+ ldflags.append('-fapplication-extension ' +
+ '-Xlinker -rpath -Xlinker @executable_path/../../Frameworks')
+
self._Appendf(ldflags, 'CLANG_CXX_LIBRARY', '-stdlib=%s')
self.configname = None
@@ -870,6 +884,8 @@ class XcodeSettings(object):
default_strip_style = 'non-global'
elif self.spec['type'] == 'executable':
default_strip_style = 'all'
+ elif self.spec['type'] == 'extension':
+ default_strip_style = 'all'
strip_style = self._Settings().get('STRIP_STYLE', default_strip_style)
strip_flags = {
@@ -921,7 +937,8 @@ class XcodeSettings(object):
"""Return a shell command to codesign the iOS output binary so it can
be deployed to a device. This should be run as the very last step of the
build."""
- if not (self.isIOS and self.spec['type'] == "executable"):
+ if not (self.isIOS and (self.spec['type'] == "executable" or
+ self.spec['type'] == "extension")):
return []
settings = self.xcode_settings[configname]
@@ -1402,7 +1419,11 @@ def _GetXcodeEnv(xcode_settings, built_products_dir, srcroot, configuration,
env['SDKROOT'] = ''
if spec['type'] in (
- 'executable', 'static_library', 'shared_library', 'loadable_module'):
+ 'executable',
+ 'extension',
+ 'static_library',
+ 'shared_library',
+ 'loadable_module'):
env['EXECUTABLE_NAME'] = xcode_settings.GetExecutableName()
env['EXECUTABLE_PATH'] = xcode_settings.GetExecutablePath()
env['FULL_PRODUCT_NAME'] = xcode_settings.GetFullProductName()

Powered by Google App Engine
This is Rietveld 408576698