Compare commits

..
4 Commits
Author SHA1 Message Date
Dmytro Tretiakov d3389883b8 Copied XPC service inside framework. 2016-02-22 13:58:17 +02:00
Dmytro Tretiakov 92baa74c99 Fixed compile warning. 2016-02-22 13:40:20 +02:00
Dmytro Tretiakov 12c2a52ddc Merge branch 'master' into develop
* master:
  Updated DMCore lib (fix of potential crash).
  Fixed build phase of test app for release configuration.
2016-02-18 16:59:56 +02:00
Dmytro Tretiakov 3c00c7a4f8 Corrected using beacon for installation process. 2016-02-18 16:57:53 +02:00
3 changed files with 59 additions and 24 deletions

No files matched your search

+21 -11
View File
@@ -108,11 +108,11 @@
331726DD1B4D625A008B2D77 /* SUWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61180BC90D64138900B4E0D1 /* SUWindowController.m */; };
331726E21B4D66EE008B2D77 /* DevMateSparkle.h in Headers */ = {isa = PBXBuildFile; fileRef = 331726DF1B4D6438008B2D77 /* DevMateSparkle.h */; settings = {ATTRIBUTES = (Public, ); }; };
331726E31B4D697E008B2D77 /* SUUpdaterLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 331726E11B4D65AA008B2D77 /* SUUpdaterLoader.m */; };
33545B8D1B4679080059250D /* com.devmate.UpdateInstaller.xpc in Embed XPC Services */ = {isa = PBXBuildFile; fileRef = 33545B811B4679080059250D /* com.devmate.UpdateInstaller.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
3329D9C41C7B03B800F1B058 /* com.devmate.UpdateInstaller.xpc in CopyFiles */ = {isa = PBXBuildFile; fileRef = 33545B811B4679080059250D /* com.devmate.UpdateInstaller.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
3329D9C61C7B217C00F1B058 /* com.devmate.UpdateInstaller.xpc in Copy XPC services */ = {isa = PBXBuildFile; fileRef = 33545B811B4679080059250D /* com.devmate.UpdateInstaller.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
33545B921B4679810059250D /* install_service.m in Sources */ = {isa = PBXBuildFile; fileRef = 33545B771B46774D0059250D /* install_service.m */; };
33545B931B4687CD0059250D /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; };
33545B941B468A160059250D /* SULog.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C14F05136EF6DB00649790 /* SULog.m */; };
33545B951B468A280059250D /* (null) in Sources */ = {isa = PBXBuildFile; };
33545B961B468A730059250D /* SUPlainInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 618FA5040DAE8AB80026945C /* SUPlainInstaller.m */; };
33545B971B468ABB0059250D /* SUCodeSigningVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B078CD15A5FB6100600039 /* SUCodeSigningVerifier.m */; };
33545B981B468AC80059250D /* SUInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 618FA5000DAE88B40026945C /* SUInstaller.m */; };
@@ -367,7 +367,7 @@
remoteGlobalIDString = 331726741B4D36F2008B2D77;
remoteInfo = DevMateSparkle_lib_resources;
};
33545B8B1B4679080059250D /* PBXContainerItemProxy */ = {
3329D9C11C7B03A700F1B058 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
proxyType = 1;
@@ -426,15 +426,25 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
33545B911B4679080059250D /* Embed XPC Services */ = {
3329D9C31C7B03AD00F1B058 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "$(CONTENTS_FOLDER_PATH)/XPCServices";
dstSubfolderSpec = 16;
files = (
33545B8D1B4679080059250D /* com.devmate.UpdateInstaller.xpc in Embed XPC Services */,
3329D9C41C7B03B800F1B058 /* com.devmate.UpdateInstaller.xpc in CopyFiles */,
);
name = "Embed XPC Services";
runOnlyForDeploymentPostprocessing = 0;
};
3329D9C51C7B216500F1B058 /* Copy XPC services */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "$(CONTENTS_FOLDER_PATH)/XPCServices";
dstSubfolderSpec = 16;
files = (
3329D9C61C7B217C00F1B058 /* com.devmate.UpdateInstaller.xpc in Copy XPC services */,
);
name = "Copy XPC services";
runOnlyForDeploymentPostprocessing = 0;
};
61B5FB4D09C4E9FA00B25A18 /* Copy Frameworks */ = {
@@ -1387,6 +1397,7 @@
331726731B4D36F2008B2D77 /* Resources */,
331726871B4D37B6008B2D77 /* Headers */,
331726921B4D37FA008B2D77 /* Run Script: Update Locales */,
3329D9C51C7B216500F1B058 /* Copy XPC services */,
);
buildRules = (
);
@@ -1496,13 +1507,11 @@
61B5F8FF09C4CEE200B25A18 /* Sources */,
61B5F90009C4CEE200B25A18 /* Frameworks */,
61B5FB4D09C4E9FA00B25A18 /* Copy Frameworks */,
33545B911B4679080059250D /* Embed XPC Services */,
);
buildRules = (
);
dependencies = (
61B5F91C09C4CF7200B25A18 /* PBXTargetDependency */,
33545B8C1B4679080059250D /* PBXTargetDependency */,
);
name = "Sparkle Test App";
productName = "Test Application";
@@ -1521,10 +1530,12 @@
6131B1910DDCDE32005215F0 /* Run Script: Set Git Version Info */,
6195D4B40E40505A00D41A50 /* Run Script: Link fr_CA to fr */,
61E31A85103299750051D188 /* Run Script: Link pt to pt_BR */,
3329D9C31C7B03AD00F1B058 /* CopyFiles */,
);
buildRules = (
);
dependencies = (
3329D9C21C7B03A700F1B058 /* PBXTargetDependency */,
55C14F97136F044100649790 /* PBXTargetDependency */,
);
name = Sparkle;
@@ -1857,7 +1868,6 @@
336475D11C5B984200813E67 /* SUOperatingSystem.m in Sources */,
33545B991B468AD60059250D /* SUGuidedPackageInstaller.m in Sources */,
33545B9A1B468AE30059250D /* SUPackageInstaller.m in Sources */,
33545B951B468A280059250D /* (null) in Sources */,
33545B961B468A730059250D /* SUPlainInstaller.m in Sources */,
33545B941B468A160059250D /* SULog.m in Sources */,
33545B921B4679810059250D /* install_service.m in Sources */,
@@ -2048,10 +2058,10 @@
target = 331726741B4D36F2008B2D77 /* DevMateSparkle_lib_resources */;
targetProxy = 331726B71B4D61A8008B2D77 /* PBXContainerItemProxy */;
};
33545B8C1B4679080059250D /* PBXTargetDependency */ = {
3329D9C21C7B03A700F1B058 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 33545B801B4679080059250D /* Installation XPC Service */;
targetProxy = 33545B8B1B4679080059250D /* PBXContainerItemProxy */;
targetProxy = 3329D9C11C7B03A700F1B058 /* PBXContainerItemProxy */;
};
55C14F97136F044100649790 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
+20 -10
View File
@@ -104,6 +104,8 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.5;
@property (nonatomic, assign) BOOL isTerminating;
@property (nonatomic, strong) NSConnection *installationBeacon;
@end
@implementation AppInstaller
@@ -116,6 +118,7 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.5;
@synthesize shouldRelaunch = _shouldRelaunch;
@synthesize shouldShowUI = _shouldShowUI;
@synthesize isTerminating = _isTerminating;
@synthesize installationBeacon = _installationBeacon;
- (instancetype)initWithHostPath:(NSString *)hostPath relaunchPath:(NSString *)relaunchPath parentProcessId:(pid_t)parentProcessId updateFolderPath:(NSString *)updateFolderPath shouldRelaunch:(BOOL)shouldRelaunch shouldShowUI:(BOOL)shouldShowUI
{
@@ -130,6 +133,18 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.5;
self.shouldRelaunch = shouldRelaunch;
self.shouldShowUI = shouldShowUI;
NSConnection *connection = [[NSConnection alloc] init];
[connection setRootObject:self];
NSString *connectionName = [NSString stringWithFormat:@"Sparkle-%@", [NSBundle bundleWithPath:hostPath].bundleIdentifier];
if ([connection registerName:connectionName])
{
self.installationBeacon = connection;
}
else
{
SULog(@"%@ server: could not register server. Is one already running?\n", [NSProcessInfo processInfo].processName);
}
return self;
}
@@ -221,6 +236,8 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.5;
}
[self.statusController close];
self.installationBeacon.rootObject = nil;
self.installationBeacon = nil;
// Don't even think about hiding the app icon from the dock if we've already shown it
// Transforming the app back to a background one has a backfiring effect, decreasing the likelihood
@@ -258,18 +275,11 @@ int main(int __unused argc, const char __unused *argv[])
updateFolderPath:args[4]
shouldRelaunch:(args.count > 5) ? [args[5] boolValue] : YES
shouldShowUI:shouldShowUI];
NSConnection *connection = [[NSConnection alloc] init];
[connection setRootObject:appInstaller];
if (![connection registerName:[NSString stringWithFormat:@"Sparkle-%@", [NSBundle bundleWithPath:appInstaller.hostPath].bundleIdentifier]])
{
SULog(@"%@ server: could not register server. Is one already running?\n", args.firstObject);
}
[application setDelegate:appInstaller];
application.delegate = appInstaller;
[application run];
// Ensure connection is not deallocated by ARC before caling -[NSApplication run]
[connection class];
// to avoid releaseing appInstaller by ARC
[appInstaller class];
}
return EXIT_SUCCESS;
+18 -3
View File
@@ -15,10 +15,25 @@ BOOL SUShouldUseXPCInstaller(void)
{
if (![SUCodeSigningVerifier hostApplicationIsSandboxed])
return NO;
NSDirectoryEnumerator *enumerator = [[NSFileManager defaultManager] enumeratorAtURL:[NSBundle mainBundle].bundleURL
includingPropertiesForKeys:nil
options:NSDirectoryEnumerationSkipsHiddenFiles
errorHandler:nil];
BOOL hasXPC = NO;
for (NSURL *URL in enumerator)
{
if (![URL.lastPathComponent isEqualToString:@"com.devmate.UpdateInstaller.xpc"])
continue;
if (![[URL URLByDeletingLastPathComponent].lastPathComponent isEqualToString:@"XPCServices"])
continue;
hasXPC = YES;
break;
}
NSString *xpcServicePrefixPath = [[NSBundle mainBundle] bundlePath];
NSString *xpcServiceSuffixPath = @"Contents/XPCServices/com.devmate.UpdateInstaller.xpc";
return [[NSFileManager defaultManager] fileExistsAtPath:[xpcServicePrefixPath stringByAppendingPathComponent:xpcServiceSuffixPath]];
return hasXPC;
}
@implementation SUXPCInstaller