Add test application code for Sparkle over XPC

This commit is contained in:
Zorg committed 2016-03-03 03:03:56 -05:00
1 parent ed00162faa
commit 8a42975dc2
15 files changed
+716 -4

No files matched your search

+1
View File
@@ -5,3 +5,4 @@ WRAPPER_EXTENSION = app
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon
LD_RUNPATH_SEARCH_PATHS = @executable_path/../Frameworks
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.SparkleTestApp
CODE_SIGN_ENTITLEMENTS = TestApplication/Sparkle-Test-App.entitlements
@@ -0,0 +1,2 @@
#include "ConfigTestAppHelper.xcconfig"
@@ -0,0 +1,6 @@
// Test Application Helper only
INFOPLIST_FILE = TestAppHelper/Info.plist
WRAPPER_EXTENSION = xpc
LD_RUNPATH_SEARCH_PATHS = @executable_path/../../../../Frameworks
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.TestAppHelper
@@ -0,0 +1 @@
#include "ConfigTestAppHelper.xcconfig"
+153 -2
View File
@@ -183,6 +183,13 @@
726DF88E1C84277600188804 /* SUStatusCompletionResults.h in Headers */ = {isa = PBXBuildFile; fileRef = 726DF88D1C84277500188804 /* SUStatusCompletionResults.h */; settings = {ATTRIBUTES = (Public, ); }; };
726E4A0E1C86881600C57C6A /* SUSparkleUserDriverUIDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 726E4A0D1C86881600C57C6A /* SUSparkleUserDriverUIDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
726E4A101C86B5A200C57C6A /* SUSparkleUserDriverRemoteDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 726E4A0F1C86B5A200C57C6A /* SUSparkleUserDriverRemoteDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
726E4A1B1C86C88F00C57C6A /* TestAppHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 726E4A1A1C86C88F00C57C6A /* TestAppHelper.m */; };
726E4A1D1C86C88F00C57C6A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 726E4A1C1C86C88F00C57C6A /* main.m */; };
726E4A211C86C88F00C57C6A /* TestAppHelper.xpc in Embed XPC Services */ = {isa = PBXBuildFile; fileRef = 726E4A161C86C88F00C57C6A /* TestAppHelper.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
726E4A2B1C87D56200C57C6A /* SUTestWebServer.m in Sources */ = {isa = PBXBuildFile; fileRef = A5BF4F1C1BC7668B007A052A /* SUTestWebServer.m */; };
726E4A301C87DC1700C57C6A /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* Sparkle.framework */; };
726E4A341C87E0C700C57C6A /* SURemoteUpdateSettingsWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 726E4A321C87E0C700C57C6A /* SURemoteUpdateSettingsWindowController.m */; };
726E4A351C87E0C700C57C6A /* SURemoteUpdateSettingsWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 726E4A331C87E0C700C57C6A /* SURemoteUpdateSettingsWindowController.xib */; };
726F2CDE1BC9BE5B001971A4 /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */; };
726F2CE51BC9C33D001971A4 /* SUOperatingSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 726F2CE31BC9C33D001971A4 /* SUOperatingSystem.h */; };
726F2CE61BC9C33D001971A4 /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; };
@@ -211,7 +218,6 @@
767B61AC1972D488004E0C3C /* SUGuidedPackageInstaller.h in Headers */ = {isa = PBXBuildFile; fileRef = 767B61AA1972D488004E0C3C /* SUGuidedPackageInstaller.h */; };
767B61AD1972D488004E0C3C /* SUGuidedPackageInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 767B61AB1972D488004E0C3C /* SUGuidedPackageInstaller.m */; };
767B61AE1972D488004E0C3C /* SUGuidedPackageInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 767B61AB1972D488004E0C3C /* SUGuidedPackageInstaller.m */; };
A5BF4F1D1BC7668B007A052A /* SUTestWebServer.m in Sources */ = {isa = PBXBuildFile; fileRef = A5BF4F1C1BC7668B007A052A /* SUTestWebServer.m */; };
C23E885B1BE7B24F0050BB73 /* SparkleTestCodeSignApp.enc.dmg in Resources */ = {isa = PBXBuildFile; fileRef = C23E88591BE7AF890050BB73 /* SparkleTestCodeSignApp.enc.dmg */; };
F8761EB11ADC5068000C9034 /* SUCodeSigningVerifierTest.m in Sources */ = {isa = PBXBuildFile; fileRef = F8761EB01ADC5068000C9034 /* SUCodeSigningVerifierTest.m */; };
F8761EB31ADC50EB000C9034 /* SparkleTestCodeSignApp.zip in Resources */ = {isa = PBXBuildFile; fileRef = F8761EB21ADC50EB000C9034 /* SparkleTestCodeSignApp.zip */; };
@@ -317,6 +323,13 @@
remoteGlobalIDString = 61B5F90109C4CEE200B25A18;
remoteInfo = "Sparkle Test App";
};
726E4A1F1C86C88F00C57C6A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 726E4A151C86C88F00C57C6A;
remoteInfo = TestAppHelper;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
@@ -352,6 +365,17 @@
name = "Copy Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
726E4A261C86C88F00C57C6A /* Embed XPC Services */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "$(CONTENTS_FOLDER_PATH)/XPCServices";
dstSubfolderSpec = 16;
files = (
726E4A211C86C88F00C57C6A /* TestAppHelper.xpc in Embed XPC Services */,
);
name = "Embed XPC Services";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
@@ -646,6 +670,19 @@
726DF88D1C84277500188804 /* SUStatusCompletionResults.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUStatusCompletionResults.h; sourceTree = "<group>"; };
726E4A0D1C86881600C57C6A /* SUSparkleUserDriverUIDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUSparkleUserDriverUIDelegate.h; sourceTree = "<group>"; };
726E4A0F1C86B5A200C57C6A /* SUSparkleUserDriverRemoteDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUSparkleUserDriverRemoteDelegate.h; sourceTree = "<group>"; };
726E4A111C86C44A00C57C6A /* Sparkle-Test-App.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "Sparkle-Test-App.entitlements"; sourceTree = "<group>"; };
726E4A161C86C88F00C57C6A /* TestAppHelper.xpc */ = {isa = PBXFileReference; explicitFileType = "wrapper.xpc-service"; includeInIndex = 0; path = TestAppHelper.xpc; sourceTree = BUILT_PRODUCTS_DIR; };
726E4A181C86C88F00C57C6A /* TestAppHelperProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TestAppHelperProtocol.h; sourceTree = "<group>"; };
726E4A191C86C88F00C57C6A /* TestAppHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TestAppHelper.h; sourceTree = "<group>"; };
726E4A1A1C86C88F00C57C6A /* TestAppHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TestAppHelper.m; sourceTree = "<group>"; };
726E4A1C1C86C88F00C57C6A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
726E4A1E1C86C88F00C57C6A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
726E4A271C86CAB500C57C6A /* ConfigTestAppDebugHelper.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigTestAppDebugHelper.xcconfig; sourceTree = "<group>"; };
726E4A281C86CAB500C57C6A /* ConfigTestAppHelper.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigTestAppHelper.xcconfig; sourceTree = "<group>"; };
726E4A291C86CAB500C57C6A /* ConfigTestAppReleaseHelper.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigTestAppReleaseHelper.xcconfig; sourceTree = "<group>"; };
726E4A311C87E0C700C57C6A /* SURemoteUpdateSettingsWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SURemoteUpdateSettingsWindowController.h; sourceTree = "<group>"; };
726E4A321C87E0C700C57C6A /* SURemoteUpdateSettingsWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SURemoteUpdateSettingsWindowController.m; sourceTree = "<group>"; };
726E4A331C87E0C700C57C6A /* SURemoteUpdateSettingsWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SURemoteUpdateSettingsWindowController.xib; sourceTree = "<group>"; };
726F2CE31BC9C33D001971A4 /* SUOperatingSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUOperatingSystem.h; sourceTree = "<group>"; };
726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUOperatingSystem.m; sourceTree = "<group>"; };
7275F9BF1B5F1F2900B1D19E /* SUFileManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUFileManager.h; sourceTree = "<group>"; };
@@ -753,6 +790,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
726E4A131C86C88F00C57C6A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
726E4A301C87DC1700C57C6A /* Sparkle.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
8DC2EF560486A6940098B216 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@@ -780,6 +825,7 @@
612279D90DB5470200AB99EA /* Sparkle Unit Tests.xctest */,
8DC2EF5B0486A6940098B216 /* Sparkle.framework */,
726B2B5D1C645FC900388755 /* UI Tests.xctest */,
726E4A161C86C88F00C57C6A /* TestAppHelper.xpc */,
);
name = Products;
sourceTree = "<group>";
@@ -1065,6 +1111,8 @@
61B5F91D09C4CF7F00B25A18 /* Test Application */ = {
isa = PBXGroup;
children = (
726E4A171C86C88F00C57C6A /* TestAppHelper */,
726E4A111C86C44A00C57C6A /* Sparkle-Test-App.entitlements */,
72E45DDC1B65C3BD005C701A /* sign_update */,
61B5F92A09C4CFD800B25A18 /* InfoPlist.strings */,
61B5F92409C4CFC900B25A18 /* main.m */,
@@ -1077,6 +1125,9 @@
72E45CF41B640DAE005C701A /* SUUpdateSettingsWindowController.h */,
72E45CF51B640DAE005C701A /* SUUpdateSettingsWindowController.m */,
72E45CF61B640DAE005C701A /* SUUpdateSettingsWindowController.xib */,
726E4A311C87E0C700C57C6A /* SURemoteUpdateSettingsWindowController.h */,
726E4A321C87E0C700C57C6A /* SURemoteUpdateSettingsWindowController.m */,
726E4A331C87E0C700C57C6A /* SURemoteUpdateSettingsWindowController.xib */,
72E45CFD1B641D0D005C701A /* test_app_only_dsa_priv_dont_ever_do_this_for_real.pem */,
14732BBF1960F0AC00593899 /* test_app_only_dsa_pub.pem */,
61B5F90409C4CEE200B25A18 /* TestApplication-Info.plist */,
@@ -1140,6 +1191,19 @@
path = "UI Tests";
sourceTree = "<group>";
};
726E4A171C86C88F00C57C6A /* TestAppHelper */ = {
isa = PBXGroup;
children = (
726E4A181C86C88F00C57C6A /* TestAppHelperProtocol.h */,
726E4A191C86C88F00C57C6A /* TestAppHelper.h */,
726E4A1A1C86C88F00C57C6A /* TestAppHelper.m */,
726E4A1C1C86C88F00C57C6A /* main.m */,
726E4A1E1C86C88F00C57C6A /* Info.plist */,
);
name = TestAppHelper;
path = ../TestAppHelper;
sourceTree = "<group>";
};
FA1941C40D94A6EA00DD942E /* Configurations */ = {
isa = PBXGroup;
children = (
@@ -1160,6 +1224,9 @@
FA1941CD0D94A70100DD942E /* ConfigTestApp.xcconfig */,
FA1941CB0D94A70100DD942E /* ConfigTestAppDebug.xcconfig */,
FA1941D20D94A70100DD942E /* ConfigTestAppRelease.xcconfig */,
726E4A281C86CAB500C57C6A /* ConfigTestAppHelper.xcconfig */,
726E4A271C86CAB500C57C6A /* ConfigTestAppDebugHelper.xcconfig */,
726E4A291C86CAB500C57C6A /* ConfigTestAppReleaseHelper.xcconfig */,
FA3AAF3B1050B273004B3130 /* ConfigUnitTest.xcconfig */,
149B78641B7D3A4800D7D62C /* ConfigUnitTestCoverage.xcconfig */,
FA3AAF3A1050B273004B3130 /* ConfigUnitTestDebug.xcconfig */,
@@ -1335,11 +1402,13 @@
61B5F8FF09C4CEE200B25A18 /* Sources */,
61B5F90009C4CEE200B25A18 /* Frameworks */,
61B5FB4D09C4E9FA00B25A18 /* Copy Frameworks */,
726E4A261C86C88F00C57C6A /* Embed XPC Services */,
);
buildRules = (
);
dependencies = (
61B5F91C09C4CF7200B25A18 /* PBXTargetDependency */,
726E4A201C86C88F00C57C6A /* PBXTargetDependency */,
);
name = "Sparkle Test App";
productName = "Test Application";
@@ -1364,6 +1433,23 @@
productReference = 726B2B5D1C645FC900388755 /* UI Tests.xctest */;
productType = "com.apple.product-type.bundle.ui-testing";
};
726E4A151C86C88F00C57C6A /* TestAppHelper */ = {
isa = PBXNativeTarget;
buildConfigurationList = 726E4A221C86C88F00C57C6A /* Build configuration list for PBXNativeTarget "TestAppHelper" */;
buildPhases = (
726E4A121C86C88F00C57C6A /* Sources */,
726E4A131C86C88F00C57C6A /* Frameworks */,
726E4A141C86C88F00C57C6A /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = TestAppHelper;
productName = TestAppHelper;
productReference = 726E4A161C86C88F00C57C6A /* TestAppHelper.xpc */;
productType = "com.apple.product-type.xpc-service";
};
8DC2EF4F0486A6940098B216 /* Sparkle */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "Sparkle" */;
@@ -1402,10 +1488,20 @@
612279D80DB5470200AB99EA = {
TestTargetID = 8DC2EF4F0486A6940098B216;
};
61B5F90109C4CEE200B25A18 = {
SystemCapabilities = {
com.apple.Sandbox = {
enabled = 1;
};
};
};
726B2B5C1C645FC900388755 = {
CreatedOnToolsVersion = 7.2.1;
TestTargetID = 61B5F90109C4CEE200B25A18;
};
726E4A151C86C88F00C57C6A = {
CreatedOnToolsVersion = 7.2.1;
};
};
};
buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "Sparkle" */;
@@ -1467,6 +1563,7 @@
targets = (
8DC2EF4F0486A6940098B216 /* Sparkle */,
61B5F90109C4CEE200B25A18 /* Sparkle Test App */,
726E4A151C86C88F00C57C6A /* TestAppHelper */,
612279D80DB5470200AB99EA /* Sparkle Unit Tests */,
5D06E8CF0FD68C7C005AE3F6 /* BinaryDelta */,
55C14BB6136EEF1500649790 /* Autoupdate */,
@@ -1511,6 +1608,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
726E4A351C87E0C700C57C6A /* SURemoteUpdateSettingsWindowController.xib in Resources */,
1420DF50196247F900203BB0 /* Images.xcassets in Resources */,
61B5F92E09C4CFD800B25A18 /* InfoPlist.strings in Resources */,
61B5F92F09C4CFD800B25A18 /* MainMenu.xib in Resources */,
@@ -1530,6 +1628,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
726E4A141C86C88F00C57C6A /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
8DC2EF520486A6940098B216 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
@@ -1677,10 +1782,11 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
726E4A2B1C87D56200C57C6A /* SUTestWebServer.m in Sources */,
726E4A341C87E0C700C57C6A /* SURemoteUpdateSettingsWindowController.m in Sources */,
61B5F93009C4CFDC00B25A18 /* main.m in Sources */,
726F2CEB1BC9C733001971A4 /* SUConstants.m in Sources */,
72E45CF31B640CDD005C701A /* SUTestApplicationDelegate.m in Sources */,
A5BF4F1D1BC7668B007A052A /* SUTestWebServer.m in Sources */,
72E45CF71B640DAE005C701A /* SUUpdateSettingsWindowController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -1693,6 +1799,15 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
726E4A121C86C88F00C57C6A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
726E4A1D1C86C88F00C57C6A /* main.m in Sources */,
726E4A1B1C86C88F00C57C6A /* TestAppHelper.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
8DC2EF540486A6940098B216 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@@ -1811,6 +1926,11 @@
target = 61B5F90109C4CEE200B25A18 /* Sparkle Test App */;
targetProxy = 726B2B621C645FC900388755 /* PBXContainerItemProxy */;
};
726E4A201C86C88F00C57C6A /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 726E4A151C86C88F00C57C6A /* TestAppHelper */;
targetProxy = 726E4A1F1C86C88F00C57C6A /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
@@ -2215,6 +2335,27 @@
};
name = Release;
};
726E4A231C86C88F00C57C6A /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 726E4A271C86CAB500C57C6A /* ConfigTestAppDebugHelper.xcconfig */;
buildSettings = {
};
name = Debug;
};
726E4A241C86C88F00C57C6A /* Coverage */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 726E4A271C86CAB500C57C6A /* ConfigTestAppDebugHelper.xcconfig */;
buildSettings = {
};
name = Coverage;
};
726E4A251C86C88F00C57C6A /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 726E4A291C86CAB500C57C6A /* ConfigTestAppReleaseHelper.xcconfig */;
buildSettings = {
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@@ -2318,6 +2459,16 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
726E4A221C86C88F00C57C6A /* Build configuration list for PBXNativeTarget "TestAppHelper" */ = {
isa = XCConfigurationList;
buildConfigurations = (
726E4A231C86C88F00C57C6A /* Debug */,
726E4A241C86C88F00C57C6A /* Coverage */,
726E4A251C86C88F00C57C6A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 0867D690FE84028FC02AAC07 /* Project object */;
+40
View File
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>TestAppHelper</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2016 Sparkle Project. All rights reserved.</string>
<key>XPCService</key>
<dict>
<key>RunLoopType</key>
<string>NSRunLoop</string>
<key>ServiceType</key>
<string>Application</string>
</dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
</dict>
</plist>
+19
View File
@@ -0,0 +1,19 @@
//
// TestAppHelper.h
// TestAppHelper
//
// Created by Mayur Pawashe on 3/2/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "TestAppHelperProtocol.h"
@protocol SUUserDriver;
// This object implements the protocol which we have defined. It provides the actual behavior for the service. It is 'exported' by the service to make it available to the process hosting the service over an NSXPCConnection.
@interface TestAppHelper : NSObject <TestAppHelperProtocol>
- (instancetype)initWithUserDriver:(id <SUUserDriver>)userDriver;
@end
+108
View File
@@ -0,0 +1,108 @@
//
// TestAppHelper.m
// TestAppHelper
//
// Created by Mayur Pawashe on 3/2/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import "TestAppHelper.h"
#import <Sparkle/Sparkle.h>
@interface TestAppHelper ()
@property (nonatomic) SUUpdater *updater;
@property (nonatomic) id <SUUserDriver> userDriver;
@end
@implementation TestAppHelper
@synthesize updater = _updater;
@synthesize userDriver = _userDriver;
- (instancetype)initWithUserDriver:(id <SUUserDriver>)userDriver
{
self = [super init];
if (self != nil) {
_userDriver = userDriver;
}
return self;
}
- (void)startSparkleIfNeeded
{
if (self.updater == nil) {
NSURL *appURL = [[[[[NSBundle mainBundle] bundleURL] URLByDeletingLastPathComponent] URLByDeletingLastPathComponent] URLByDeletingLastPathComponent];
NSBundle *hostBundle = [NSBundle bundleWithURL:appURL];
self.updater = [[SUUpdater alloc] initWithHostBundle:hostBundle userDriver:self.userDriver delegate:nil];
}
}
- (void)startSparkle
{
dispatch_async(dispatch_get_main_queue(), ^{
[self startSparkleIfNeeded];
});
}
- (void)initiateUserCheckForUpdates
{
dispatch_async(dispatch_get_main_queue(), ^{
[self startSparkleIfNeeded];
[self.updater checkForUpdates];
});
}
- (void)checkForUpdates
{
dispatch_async(dispatch_get_main_queue(), ^{
[self startSparkleIfNeeded];
[self.updater resetUpdateCycle];
});
}
- (void)retrieveUpdateSettings:(void (^)(BOOL automaticallyCheckForUpdates, BOOL automaticallyDownloadUpdates, BOOL sendSystemProfile, NSTimeInterval updateCheckInterval))reply
{
dispatch_async(dispatch_get_main_queue(), ^{
[self startSparkleIfNeeded];
reply(self.updater.automaticallyChecksForUpdates, self.updater.automaticallyDownloadsUpdates, self.updater.sendsSystemProfile, self.updater.updateCheckInterval);
});
}
- (void)setAutomaticallyChecksForUpdates:(BOOL)automaticallyChecksForUpdates
{
dispatch_async(dispatch_get_main_queue(), ^{
[self startSparkleIfNeeded];
self.updater.automaticallyChecksForUpdates = automaticallyChecksForUpdates;
[self.updater resetUpdateCycleAfterShortDelay];
});
}
- (void)setAutomaticallyDownloadsUpdates:(BOOL)automaticallyDownloadsUpdates
{
dispatch_async(dispatch_get_main_queue(), ^{
[self startSparkleIfNeeded];
self.updater.automaticallyDownloadsUpdates = automaticallyDownloadsUpdates;
});
}
- (void)setSendsSystemProfile:(BOOL)sendsSystemProfile
{
dispatch_async(dispatch_get_main_queue(), ^{
[self startSparkleIfNeeded];
self.updater.sendsSystemProfile = sendsSystemProfile;
});
}
- (void)setUpdateCheckInterval:(NSTimeInterval)updateCheckInterval
{
dispatch_async(dispatch_get_main_queue(), ^{
[self startSparkleIfNeeded];
self.updater.updateCheckInterval = updateCheckInterval;
[self.updater resetUpdateCycleAfterShortDelay];
});
}
@end
+49
View File
@@ -0,0 +1,49 @@
//
// TestAppHelperProtocol.h
// TestAppHelper
//
// Created by Mayur Pawashe on 3/2/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
// The protocol that this service will vend as its API. This header file will also need to be visible to the process hosting the service.
@protocol TestAppHelperProtocol
// Start up Sparkle
- (void)startSparkle;
// Check for updates when the user wants to check for them explicitly
- (void)initiateUserCheckForUpdates;
// Check for updates, only bringing a prompt when an update is available and not skipped
- (void)checkForUpdates;
- (void)retrieveUpdateSettings:(void (^)(BOOL automaticallyCheckForUpdates, BOOL automaticallyDownloadUpdates, BOOL sendSystemProfile, NSTimeInterval updateCheckInterval))reply;
- (void)setAutomaticallyChecksForUpdates:(BOOL)automaticallyChecksForUpdates;
- (void)setAutomaticallyDownloadsUpdates:(BOOL)automaticallyDownloadsUpdates;
- (void)setSendsSystemProfile:(BOOL)sendsSystemProfile;
- (void)setUpdateCheckInterval:(NSTimeInterval)updateCheckInterval;
@end
/*
To use the service from an application or other process, use NSXPCConnection to establish a connection to the service by doing something like this:
_connectionToService = [[NSXPCConnection alloc] initWithServiceName:@"org.sparkle-project.TestAppHelper"];
_connectionToService.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(StringModifing)];
[_connectionToService resume];
Once you have a connection to the service, you can use it like this:
[[_connectionToService remoteObjectProxy] upperCaseString:@"hello" withReply:^(NSString *aString) {
// We have received a response. Update our text field, but do it on the main thread.
NSLog(@"Result string was: %@", aString);
}];
And, when you are finished with the service, clean up the connection like this:
[_connectionToService invalidate];
*/
+52
View File
@@ -0,0 +1,52 @@
//
// main.m
// TestAppHelper
//
// Created by Mayur Pawashe on 3/2/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "TestAppHelper.h"
#import "SUUserDriver.h"
@interface ServiceDelegate : NSObject <NSXPCListenerDelegate>
@end
@implementation ServiceDelegate
- (BOOL)listener:(NSXPCListener *)__unused listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection {
// This method is where the NSXPCListener configures, accepts, and resumes a new incoming NSXPCConnection.
// Configure the connection.
// First, set the interface that the exported object implements.
newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(TestAppHelperProtocol)];
newConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUUserDriver)];
// Next, set the object that the connection exports. All messages sent on the connection to this service will be sent to the exported object to handle. The connection retains the exported object.
TestAppHelper *exportedObject = [[TestAppHelper alloc] initWithUserDriver:newConnection.remoteObjectProxy];
newConnection.exportedObject = exportedObject;
// Resuming the connection allows the system to deliver more incoming messages.
[newConnection resume];
// Returning YES from this method tells the system that you have accepted this connection. If you want to reject the connection for some reason, call -invalidate on the connection and return NO.
return YES;
}
@end
int main(__unused int argc, __unused const char *argv[])
{
// Create the delegate for the service.
ServiceDelegate *delegate = [ServiceDelegate new];
// Set up the one NSXPCListener for this service. It will handle all incoming connections.
NSXPCListener *listener = [NSXPCListener serviceListener];
listener.delegate = delegate;
// Resuming the serviceListener starts this service. This method does not return.
[listener resume];
return 0;
}
@@ -0,0 +1,18 @@
//
// SURemoteUpdateSettingsWindowController.h
// Sparkle
//
// Created by Mayur Pawashe on 3/2/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import <Sparkle/Sparkle.h>
@protocol SUSparkleUserDriverDelegate;
@interface SURemoteUpdateSettingsWindowController : NSWindowController <SUSparkleUserDriverDelegate>
- (NSApplicationTerminateReply)sendTerminationSignal;
@end
@@ -0,0 +1,137 @@
//
// SURemoteUpdateSettingsWindowController.m
// Sparkle
//
// Created by Mayur Pawashe on 3/2/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import "SURemoteUpdateSettingsWindowController.h"
#import "TestAppHelperProtocol.h"
@interface SURemoteUpdateSettingsWindowController ()
@property (nonatomic) NSXPCConnection *connection;
@property (nonatomic) SUSparkleUserDriver *userDriver;
@property (nonatomic) IBOutlet NSButton *automaticallyChecksForUpdatesButton;
@property (nonatomic) IBOutlet NSButton *automaticallyDownloadUpdatesButton;
@property (nonatomic) IBOutlet NSButton *sendsSystemProfileButton;
@property (nonatomic) IBOutlet NSTextField *updateCheckIntervalTextField;
@end
@implementation SURemoteUpdateSettingsWindowController
@synthesize connection = _connection;
@synthesize userDriver = _userDriver;
@synthesize automaticallyChecksForUpdatesButton = _automaticallyChecksForUpdatesButton;
@synthesize automaticallyDownloadUpdatesButton = _automaticallyDownloadUpdatesButton;
@synthesize sendsSystemProfileButton = _sendsSystemProfileButton;
@synthesize updateCheckIntervalTextField = _updateCheckIntervalTextField;
#pragma mark Birth
- (instancetype)init
{
self = [super init];
if (self != nil) {
self.connection = [[NSXPCConnection alloc] initWithServiceName:@"org.sparkle-project.TestAppHelper"];
self.connection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUUserDriver)];
self.userDriver = [[SUSparkleUserDriver alloc] initWithHostBundle:[NSBundle mainBundle] delegate:self];
self.connection.exportedObject = self.userDriver;
self.connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(TestAppHelperProtocol)];
[self.connection resume];
[self.connection.remoteObjectProxy startSparkle];
// Retrieving the settings really takes a while, perhaps a smarter app may also store defaults locally and sync them
[self.connection.remoteObjectProxy retrieveUpdateSettings:^(BOOL automaticallyCheckForUpdates, BOOL automaticallyDownloadUpdates, BOOL sendSystemProfile, NSTimeInterval updateCheckInterval) {
dispatch_async(dispatch_get_main_queue(), ^{
// Load the window before referencing our outlets
[self window];
self.automaticallyChecksForUpdatesButton.state = automaticallyCheckForUpdates ? NSOnState : NSOffState;
self.automaticallyDownloadUpdatesButton.state = automaticallyDownloadUpdates ? NSOnState : NSOffState;
self.sendsSystemProfileButton.state = sendSystemProfile ? NSOnState : NSOffState;
self.updateCheckIntervalTextField.doubleValue = updateCheckInterval;
// Ready to show our window
[self showWindow:nil];
});
}];
}
return self;
}
- (NSString *)windowNibName
{
return NSStringFromClass([self class]);
}
#pragma mark UI Actions
// When the user explicitly checks for updates via the menu item..
- (IBAction)checkForUpdates:(id)__unused sender
{
[self.connection.remoteObjectProxy initiateUserCheckForUpdates];
}
// See if the user is allowed to invoke the check for update's menu item's action
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
{
if (menuItem.action == @selector(checkForUpdates:)) {
return !self.userDriver.updateInProgress;
}
return YES;
}
#pragma mark Changing Settings
- (IBAction)changeAutomaticallyChecksForUpdates:(__unused id)sender
{
[self.connection.remoteObjectProxy setAutomaticallyChecksForUpdates:self.automaticallyChecksForUpdatesButton.state == NSOnState];
}
- (IBAction)changeAutomaticallyDownloadsUpdates:(__unused id)sender
{
[self.connection.remoteObjectProxy setAutomaticallyDownloadsUpdates:self.automaticallyDownloadUpdatesButton.state == NSOnState];
}
- (IBAction)changeSendsSystemProfile:(__unused id)sender
{
[self.connection.remoteObjectProxy setSendsSystemProfile:self.sendsSystemProfileButton.state == NSOnState];
}
- (IBAction)changeUpdateCheckInterval:(__unused id)sender
{
[self.connection.remoteObjectProxy setUpdateCheckInterval:self.updateCheckIntervalTextField.doubleValue];
}
#pragma mark App Termination
- (BOOL)responsibleForSignalingApplicationTerminationForUserDriver:(id <SUUserDriver>)__unused userDriver
{
return YES;
}
- (NSApplicationTerminateReply)sendTerminationSignal
{
return [self.userDriver sendApplicationTerminationSignal];
}
#pragma mark Update Checks
- (BOOL)responsibleForInitiatingUpdateCheckForUserDriver:(id <SUUserDriver>)__unused userDriver
{
return YES;
}
- (void)initiateUpdateCheckForUserDriver:(id <SUUserDriver>)__unused userDriver
{
[self.connection.remoteObjectProxy checkForUpdates];
}
@end
@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9532"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="SURemoteUpdateSettingsWindowController">
<connections>
<outlet property="automaticallyChecksForUpdatesButton" destination="WCF-ta-p7Z" id="zCH-4m-RJ8"/>
<outlet property="automaticallyDownloadUpdatesButton" destination="4uY-pp-yH5" id="C0M-kP-zVr"/>
<outlet property="sendsSystemProfileButton" destination="Qcj-QF-2dP" id="IeL-ct-cw2"/>
<outlet property="updateCheckIntervalTextField" destination="KBY-eq-rP5" id="yHH-Vr-agJ"/>
<outlet property="window" destination="XEo-7J-oab" id="V54-Lr-3QY"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Options" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="XEo-7J-oab" userLabel="Options Window">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES"/>
<rect key="contentRect" x="543" y="572" width="314" height="149"/>
<rect key="screenRect" x="0.0" y="0.0" width="1366" height="745"/>
<value key="minSize" type="size" width="213" height="107"/>
<view key="contentView" id="kT5-tw-yET">
<rect key="frame" x="0.0" y="0.0" width="314" height="149"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="WCF-ta-p7Z">
<rect key="frame" x="22" y="88" width="225" height="18"/>
<buttonCell key="cell" type="check" title="Automatically check for updates" bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="lNf-Ts-kMD">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="changeAutomaticallyChecksForUpdates:" target="-2" id="vVU-0U-mKK"/>
</connections>
</button>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4uY-pp-yH5">
<rect key="frame" x="22" y="68" width="228" height="18"/>
<buttonCell key="cell" type="check" title="Automatically download updates" bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="9Vp-dh-xcx">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="changeAutomaticallyDownloadsUpdates:" target="-2" id="nuf-Vs-C99"/>
</connections>
</button>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Qcj-QF-2dP">
<rect key="frame" x="22" y="48" width="224" height="18"/>
<buttonCell key="cell" type="check" title="Send system profile information" bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="lLT-65-lKv">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="changeSendsSystemProfile:" target="-2" id="Z4O-AR-StA"/>
</connections>
</button>
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Qvd-9Z-K8N">
<rect key="frame" x="21" y="112" width="106" height="17"/>
<textFieldCell key="cell" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Debug options:" id="8eR-Do-yId">
<font key="font" metaFont="systemBold"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="AwL-UK-p7l">
<rect key="frame" x="18" y="22" width="157" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Check for updates every" id="mWb-bT-7WT">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="UeP-MQ-dTv">
<rect key="frame" x="241" y="22" width="63" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="seconds" id="q8Q-hz-wgB">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="KBY-eq-rP5">
<rect key="frame" x="180" y="20" width="56" height="22"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="xA5-15-svf">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<action selector="changeUpdateCheckInterval:" target="-2" id="b6e-9d-HR1"/>
</connections>
</textField>
</subviews>
</view>
<connections>
<outlet property="delegate" destination="-2" id="QEM-KB-JFG"/>
</connections>
<point key="canvasLocation" x="233" y="312.5"/>
</window>
</objects>
</document>
+14 -2
View File
@@ -8,12 +8,14 @@
#import "SUTestApplicationDelegate.h"
#import "SUUpdateSettingsWindowController.h"
#import "SURemoteUpdateSettingsWindowController.h"
#import "SUFileManager.h"
#import "SUTestWebServer.h"
@interface SUTestApplicationDelegate ()
@property (nonatomic) SUUpdateSettingsWindowController *updateSettingsWindowController;
@property (nonatomic) SURemoteUpdateSettingsWindowController *remoteUpdateSettingsWindowController;
@property (nonatomic) SUTestWebServer *webServer;
@end
@@ -21,6 +23,7 @@
@implementation SUTestApplicationDelegate
@synthesize updateSettingsWindowController = _updateSettingsWindowController;
@synthesize remoteUpdateSettingsWindowController = _remoteUpdateSettingsWindowController;
@synthesize webServer = _webServer;
static NSString * const UPDATED_VERSION = @"2.0";
@@ -186,8 +189,17 @@ static NSString * const UPDATED_VERSION = @"2.0";
self.webServer = webServer;
// Show the Settings window
self.updateSettingsWindowController = [[SUUpdateSettingsWindowController alloc] init];
[self.updateSettingsWindowController showWindow:nil];
// SURemoteUpdateSettingsWindowController will show its window by itself
self.remoteUpdateSettingsWindowController = [[SURemoteUpdateSettingsWindowController alloc] init];
//self.updateSettingsWindowController = [[SUUpdateSettingsWindowController alloc] init];
//[self.updateSettingsWindowController showWindow:nil];
}
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)__unused sender
{
return (self.remoteUpdateSettingsWindowController == nil ? NSTerminateNow : [self.remoteUpdateSettingsWindowController sendTerminationSignal]);
}
- (void)applicationWillTerminate:(NSNotification * __unused)notification
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>
<key>com.apple.security.temporary-exception.shared-preference.read-write</key>
<array>
<string>org.sparkle-project.SparkleTestApp</string>
</array>
</dict>
</plist>