Make sure XPC versions are synced with the framework version

This commit is contained in:
Zorg committed 2016-05-19 19:29:47 -04:00
1 parent 7c06ceb7e4
commit 83fe6adcba
4 files changed
+22 -17

No files matched your search

+1 -1
View File
@@ -44,7 +44,7 @@ APPCAST_DOWNLOADER_BUNDLE_ID = org.sparkle-project.${APPCAST_DOWNLOADER_PRODUCT_
UPDATE_DOWNLOADER_BUNDLE_ID = org.sparkle-project.${UPDATE_DOWNLOADER_PRODUCT_NAME}
REMOTE_MESSAGE_PORT_BUNDLE_ID = org.sparkle-project.${REMOTE_MESSAGE_PORT_PRODUCT_NAME}
GCC_PREPROCESSOR_DEFINITIONS_COMMON = SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME=$(SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) SPARKLE_AUTOMATED_DOWNGRADES=$(SPARKLE_AUTOMATED_DOWNGRADES) SPARKLE_APPEND_VERSION_NUMBER=$(SPARKLE_APPEND_VERSION_NUMBER) SPARKLE_BUNDLE_IDENTIFIER=\"$(SPARKLE_BUNDLE_IDENTIFIER)\" SPARKLE_RELAUNCH_TOOL_NAME=\"$(SPARKLE_RELAUNCH_TOOL_NAME)\" SPARKLE_INSTALLER_PROGRESS_TOOL_NAME=\"$(SPARKLE_INSTALLER_PROGRESS_TOOL_NAME)\" SPARKLE_ICON_NAME=\"$(SPARKLE_ICON_NAME)\" INSTALLER_LAUNCHER_BUNDLE_ID=\"${INSTALLER_LAUNCHER_BUNDLE_ID}\" APPCAST_DOWNLOADER_BUNDLE_ID=\"${APPCAST_DOWNLOADER_BUNDLE_ID}\" UPDATE_DOWNLOADER_BUNDLE_ID=\"${UPDATE_DOWNLOADER_BUNDLE_ID}\" REMOTE_MESSAGE_PORT_BUNDLE_ID=\"${REMOTE_MESSAGE_PORT_BUNDLE_ID}\" INSTALLER_LAUNCHER_PRODUCT_NAME=\"${INSTALLER_LAUNCHER_PRODUCT_NAME}\" APPCAST_DOWNLOADER_PRODUCT_NAME=\"${APPCAST_DOWNLOADER_PRODUCT_NAME}\" UPDATE_DOWNLOADER_PRODUCT_NAME=\"${UPDATE_DOWNLOADER_PRODUCT_NAME}\" REMOTE_MESSAGE_PORT_PRODUCT_NAME=\"${REMOTE_MESSAGE_PORT_PRODUCT_NAME}\"
GCC_PREPROCESSOR_DEFINITIONS_COMMON = SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME=$(SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) SPARKLE_AUTOMATED_DOWNGRADES=$(SPARKLE_AUTOMATED_DOWNGRADES) SPARKLE_APPEND_VERSION_NUMBER=$(SPARKLE_APPEND_VERSION_NUMBER) SPARKLE_BUNDLE_IDENTIFIER=\"$(SPARKLE_BUNDLE_IDENTIFIER)\" CURRENT_PROJECT_VERSION=\"$(CURRENT_PROJECT_VERSION)\" SPARKLE_RELAUNCH_TOOL_NAME=\"$(SPARKLE_RELAUNCH_TOOL_NAME)\" SPARKLE_INSTALLER_PROGRESS_TOOL_NAME=\"$(SPARKLE_INSTALLER_PROGRESS_TOOL_NAME)\" SPARKLE_ICON_NAME=\"$(SPARKLE_ICON_NAME)\" INSTALLER_LAUNCHER_BUNDLE_ID=\"${INSTALLER_LAUNCHER_BUNDLE_ID}\" APPCAST_DOWNLOADER_BUNDLE_ID=\"${APPCAST_DOWNLOADER_BUNDLE_ID}\" UPDATE_DOWNLOADER_BUNDLE_ID=\"${UPDATE_DOWNLOADER_BUNDLE_ID}\" REMOTE_MESSAGE_PORT_BUNDLE_ID=\"${REMOTE_MESSAGE_PORT_BUNDLE_ID}\" INSTALLER_LAUNCHER_PRODUCT_NAME=\"${INSTALLER_LAUNCHER_PRODUCT_NAME}\" APPCAST_DOWNLOADER_PRODUCT_NAME=\"${APPCAST_DOWNLOADER_PRODUCT_NAME}\" UPDATE_DOWNLOADER_PRODUCT_NAME=\"${UPDATE_DOWNLOADER_PRODUCT_NAME}\" REMOTE_MESSAGE_PORT_PRODUCT_NAME=\"${REMOTE_MESSAGE_PORT_PRODUCT_NAME}\"
CLANG_ENABLE_OBJC_ARC = YES
GCC_ENABLE_PASCAL_STRINGS = NO
+3 -11
View File
@@ -119,16 +119,8 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
return YES;
}
- (BOOL)checkATSIssueForBundleURL:(NSURL *)bundleURL getBundleExists:(BOOL *)bundleExists
- (BOOL)checkATSIssueForBundle:(NSBundle * _Nullable)bundle getBundleExists:(BOOL *)bundleExists
{
if (bundleURL == nil) {
if (bundleExists != NULL) {
*bundleExists = NO;
}
return NO;
}
NSBundle *bundle = [NSBundle bundleWithURL:bundleURL];
if (bundleExists != NULL) {
*bundleExists = (bundle != nil);
}
@@ -179,12 +171,12 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
BOOL servingOverHttps = [[[feedURL scheme] lowercaseString] isEqualToString:@"https"];
if (!servingOverHttps) {
BOOL foundXPCAppcastDownloaderService = NO;
BOOL foundATSAppcastIssue = [self checkATSIssueForBundleURL:SUXPCServiceURL(@APPCAST_DOWNLOADER_PRODUCT_NAME) getBundleExists:&foundXPCAppcastDownloaderService];
BOOL foundATSAppcastIssue = [self checkATSIssueForBundle:SUXPCServiceBundle(@APPCAST_DOWNLOADER_PRODUCT_NAME) getBundleExists:&foundXPCAppcastDownloaderService];
BOOL foundXPCUpdateDownloaderService = NO;
BOOL foundATSUpdateIssue = NO;
if (!foundATSAppcastIssue) {
foundATSUpdateIssue = [self checkATSIssueForBundleURL:SUXPCServiceURL(@UPDATE_DOWNLOADER_PRODUCT_NAME) getBundleExists:&foundXPCUpdateDownloaderService];
foundATSUpdateIssue = [self checkATSIssueForBundle:SUXPCServiceBundle(@UPDATE_DOWNLOADER_PRODUCT_NAME) getBundleExists:&foundXPCUpdateDownloaderService];
}
NSBundle *mainBundle = [NSBundle mainBundle];
+1 -1
View File
@@ -12,6 +12,6 @@ NS_ASSUME_NONNULL_BEGIN
BOOL SUXPCServiceExists(NSString *bundleName);
NSURL * _Nullable SUXPCServiceURL(NSString *bundleName);
NSBundle * _Nullable SUXPCServiceBundle(NSString *bundleName);
NS_ASSUME_NONNULL_END
+17 -4
View File
@@ -10,11 +10,24 @@
BOOL SUXPCServiceExists(NSString *bundleName)
{
NSURL *xpcBundleURL = SUXPCServiceURL(bundleName);
return (xpcBundleURL != nil && [xpcBundleURL checkResourceIsReachableAndReturnError:NULL]);
NSBundle *xpcBundle = SUXPCServiceBundle(bundleName);
if (xpcBundle == nil) {
return NO;
}
NSString *version = [xpcBundle objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
NSString *projectVersion = @""CURRENT_PROJECT_VERSION;
if (version == nil || ![version isEqualToString:projectVersion]) {
// Use NSLog instead of SULog here because this is a developer configuration error...
NSLog(@"Error: XPC Version mismatch. Framework version is %@ but XPC Service (%@) version is %@", projectVersion, xpcBundle.bundlePath, version);
NSLog(@"Not using XPC Service...");
return NO;
}
return YES;
}
NSURL * _Nullable SUXPCServiceURL(NSString *bundleName)
NSBundle * _Nullable SUXPCServiceBundle(NSString *bundleName)
{
NSBundle *mainBundle = [NSBundle mainBundle];
NSURL *executableURL = mainBundle.executableURL;
@@ -24,5 +37,5 @@ NSURL * _Nullable SUXPCServiceURL(NSString *bundleName)
NSURL *xpcBundleURL = [[[executableURL.URLByDeletingLastPathComponent.URLByDeletingLastPathComponent URLByAppendingPathComponent:@"XPCServices"] URLByAppendingPathComponent:bundleName] URLByAppendingPathExtension:@"xpc"];
return xpcBundleURL;
return [NSBundle bundleWithURL:xpcBundleURL];
}