From f9c87d76db4b6516e9f5b8119422e2124cbefbe7 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sun, 21 Aug 2016 02:07:04 -0400 Subject: [PATCH] Fix SparkleCore build issues in Release configuration We don't import SPUUserDriverUIComponent in SparkleCore because it is an exported class a part of Sparkle framework, which causes issues. Instead, we import SPUApplicationInfo which is not exported from Sparkle. --- Sparkle.xcodeproj/project.pbxproj | 5 ++--- sparkle-cli/SPUCommandLineUserDriver.m | 14 ++++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index c2bb19bc..1e980355 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -332,7 +332,6 @@ 72A5D5F01D692C4B0009E5AC /* Updater.app in CopyFiles */ = {isa = PBXBuildFile; fileRef = 721C24451CB753E6005440CB /* Updater.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 72A5D5F41D692CF50009E5AC /* SparkleCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 72A5D59C1D6927730009E5AC /* SparkleCore.framework */; }; 72A5D5F51D692CFE0009E5AC /* SparkleCore.framework in Copy Sparkle */ = {isa = PBXBuildFile; fileRef = 72A5D59C1D6927730009E5AC /* SparkleCore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 72A5D5F61D692D850009E5AC /* SPUUserDriverUIComponent.m in Sources */ = {isa = PBXBuildFile; fileRef = 72F9EC4A1D5F53A7004AC8B6 /* SPUUserDriverUIComponent.m */; }; 72A5D5F71D692D900009E5AC /* SPUApplicationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 725602D41C83551C00DAA70E /* SPUApplicationInfo.m */; }; 72A5D5F81D692F2B0009E5AC /* SUExport.h in Headers */ = {isa = PBXBuildFile; fileRef = 14652F8319A9759F00959E44 /* SUExport.h */; settings = {ATTRIBUTES = (Public, ); }; }; 72A5D5F91D692F4C0009E5AC /* SPUStatusCompletionResults.h in Headers */ = {isa = PBXBuildFile; fileRef = 726DF88D1C84277500188804 /* SPUStatusCompletionResults.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -2943,11 +2942,10 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 72A5D5F71D692D900009E5AC /* SPUApplicationInfo.m in Sources */, - 72A5D5F61D692D850009E5AC /* SPUUserDriverUIComponent.m in Sources */, 72D954A51CBB415C006F28BD /* main.m in Sources */, 72D954A21CBB415C006F28BD /* SPUCommandLineDriver.m in Sources */, 72D954B81CBB467F006F28BD /* SPUCommandLineUserDriver.m in Sources */, + 72A5D5F71D692D900009E5AC /* SPUApplicationInfo.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3851,6 +3849,7 @@ 72A5D5A31D6927730009E5AC /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; 72B398D61D3D879400EE297F /* Build configuration list for PBXNativeTarget "Autoupdate" */ = { isa = XCConfigurationList; diff --git a/sparkle-cli/SPUCommandLineUserDriver.m b/sparkle-cli/SPUCommandLineUserDriver.m index ae9baba7..daa6fd4b 100644 --- a/sparkle-cli/SPUCommandLineUserDriver.m +++ b/sparkle-cli/SPUCommandLineUserDriver.m @@ -10,7 +10,10 @@ #import #import #import "SPUUserDriverCoreComponent.h" -#import "SPUUserDriverUIComponent.h" // going to borrow this one class from Sparkle + +// Going to borrow this private class from Sparkle +// Note to compile properly, this class must not be exported (which is why we aren't importing SPUUserDriverUIComponent) +#import "SPUApplicationInfo.h" #define SCHEDULED_UPDATE_TIMER_THRESHOLD 2.0 // seconds @@ -21,7 +24,6 @@ @property (nonatomic, readonly) BOOL deferInstallation; @property (nonatomic, readonly) BOOL verbose; @property (nonatomic, readonly) SPUUserDriverCoreComponent *coreComponent; -@property (nonatomic, readonly) SPUUserDriverUIComponent *uiComponent; @property (nonatomic) NSUInteger bytesDownloaded; @property (nonatomic) NSUInteger bytesToDownload; @@ -34,7 +36,6 @@ @synthesize deferInstallation = _deferInstallation; @synthesize verbose = _verbose; @synthesize coreComponent = _coreComponent; -@synthesize uiComponent = _uiComponent; @synthesize bytesDownloaded = _bytesDownloaded; @synthesize bytesToDownload = _bytesToDownload; @@ -47,7 +48,6 @@ _deferInstallation = deferInstallation; _verbose = verbose; _coreComponent = [[SPUUserDriverCoreComponent alloc] init]; - _uiComponent = [[SPUUserDriverUIComponent alloc] init]; } return self; } @@ -272,7 +272,7 @@ fprintf(stderr, "Deferring Installation.\n"); } [self.coreComponent installUpdateWithChoice:SPUDismissUpdateInstallation]; - } else if ([self.uiComponent applicationIsAliveForBundle:self.applicationBundle]) { + } else if ([SPUApplicationInfo runningApplicationWithBundle:self.applicationBundle] != nil) { [self.coreComponent installUpdateWithChoice:SPUInstallAndRelaunchUpdateNow]; } else { [self.coreComponent installUpdateWithChoice:SPUInstallUpdateNow]; @@ -315,7 +315,9 @@ - (void)terminateApplication { dispatch_async(dispatch_get_main_queue(), ^{ - [self.uiComponent terminateApplicationForBundle:self.applicationBundle]; + for (NSRunningApplication *application in [SPUApplicationInfo runningApplicationsWithBundle:self.applicationBundle]) { + [application terminate]; + } }); }