diff --git a/Configurations/ConfigTestApp.xcconfig b/Configurations/ConfigTestApp.xcconfig index f34249fc..3d6989c5 100644 --- a/Configurations/ConfigTestApp.xcconfig +++ b/Configurations/ConfigTestApp.xcconfig @@ -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 diff --git a/Configurations/ConfigTestAppDebugHelper.xcconfig b/Configurations/ConfigTestAppDebugHelper.xcconfig new file mode 100644 index 00000000..11270a07 --- /dev/null +++ b/Configurations/ConfigTestAppDebugHelper.xcconfig @@ -0,0 +1,2 @@ +#include "ConfigTestAppHelper.xcconfig" + diff --git a/Configurations/ConfigTestAppHelper.xcconfig b/Configurations/ConfigTestAppHelper.xcconfig new file mode 100644 index 00000000..5d545ef6 --- /dev/null +++ b/Configurations/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 diff --git a/Configurations/ConfigTestAppReleaseHelper.xcconfig b/Configurations/ConfigTestAppReleaseHelper.xcconfig new file mode 100644 index 00000000..625a9d01 --- /dev/null +++ b/Configurations/ConfigTestAppReleaseHelper.xcconfig @@ -0,0 +1 @@ +#include "ConfigTestAppHelper.xcconfig" diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index 2d379f1e..7e96bdc4 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -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 = ""; }; 726E4A0D1C86881600C57C6A /* SUSparkleUserDriverUIDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUSparkleUserDriverUIDelegate.h; sourceTree = ""; }; 726E4A0F1C86B5A200C57C6A /* SUSparkleUserDriverRemoteDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUSparkleUserDriverRemoteDelegate.h; sourceTree = ""; }; + 726E4A111C86C44A00C57C6A /* Sparkle-Test-App.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "Sparkle-Test-App.entitlements"; sourceTree = ""; }; + 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 = ""; }; + 726E4A191C86C88F00C57C6A /* TestAppHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TestAppHelper.h; sourceTree = ""; }; + 726E4A1A1C86C88F00C57C6A /* TestAppHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TestAppHelper.m; sourceTree = ""; }; + 726E4A1C1C86C88F00C57C6A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 726E4A1E1C86C88F00C57C6A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 726E4A271C86CAB500C57C6A /* ConfigTestAppDebugHelper.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigTestAppDebugHelper.xcconfig; sourceTree = ""; }; + 726E4A281C86CAB500C57C6A /* ConfigTestAppHelper.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigTestAppHelper.xcconfig; sourceTree = ""; }; + 726E4A291C86CAB500C57C6A /* ConfigTestAppReleaseHelper.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigTestAppReleaseHelper.xcconfig; sourceTree = ""; }; + 726E4A311C87E0C700C57C6A /* SURemoteUpdateSettingsWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SURemoteUpdateSettingsWindowController.h; sourceTree = ""; }; + 726E4A321C87E0C700C57C6A /* SURemoteUpdateSettingsWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SURemoteUpdateSettingsWindowController.m; sourceTree = ""; }; + 726E4A331C87E0C700C57C6A /* SURemoteUpdateSettingsWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SURemoteUpdateSettingsWindowController.xib; sourceTree = ""; }; 726F2CE31BC9C33D001971A4 /* SUOperatingSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUOperatingSystem.h; sourceTree = ""; }; 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUOperatingSystem.m; sourceTree = ""; }; 7275F9BF1B5F1F2900B1D19E /* SUFileManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUFileManager.h; sourceTree = ""; }; @@ -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 = ""; @@ -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 = ""; }; + 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 = ""; + }; 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 */; diff --git a/TestAppHelper/Info.plist b/TestAppHelper/Info.plist new file mode 100644 index 00000000..4ffe10a2 --- /dev/null +++ b/TestAppHelper/Info.plist @@ -0,0 +1,40 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + TestAppHelper + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + XPC! + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + NSHumanReadableCopyright + Copyright © 2016 Sparkle Project. All rights reserved. + XPCService + + RunLoopType + NSRunLoop + ServiceType + Application + + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + + + diff --git a/TestAppHelper/TestAppHelper.h b/TestAppHelper/TestAppHelper.h new file mode 100644 index 00000000..b1222e9d --- /dev/null +++ b/TestAppHelper/TestAppHelper.h @@ -0,0 +1,19 @@ +// +// TestAppHelper.h +// TestAppHelper +// +// Created by Mayur Pawashe on 3/2/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import +#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 + +- (instancetype)initWithUserDriver:(id )userDriver; + +@end diff --git a/TestAppHelper/TestAppHelper.m b/TestAppHelper/TestAppHelper.m new file mode 100644 index 00000000..775702a9 --- /dev/null +++ b/TestAppHelper/TestAppHelper.m @@ -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 + +@interface TestAppHelper () + +@property (nonatomic) SUUpdater *updater; +@property (nonatomic) id userDriver; + +@end + +@implementation TestAppHelper + +@synthesize updater = _updater; +@synthesize userDriver = _userDriver; + +- (instancetype)initWithUserDriver:(id )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 diff --git a/TestAppHelper/TestAppHelperProtocol.h b/TestAppHelper/TestAppHelperProtocol.h new file mode 100644 index 00000000..fd1766e4 --- /dev/null +++ b/TestAppHelper/TestAppHelperProtocol.h @@ -0,0 +1,49 @@ +// +// TestAppHelperProtocol.h +// TestAppHelper +// +// Created by Mayur Pawashe on 3/2/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import + +// 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]; +*/ diff --git a/TestAppHelper/main.m b/TestAppHelper/main.m new file mode 100644 index 00000000..c34fdaed --- /dev/null +++ b/TestAppHelper/main.m @@ -0,0 +1,52 @@ +// +// main.m +// TestAppHelper +// +// Created by Mayur Pawashe on 3/2/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import +#import "TestAppHelper.h" +#import "SUUserDriver.h" + +@interface ServiceDelegate : NSObject +@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; +} diff --git a/TestApplication/SURemoteUpdateSettingsWindowController.h b/TestApplication/SURemoteUpdateSettingsWindowController.h new file mode 100644 index 00000000..e70592a9 --- /dev/null +++ b/TestApplication/SURemoteUpdateSettingsWindowController.h @@ -0,0 +1,18 @@ +// +// SURemoteUpdateSettingsWindowController.h +// Sparkle +// +// Created by Mayur Pawashe on 3/2/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import +#import + +@protocol SUSparkleUserDriverDelegate; + +@interface SURemoteUpdateSettingsWindowController : NSWindowController + +- (NSApplicationTerminateReply)sendTerminationSignal; + +@end diff --git a/TestApplication/SURemoteUpdateSettingsWindowController.m b/TestApplication/SURemoteUpdateSettingsWindowController.m new file mode 100644 index 00000000..3acee991 --- /dev/null +++ b/TestApplication/SURemoteUpdateSettingsWindowController.m @@ -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 )__unused userDriver +{ + return YES; +} + +- (NSApplicationTerminateReply)sendTerminationSignal +{ + return [self.userDriver sendApplicationTerminationSignal]; +} + +#pragma mark Update Checks + +- (BOOL)responsibleForInitiatingUpdateCheckForUserDriver:(id )__unused userDriver +{ + return YES; +} + +- (void)initiateUpdateCheckForUserDriver:(id )__unused userDriver +{ + [self.connection.remoteObjectProxy checkForUpdates]; +} + +@end diff --git a/TestApplication/SURemoteUpdateSettingsWindowController.xib b/TestApplication/SURemoteUpdateSettingsWindowController.xib new file mode 100644 index 00000000..5e78998e --- /dev/null +++ b/TestApplication/SURemoteUpdateSettingsWindowController.xib @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TestApplication/SUTestApplicationDelegate.m b/TestApplication/SUTestApplicationDelegate.m index c42f5cfb..21179241 100644 --- a/TestApplication/SUTestApplicationDelegate.m +++ b/TestApplication/SUTestApplicationDelegate.m @@ -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 diff --git a/TestApplication/Sparkle-Test-App.entitlements b/TestApplication/Sparkle-Test-App.entitlements new file mode 100644 index 00000000..35049e47 --- /dev/null +++ b/TestApplication/Sparkle-Test-App.entitlements @@ -0,0 +1,14 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.network.server + + com.apple.security.temporary-exception.shared-preference.read-write + + org.sparkle-project.SparkleTestApp + + +