Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.

Commit

Permalink
Xcode 8.1 support.
Browse files Browse the repository at this point in the history
  • Loading branch information
ExtremeMan committed Nov 8, 2016
1 parent e98885b commit d89710d
Show file tree
Hide file tree
Showing 16 changed files with 183 additions and 69 deletions.
5 changes: 5 additions & 0 deletions Common/XCToolUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ BOOL ToolchainIsXcode7OrBetter(void);
*/
BOOL ToolchainIsXcode8OrBetter(void);

/**
Returns YES if we're running with Xcode 8.1 or better.
*/
BOOL ToolchainIsXcode81OrBetter(void);

/**
Launches a task that will invoke xcodebuild. It will automatically feed
build events to the provided reporters.
Expand Down
10 changes: 10 additions & 0 deletions Common/XCToolUtil.m
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,16 @@ BOOL ToolchainIsXcode8OrBetter(void)
return result;
}

BOOL ToolchainIsXcode81OrBetter(void)
{
static BOOL result;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
result = ToolchainIsXcodeVersionSameOrBetter(@"0810");
});
return result;
}

NSString *MakeTemporaryDirectory(NSString *nameTemplate)
{
NSMutableData *template = [[[NSTemporaryDirectory() stringByAppendingPathComponent:nameTemplate]
Expand Down
2 changes: 1 addition & 1 deletion otest-query/otest-query.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@
CD9048F61756C5B1006CF16D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0800;
LastUpgradeCheck = 0810;
ORGANIZATIONNAME = Facebook;
};
buildConfigurationList = CD9048F91756C5B1006CF16D /* Build configuration list for PBXProject "otest-query" */;
Expand Down
2 changes: 1 addition & 1 deletion otest-shim/otest-shim.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@
283CCA8416C2EE4C00F2E343 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0800;
LastUpgradeCheck = 0810;
ORGANIZATIONNAME = "Facebook, Inc.";
};
buildConfigurationList = 283CCA8716C2EE4C00F2E343 /* Build configuration list for PBXProject "otest-shim" */;
Expand Down
2 changes: 1 addition & 1 deletion reporters/reporters.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@
isa = PBXProject;
attributes = {
LastTestingUpgradeCheck = 0700;
LastUpgradeCheck = 0800;
LastUpgradeCheck = 0810;
};
buildConfigurationList = 2893A94117960CAD00EFBD28 /* Build configuration list for PBXProject "reporters" */;
compatibilityVersion = "Xcode 3.2";
Expand Down
2 changes: 1 addition & 1 deletion xcodebuild-shim/xcodebuild-shim.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
283CCAA116C2EE7200F2E343 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0800;
LastUpgradeCheck = 0810;
ORGANIZATIONNAME = "Facebook, Inc.";
};
buildConfigurationList = 283CCAA416C2EE7200F2E343 /* Build configuration list for PBXProject "xcodebuild-shim" */;
Expand Down
1 change: 1 addition & 0 deletions xctool/Headers/CoreSimulator/SimDeviceSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

@interface SimDeviceSet : NSObject

// Deprecated in Xcode 8.1
+ (id)defaultSet;
+ (id)defaultSetPath;
+ (id)setForSetPath:(id)arg1;
Expand Down
1 change: 1 addition & 0 deletions xctool/Headers/CoreSimulator/SimDeviceType.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

@interface SimDeviceType : NSObject

// Deprecated in Xcode 8.1
+ (id)supportedDeviceTypes;
+ (id)supportedDeviceTypesByAlias;
+ (id)supportedDeviceTypesByIdentifier;
Expand Down
1 change: 1 addition & 0 deletions xctool/Headers/CoreSimulator/SimRuntime.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ typedef void (^CDUnknownFunctionPointerType)(void);

@interface SimRuntime : NSObject<SimRuntimeDVTAdditions>

// Deprecated in Xcode 8.1
+ (id)supportedRuntimes;
+ (id)supportedRuntimesByAlias;
+ (id)supportedRuntimesByIdentifier;
Expand Down
67 changes: 67 additions & 0 deletions xctool/Headers/CoreSimulator/SimServiceContext.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
//
// Generated by class-dump 3.5 (64 bit) (Debug version compiled Jul 15 2015 15:54:55).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard.
//

@class NSArray, NSDate, NSDictionary, NSMutableArray, NSMutableDictionary, NSString, SimProfilesPathMonitor;
@protocol OS_dispatch_queue, OS_xpc_object;

@interface SimServiceContext : NSObject
{
NSMutableArray *_supportedDeviceTypes;
NSMutableDictionary *_supportedDeviceTypesByIdentifier;
NSMutableDictionary *_supportedDeviceTypesByAlias;
NSMutableArray *_supportedRuntimes;
NSMutableDictionary *_supportedRuntimesByIdentifier;
NSMutableDictionary *_supportedRuntimesByAlias;
NSString *_developerDir;
NSMutableDictionary *_allDeviceSets;
BOOL _initialized;
long long _connectionType;
NSObject<OS_xpc_object> *_serviceConnection;
NSObject<OS_dispatch_queue> *_serviceConnectionQueue;
NSDate *_lastConnectionTime;
SimProfilesPathMonitor *_profileMonitor;
NSObject<OS_dispatch_queue> *_profileQueue;
NSObject<OS_dispatch_queue> *_allDeviceSetsQueue;
}

@property(retain, nonatomic) NSObject<OS_dispatch_queue> *allDeviceSetsQueue;
@property(readonly, nonatomic) NSArray *bundledDeviceTypes;
@property(readonly, nonatomic) NSArray *bundledRuntimes;
@property(nonatomic) long long connectionType;
@property(copy, nonatomic) NSString *developerDir;
@property(nonatomic) BOOL initialized;
@property(retain, nonatomic) NSDate *lastConnectionTime;
@property(retain, nonatomic) SimProfilesPathMonitor *profileMonitor;
@property(retain, nonatomic) NSObject<OS_dispatch_queue> *profileQueue;
@property(retain, nonatomic) NSObject<OS_xpc_object> *serviceConnection;
@property(retain, nonatomic) NSObject<OS_dispatch_queue> *serviceConnectionQueue;
@property(readonly, nonatomic) NSArray *supportedDeviceTypes;
@property(readonly, nonatomic) NSDictionary *supportedDeviceTypesByAlias;
@property(readonly, nonatomic) NSDictionary *supportedDeviceTypesByIdentifier;
@property(readonly, nonatomic) NSArray *supportedRuntimes;
@property(readonly, nonatomic) NSDictionary *supportedRuntimesByAlias;
@property(readonly, nonatomic) NSDictionary *supportedRuntimesByIdentifier;

+ (void)setSharedContextConnectionType:(long long)arg1;

+ (id)serviceContextForDeveloperDir:(id)arg1 connectionType:(long long)arg2 error:(id *)arg3;
+ (id)sharedServiceContextForDeveloperDir:(id)arg1 error:(id *)arg2;

- (id)initWithDeveloperDir:(id)arg1 connectionType:(long long)arg2;

- (void)addProfilesAtPath:(id)arg1;
- (void)addProfilesForDeveloperDir:(id)arg1;
- (id)allDeviceSets;
- (void)connect;
- (id)defaultDeviceSetWithError:(id *)arg1;
- (id)deviceSetWithPath:(id)arg1 error:(id *)arg2;
- (void)handleReconnectionBookkeeping;
- (void)handleXPCEvent:(id)arg1;
- (void)serviceAddProfilesAtPath:(id)arg1;
- (void)supportedDeviceTypesAddProfilesAtPath:(id)arg1;
- (void)supportedRuntimesAddProfilesAtPath:(id)arg1;

@end
4 changes: 3 additions & 1 deletion xctool/xctool.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@
CCCF099B1C1286B4006F08C4 /* FakeSimDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FakeSimDevice.h; sourceTree = "<group>"; };
CCCF099C1C1286B4006F08C4 /* FakeSimDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FakeSimDevice.m; sourceTree = "<group>"; };
CCE14EA01ACB5B8100B76996 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
CCED47DB1DD2711E006CBBD3 /* SimServiceContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SimServiceContext.h; sourceTree = "<group>"; };
CCF50B5519DC9E8C00A1044E /* SimVerifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SimVerifier.h; sourceTree = "<group>"; };
CCF6EE48195BA918005BA335 /* SimulatorInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SimulatorInfo.m; path = xctool/SimulatorWrapper/SimulatorInfo.m; sourceTree = "<group>"; };
CCF980311B38D1C900E4E0B0 /* XCTestConfigurationUnarchiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XCTestConfigurationUnarchiver.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -719,6 +720,7 @@
CCC55AC3195BB1E80051A50B /* SimDeviceSet.h */,
CCC55AC4195BB1E80051A50B /* SimDeviceType.h */,
CCC55AC5195BB1E80051A50B /* SimRuntime.h */,
CCED47DB1DD2711E006CBBD3 /* SimServiceContext.h */,
CCF50B5519DC9E8C00A1044E /* SimVerifier.h */,
);
path = CoreSimulator;
Expand Down Expand Up @@ -824,7 +826,7 @@
isa = PBXProject;
attributes = {
LastTestingUpgradeCheck = 0700;
LastUpgradeCheck = 0800;
LastUpgradeCheck = 0810;
ORGANIZATIONNAME = "Facebook, Inc.";
};
buildConfigurationList = 283CCA3D16C2EA3700F2E343 /* Build configuration list for PBXProject "xctool" */;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0810"
version = "1.3">
<BuildAction
parallelizeBuildables = "NO"
Expand Down
13 changes: 7 additions & 6 deletions xctool/xctool/Options.m
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ - (BOOL)_validateSdkWithErrorMessage:(NSString **)errorMessage {

- (BOOL)_validateDestinationWithErrorMessage:(NSString **)errorMessage {
if (_destination) {
SimulatorInfo *simInfo = [SimulatorInfo new];
NSDictionary *destInfo = ParseDestinationString(_destination, errorMessage);

NSString *deviceID = destInfo[@"id"];
Expand All @@ -588,7 +589,7 @@ - (BOOL)_validateDestinationWithErrorMessage:(NSString **)errorMessage {

if (deviceID) {
NSUUID *udid = [[NSUUID alloc] initWithUUIDString:deviceID];
if ([SimulatorInfo deviceWithUDID:udid]) {
if ([simInfo deviceWithUDID:udid]) {
if (deviceName || deviceOS) {
*errorMessage = @"If device id is specified, name or OS must not be specified.";
return NO;
Expand All @@ -602,27 +603,27 @@ - (BOOL)_validateDestinationWithErrorMessage:(NSString **)errorMessage {
}

if (deviceName) {
NSString *deviceSystemName = [SimulatorInfo deviceNameForAlias:deviceName];
NSString *deviceSystemName = [simInfo deviceNameForAlias:deviceName];
if (![deviceName isEqual:deviceSystemName] &&
deviceSystemName) {
ReportStatusMessage(_reporters, REPORTER_MESSAGE_WARNING,
@"Device name '%@' is not directly supported by xcodebuild. Replacing it with '%@'.", deviceName, deviceSystemName);
_destination = [_destination stringByReplacingOccurrencesOfString:deviceName withString:deviceSystemName];
deviceName = deviceSystemName;
}
if (![SimulatorInfo isDeviceAvailableWithAlias:deviceName]) {
if (![simInfo isDeviceAvailableWithAlias:deviceName]) {
*errorMessage = [NSString stringWithFormat:
@"'%@' isn't a valid device name. The valid device names are: %@.",
deviceName, [SimulatorInfo availableDevices]];
deviceName, [simInfo availableDevices]];
return NO;
}
}

if (deviceOS && deviceName) {
if (![SimulatorInfo isSdkVersion:deviceOS supportedByDevice:deviceName]) {
if (![simInfo isSdkVersion:deviceOS supportedByDevice:deviceName]) {
*errorMessage = [NSString stringWithFormat:
@"Device with name '%@' doesn't support iOS version '%@'. The supported iOS versions are: %@.",
deviceName, deviceOS, [SimulatorInfo sdksSupportedByDevice:deviceName]];
deviceName, deviceOS, [simInfo sdksSupportedByDevice:deviceName]];
return NO;
}
}
Expand Down
3 changes: 2 additions & 1 deletion xctool/xctool/RunTestsAction.m
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,8 @@ - (BOOL)validateWithOptions:(Options *)options
[_simulatorInfo setOSVersion:destInfo[@"OS"]];
if (destInfo[@"id"] != nil) {
NSUUID *udid = [[NSUUID alloc] initWithUUIDString:destInfo[@"id"]];
SimDevice *device = [SimulatorInfo deviceWithUDID:udid];
SimulatorInfo *simInfo = [SimulatorInfo new];
SimDevice *device = [simInfo deviceWithUDID:udid];
[_simulatorInfo setDeviceName:device.name];
[_simulatorInfo setOSVersion:device.runtime.versionString];
[_simulatorInfo setDeviceUDID:udid];
Expand Down
14 changes: 6 additions & 8 deletions xctool/xctool/SimulatorWrapper/SimulatorInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,11 @@
- (NSString *)testHostPath;
- (NSString *)productBundlePath;

+ (NSArray *)availableDevices;
+ (NSString *)deviceNameForAlias:(NSString *)deviceAlias;
+ (BOOL)isDeviceAvailableWithAlias:(NSString *)deviceName;
+ (BOOL)isSdkVersion:(NSString *)sdkVersion supportedByDevice:(NSString *)deviceName;
+ (NSArray *)availableSdkVersions;
+ (NSArray *)sdksSupportedByDevice:(NSString *)deviceName;
+ (cpu_type_t)cpuTypeForDevice:(NSString *)deviceName;
+ (SimDevice *)deviceWithUDID:(NSUUID *)deviceUDID;
- (NSArray *)availableDevices;
- (NSString *)deviceNameForAlias:(NSString *)deviceAlias;
- (BOOL)isDeviceAvailableWithAlias:(NSString *)deviceName;
- (BOOL)isSdkVersion:(NSString *)sdkVersion supportedByDevice:(NSString *)deviceName;
- (NSArray *)sdksSupportedByDevice:(NSString *)deviceName;
- (SimDevice *)deviceWithUDID:(NSUUID *)deviceUDID;

@end
Loading

0 comments on commit d89710d

Please sign in to comment.