Skip to content

Commit

Permalink
Fix iossim on latest Xcode beta.
Browse files Browse the repository at this point in the history
Stop using -supportedDeviceTypesByName, instead use
-supportedDeviceTypesByAlias.
Ensure -BuildSystemRoot chooses the most recent SDK if no
default SDK is chosen.

Also upstream nullability change common.gypi.

BUG=499779

Review URL: https://codereview.chromium.org/1182493010

Cr-Commit-Position: refs/heads/master@{#334904}
  • Loading branch information
justincohen authored and Commit bot committed Jun 17, 2015
1 parent b865eb8 commit 86ae043
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
5 changes: 4 additions & 1 deletion build/common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -1331,7 +1331,7 @@
# Control which version of clang to use when building for iOS. If set to
# '1', uses the version of clang that ships with Xcode. If set to '0', uses
# the version of clang that ships with the Chromium source. This variable
# is automatically set to '1' when using the Xcode generator.
# is automatically set to '1' in Official builds.
'clang_xcode%': 0,

# These two variables can be set in GYP_DEFINES while running
Expand Down Expand Up @@ -5352,6 +5352,9 @@
['clang_xcode==1', {
'WARNING_CFLAGS': [
'-Wno-unknown-warning-option',
# It's not possible to achieve nullability completeness before
# all builders are running Xcode 7. crbug.com/499809
'-Wno-nullability-completeness',
],
}],

Expand Down
15 changes: 13 additions & 2 deletions testing/iossim/iossim.mm
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,18 @@ - (void)session:(DTiPhoneSimulatorSession*)session
// valid.
DTiPhoneSimulatorSystemRoot* BuildSystemRoot(NSString* sdkVersion) {
Class systemRootClass = FindClassByName(@"DTiPhoneSimulatorSystemRoot");
#if defined(IOSSIM_USE_XCODE_6)
Class simRuntimeClass = FindClassByName(@"SimRuntime");
NSArray* sorted =
[[simRuntimeClass supportedRuntimes] sortedArrayUsingDescriptors:@[
[NSSortDescriptor sortDescriptorWithKey:@"version" ascending:YES]
]];
NSString* versionString = [[sorted lastObject] versionString];
DTiPhoneSimulatorSystemRoot* systemRoot =
[systemRootClass rootWithSDKVersion:versionString];
#else
DTiPhoneSimulatorSystemRoot* systemRoot = [systemRootClass defaultRoot];
#endif
if (sdkVersion)
systemRoot = [systemRootClass rootWithSDKVersion:sdkVersion];

Expand Down Expand Up @@ -666,7 +677,7 @@ - (void)session:(DTiPhoneSimulatorSession*)session
#if defined(IOSSIM_USE_XCODE_6)
Class simDeviceTypeClass = FindClassByName(@"SimDeviceType");
id simDeviceType =
[simDeviceTypeClass supportedDeviceTypesByName][deviceName];
[simDeviceTypeClass supportedDeviceTypesByAlias][deviceName];
Class simRuntimeClass = FindClassByName(@"SimRuntime");
NSString* identifier = systemRoot.runtime.identifier;
id simRuntime = [simRuntimeClass supportedRuntimesByIdentifier][identifier];
Expand Down Expand Up @@ -956,7 +967,7 @@ int main(int argc, char* const argv[]) {
if (IsRunningWithXcode6OrLater()) {
#if defined(IOSSIM_USE_XCODE_6)
Class simDeviceTypeClass = FindClassByName(@"SimDeviceType");
if ([simDeviceTypeClass supportedDeviceTypesByName][deviceName] == nil) {
if ([simDeviceTypeClass supportedDeviceTypesByAlias][deviceName] == nil) {
LogError(@"Invalid device name: %@.", deviceName);
PrintSupportedDevices();
exit(kExitInvalidArguments);
Expand Down

0 comments on commit 86ae043

Please sign in to comment.