Do NOT use direct launch when video recording is enabled in Xcode 10

Summary:
See title. In Xcode 10 video recording doesn't work on direct launched simulator,
but works on simulators launched Simulator.app, so we don't use direct launch in this case.

Reviewed By: lawrencelomax

Differential Revision: D10147771

fbshipit-source-id: aea7b735e440148b7a32debcb5a6766830953398
This commit is contained in:
Yingliu Chen 2018-10-03 06:39:37 -07:00 коммит произвёл Facebook Github Bot
Родитель 88aefcc29a
Коммит a913056419
3 изменённых файлов: 23 добавлений и 1 удалений

Просмотреть файл

@ -64,6 +64,11 @@ NS_ASSUME_NONNULL_BEGIN
*/ */
@property (nonatomic, assign, readonly, class) BOOL isXcode9OrGreater; @property (nonatomic, assign, readonly, class) BOOL isXcode9OrGreater;
/**
YES if Xcode 10 or greater, NO Otherwise.
*/
@property (nonatomic, assign, readonly, class) BOOL isXcode10OrGreater;
/** /**
YES if passing a custom SimDeviceSet to the Simulator App is Supported. YES if passing a custom SimDeviceSet to the Simulator App is Supported.
*/ */

Просмотреть файл

@ -97,6 +97,11 @@
return [FBXcodeConfiguration.xcodeVersionNumber compare:[NSDecimalNumber decimalNumberWithString:@"9.0"]] != NSOrderedAscending; return [FBXcodeConfiguration.xcodeVersionNumber compare:[NSDecimalNumber decimalNumberWithString:@"9.0"]] != NSOrderedAscending;
} }
+ (BOOL)isXcode10OrGreater
{
return [FBXcodeConfiguration.xcodeVersionNumber compare:[NSDecimalNumber decimalNumberWithString:@"10.0"]] != NSOrderedAscending;
}
+ (BOOL)supportsCustomDeviceSets + (BOOL)supportsCustomDeviceSets
{ {
// Prior to Xcode 7, 'iOS Simulator.app' calls `+[SimDeviceSet defaultSet]` directly // Prior to Xcode 7, 'iOS Simulator.app' calls `+[SimDeviceSet defaultSet]` directly

Просмотреть файл

@ -82,9 +82,21 @@
- (FBFuture<FBSimulator *> *)fetchSimulatorForApplicationTest:(FBXCTestDestinationiPhoneSimulator *)destination - (FBFuture<FBSimulator *> *)fetchSimulatorForApplicationTest:(FBXCTestDestinationiPhoneSimulator *)destination
{ {
FBSimulatorBootOptions options = FBSimulatorBootOptionsEnableDirectLaunch | FBSimulatorBootOptionsVerifyUsable;
if (FBXcodeConfiguration.isXcode10OrGreater) {
NSMutableDictionary<NSString *, NSString *> *environment = [NSProcessInfo.processInfo.environment mutableCopy];
NSString *videoRecordingPath = environment[@"FBXCTEST_VIDEO_RECORDING_PATH"];
if (videoRecordingPath != nil) {
// rdar://44907260
// In Xcode 10, we need to launch Simulator.app to setup simulator properly for enabling video recording.
options &= ~FBSimulatorBootOptionsEnableDirectLaunch;
}
}
FBSimulatorBootConfiguration *bootConfiguration = [[FBSimulatorBootConfiguration FBSimulatorBootConfiguration *bootConfiguration = [[FBSimulatorBootConfiguration
defaultConfiguration] defaultConfiguration]
withOptions:FBSimulatorBootOptionsEnableDirectLaunch | FBSimulatorBootOptionsVerifyUsable]; withOptions:options];
return [[self return [[self
fetchSimulatorForLogicTest:destination] fetchSimulatorForLogicTest:destination]