Travis CI reliability fixes: preload package manager and increase tim…

Summary:
- Consolidate common code in iOS and tvOS test scripts
- Start the packager before starting tests, to improve reliability
- Increase timeout value in RCTTestRunner.m
Closes https://github.com/facebook/react-native/pull/10378

Differential Revision: D4028364

Pulled By: bestander

fbshipit-source-id: 24c2124a1c62643a02f0668b60a67b971e08d1a3
This commit is contained in:
dlowder-salesforce
2016-10-16 15:37:45 -07:00
committed by Facebook Github Bot
parent f8b0728d9b
commit 64a4c6070d
13 changed files with 187 additions and 56 deletions

View File

@@ -8,9 +8,19 @@
/* Begin PBXBuildFile section */
148699CF1ABD045300480536 /* RCTPushNotificationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 148699CE1ABD045300480536 /* RCTPushNotificationManager.m */; };
2DD0EFEF1DA8534500B0C975 /* RCTPushNotificationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 148699CE1ABD045300480536 /* RCTPushNotificationManager.m */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
2DD0EFE41DA8533A00B0C975 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "include/$(PRODUCT_NAME)";
dstSubfolderSpec = 16;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
58B511D91A9E6C8500147676 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
@@ -26,9 +36,17 @@
134814201AA4EA6300B7C361 /* libRCTPushNotification.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTPushNotification.a; sourceTree = BUILT_PRODUCTS_DIR; };
148699CD1ABD045300480536 /* RCTPushNotificationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTPushNotificationManager.h; sourceTree = "<group>"; };
148699CE1ABD045300480536 /* RCTPushNotificationManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPushNotificationManager.m; sourceTree = "<group>"; };
2DD0EFE61DA8533A00B0C975 /* libRCTPushNotification-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libRCTPushNotification-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
2DD0EFE31DA8533A00B0C975 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
58B511D81A9E6C8500147676 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@@ -53,6 +71,7 @@
148699CD1ABD045300480536 /* RCTPushNotificationManager.h */,
148699CE1ABD045300480536 /* RCTPushNotificationManager.m */,
134814211AA4EA7D00B7C361 /* Products */,
2DD0EFE61DA8533A00B0C975 /* libRCTPushNotification-tvOS.a */,
);
indentWidth = 2;
sourceTree = "<group>";
@@ -61,6 +80,23 @@
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
2DD0EFE51DA8533A00B0C975 /* RCTPushNotification-tvOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = 2DD0EFEE1DA8533A00B0C975 /* Build configuration list for PBXNativeTarget "RCTPushNotification-tvOS" */;
buildPhases = (
2DD0EFE21DA8533A00B0C975 /* Sources */,
2DD0EFE31DA8533A00B0C975 /* Frameworks */,
2DD0EFE41DA8533A00B0C975 /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = "RCTPushNotification-tvOS";
productName = "RCTPushNotification-tvOS";
productReference = 2DD0EFE61DA8533A00B0C975 /* libRCTPushNotification-tvOS.a */;
productType = "com.apple.product-type.library.static";
};
58B511DA1A9E6C8500147676 /* RCTPushNotification */ = {
isa = PBXNativeTarget;
buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTPushNotification" */;
@@ -87,6 +123,10 @@
LastUpgradeCheck = 0610;
ORGANIZATIONNAME = Facebook;
TargetAttributes = {
2DD0EFE51DA8533A00B0C975 = {
CreatedOnToolsVersion = 8.0;
ProvisioningStyle = Automatic;
};
58B511DA1A9E6C8500147676 = {
CreatedOnToolsVersion = 6.1.1;
};
@@ -105,11 +145,20 @@
projectRoot = "";
targets = (
58B511DA1A9E6C8500147676 /* RCTPushNotification */,
2DD0EFE51DA8533A00B0C975 /* RCTPushNotification-tvOS */,
);
};
/* End PBXProject section */
/* Begin PBXSourcesBuildPhase section */
2DD0EFE21DA8533A00B0C975 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
2DD0EFEF1DA8534500B0C975 /* RCTPushNotificationManager.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
58B511D71A9E6C8500147676 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@@ -121,6 +170,56 @@
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
2DD0EFEC1DA8533A00B0C975 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NONNULL = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_SUSPICIOUS_MOVES = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_TESTABILITY = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../../React/**",
);
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TVOS_DEPLOYMENT_TARGET = 9.2;
};
name = Debug;
};
2DD0EFED1DA8533A00B0C975 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NONNULL = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_SUSPICIOUS_MOVES = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_NO_COMMON_BLOCKS = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../../React/**",
);
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TVOS_DEPLOYMENT_TARGET = 9.2;
};
name = Release;
};
58B511ED1A9E6C8500147676 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -242,6 +341,14 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
2DD0EFEE1DA8533A00B0C975 /* Build configuration list for PBXNativeTarget "RCTPushNotification-tvOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
2DD0EFEC1DA8533A00B0C975 /* Debug */,
2DD0EFED1DA8533A00B0C975 /* Release */,
);
defaultConfigurationIsVisible = 0;
};
58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTPushNotification" */ = {
isa = XCConfigurationList;
buildConfigurations = (

View File

@@ -11,10 +11,12 @@
@interface RCTPushNotificationManager : RCTEventEmitter
#if !TARGET_OS_TV
+ (void)didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings;
+ (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken;
+ (void)didReceiveRemoteNotification:(NSDictionary *)notification;
+ (void)didReceiveLocalNotification:(UILocalNotification *)notification;
+ (void)didFailToRegisterForRemoteNotificationsWithError:(NSError *)error;
#endif
@end

View File

@@ -22,6 +22,7 @@ NSString *const RCTRegisterUserNotificationSettings = @"RegisterUserNotification
NSString *const RCTErrorUnableToRequestPermissions = @"E_UNABLE_TO_REQUEST_PERMISSIONS";
NSString *const RCTErrorRemoteNotificationRegistrationFailed = @"E_FAILED_TO_REGISTER_FOR_REMOTE_NOTIFICATIONS";
#if !TARGET_OS_TV
@implementation RCTConvert (NSCalendarUnit)
RCT_ENUM_CONVERTER(NSCalendarUnit,
@@ -58,12 +59,15 @@ RCT_ENUM_CONVERTER(NSCalendarUnit,
}
@end
#endif //TARGET_OS_TV
@implementation RCTPushNotificationManager
{
RCTPromiseResolveBlock _requestPermissionsResolveBlock;
}
#if !TARGET_OS_TV
static NSDictionary *RCTFormatLocalNotification(UILocalNotification *notification)
{
NSMutableDictionary *formattedLocalNotification = [NSMutableDictionary dictionary];
@@ -83,6 +87,8 @@ static NSDictionary *RCTFormatLocalNotification(UILocalNotification *notificatio
return formattedLocalNotification;
}
#endif //TARGET_OS_TV
RCT_EXPORT_MODULE()
- (dispatch_queue_t)methodQueue
@@ -127,6 +133,8 @@ RCT_EXPORT_MODULE()
@"remoteNotificationRegistrationError"];
}
#if !TARGET_OS_TV
+ (void)didRegisterUserNotificationSettings:(__unused UIUserNotificationSettings *)notificationSettings
{
if ([UIApplication instancesRespondToSelector:@selector(registerForRemoteNotifications)]) {
@@ -358,4 +366,6 @@ RCT_EXPORT_METHOD(getScheduledLocalNotifications:(RCTResponseSenderBlock)callbac
callback(@[formattedScheduledLocalNotifications]);
}
#endif //TARGET_OS_TV
@end