Index: pylib/gyp/xcode_emulation.py |
diff --git a/pylib/gyp/xcode_emulation.py b/pylib/gyp/xcode_emulation.py |
index ac6852faf98d565b4270278d700612085caaf4c2..4d6a3ea6e82c0671ded85999fdb9f15a97830401 100644 |
--- a/pylib/gyp/xcode_emulation.py |
+++ b/pylib/gyp/xcode_emulation.py |
@@ -147,6 +147,7 @@ class XcodeSettings(object): |
# Populated lazily by _SdkPath(). Shared by all XcodeSettings, so cached |
# at class-level for efficiency. |
_sdk_path_cache = {} |
+ _platform_path_cache = {} |
_sdk_root_cache = {} |
# Populated lazily by GetExtraPlistItems(). Shared by all XcodeSettings, so |
@@ -222,7 +223,10 @@ class XcodeSettings(object): |
return format == "binary" |
def _IsBundle(self): |
- return int(self.spec.get('mac_bundle', 0)) != 0 |
+ return int(self.spec.get('mac_bundle', 0)) != 0 or self._IsXCTest() |
+ |
+ def _IsXCTest(self): |
+ return int(self.spec.get('mac_xctest_bundle', 0)) != 0 |
def _IsIosAppExtension(self): |
return int(self.spec.get('ios_app_extension', 0)) != 0 |
@@ -438,6 +442,13 @@ class XcodeSettings(object): |
configname = self.configname |
return self.GetPerConfigSetting('SDKROOT', configname, default='') |
+ def _XcodePlatformPath(self, configname=None): |
+ sdk_root = self._SdkRoot(configname) |
+ if sdk_root not in XcodeSettings._platform_path_cache: |
+ platform_path = self._GetSdkVersionInfoItem(sdk_root, 'PlatformPath') |
+ XcodeSettings._platform_path_cache[sdk_root] = platform_path |
+ return XcodeSettings._platform_path_cache[sdk_root] |
+ |
def _SdkPath(self, configname=None): |
sdk_root = self._SdkRoot(configname) |
if sdk_root.startswith('/'): |
@@ -568,6 +579,10 @@ class XcodeSettings(object): |
cflags += self._Settings().get('WARNING_CFLAGS', []) |
+ platform_root = self._XcodePlatformPath(configname) |
+ if platform_root and self._IsXCTest(): |
+ cflags.append('-F' + platform_root + '/Developer/Library/Frameworks/') |
+ |
if sdk_root: |
framework_root = sdk_root |
else: |
@@ -831,6 +846,11 @@ class XcodeSettings(object): |
for directory in framework_dirs: |
ldflags.append('-F' + directory.replace('$(SDKROOT)', sdk_root)) |
+ platform_root = self._XcodePlatformPath(configname) |
+ if sdk_root and platform_root and self._IsXCTest(): |
+ ldflags.append('-F' + platform_root + '/Developer/Library/Frameworks/') |
+ ldflags.append('-framework XCTest') |
+ |
is_extension = self._IsIosAppExtension() or self._IsIosWatchKitExtension() |
if sdk_root and is_extension: |
# Adds the link flags for extensions. These flags are common for all |
@@ -972,7 +992,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._IsXCTest())): |
return [] |
settings = self.xcode_settings[configname] |
@@ -1334,7 +1355,9 @@ def IsMacBundle(flavor, spec): |
Bundles are directories with a certain subdirectory structure, instead of |
just a single file. Bundle rules do not produce a binary but also package |
resources into that directory.""" |
- is_mac_bundle = (int(spec.get('mac_bundle', 0)) != 0 and flavor == 'mac') |
+ is_mac_bundle = int(spec.get('mac_xctest_bundle', 0)) != 0 or \ |
+ (int(spec.get('mac_bundle', 0)) != 0 and flavor == 'mac') |
+ |
if is_mac_bundle: |
assert spec['type'] != 'none', ( |
'mac_bundle targets cannot have type none (target "%s")' % |