diff --git a/Autoupdate/AgentConnection.m b/Autoupdate/AgentConnection.m index 34a67726..012ff019 100644 --- a/Autoupdate/AgentConnection.m +++ b/Autoupdate/AgentConnection.m @@ -11,9 +11,8 @@ #import "SPUInstallerAgentProtocol.h" #import "SUInstallerAgentInitiationProtocol.h" -#ifdef _APPKITDEFINES_H -#error This is a "daemon-safe" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface AgentConnection () diff --git a/Autoupdate/AppInstaller.m b/Autoupdate/AppInstaller.m index 090a32d5..ead4e59a 100644 --- a/Autoupdate/AppInstaller.m +++ b/Autoupdate/AppInstaller.m @@ -28,9 +28,8 @@ #import "SPUInstallationType.h" #import "SPULocalCacheDirectory.h" -#ifdef _APPKITDEFINES_H -#error This is a "daemon-safe" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" #define FIRST_UPDATER_MESSAGE_TIMEOUT 7ull #define RETRIEVE_PROCESS_IDENTIFIER_TIMEOUT 5ull diff --git a/Autoupdate/SPUInstallationInfo.m b/Autoupdate/SPUInstallationInfo.m index ef7fdb38..bb628ef0 100644 --- a/Autoupdate/SPUInstallationInfo.m +++ b/Autoupdate/SPUInstallationInfo.m @@ -9,9 +9,8 @@ #import "SPUInstallationInfo.h" #import "SUAppcastItem.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" static NSString *SUAppcastItemKey = @"SUAppcastItem"; static NSString *SUCanSilentlyInstallKey = @"SUCanSilentlyInstall"; diff --git a/Autoupdate/SPUInstallationInputData.m b/Autoupdate/SPUInstallationInputData.m index d4f1cfcb..812a7580 100644 --- a/Autoupdate/SPUInstallationInputData.m +++ b/Autoupdate/SPUInstallationInputData.m @@ -9,9 +9,8 @@ #import "SPUInstallationInputData.h" #import "SPUInstallationType.h" -#ifdef _APPKITDEFINES_H -#error This is a "daemon-safe" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" static NSString *SURelaunchPathKey = @"SURelaunchPath"; static NSString *SUHostBundlePathKey = @"SUHostBundlePath"; diff --git a/Autoupdate/SPUMessageTypes.m b/Autoupdate/SPUMessageTypes.m index 34f88328..7df9db0c 100644 --- a/Autoupdate/SPUMessageTypes.m +++ b/Autoupdate/SPUMessageTypes.m @@ -9,9 +9,8 @@ #import "SPUMessageTypes.h" #import "SUHost.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" NSString *SPUAppcastItemArchiveKey = @"SPUAppcastItemArchive"; diff --git a/Autoupdate/SUBinaryDeltaApply.m b/Autoupdate/SUBinaryDeltaApply.m index da6c6f85..ea93b2be 100644 --- a/Autoupdate/SUBinaryDeltaApply.m +++ b/Autoupdate/SUBinaryDeltaApply.m @@ -15,9 +15,8 @@ #include #include -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" static BOOL applyBinaryDeltaToFile(xar_t x, xar_file_t file, NSString *sourceFilePath, NSString *destinationFilePath) { diff --git a/Autoupdate/SUBinaryDeltaCommon.m b/Autoupdate/SUBinaryDeltaCommon.m index bf83257b..8f4edb87 100644 --- a/Autoupdate/SUBinaryDeltaCommon.m +++ b/Autoupdate/SUBinaryDeltaCommon.m @@ -18,9 +18,8 @@ #include #include -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" int compareFiles(const FTSENT **a, const FTSENT **b) { diff --git a/Autoupdate/SUBinaryDeltaCreate.m b/Autoupdate/SUBinaryDeltaCreate.m index 00807cf5..b0dfa3ef 100644 --- a/Autoupdate/SUBinaryDeltaCreate.m +++ b/Autoupdate/SUBinaryDeltaCreate.m @@ -21,9 +21,8 @@ #include #include -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" extern int bsdiff(int argc, const char **argv); diff --git a/Autoupdate/SUBinaryDeltaTool.m b/Autoupdate/SUBinaryDeltaTool.m index d2d9be2d..fae14ed1 100644 --- a/Autoupdate/SUBinaryDeltaTool.m +++ b/Autoupdate/SUBinaryDeltaTool.m @@ -12,10 +12,6 @@ #include #include -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif - #define VERBOSE_FLAG @"--verbose" #define VERSION_FLAG @"--version" @@ -24,6 +20,8 @@ #define VERSION_COMMAND @"version" #define VERSION_ALTERNATE_COMMAND @"--version" +#include "AppKitPrevention.h" + static void printUsage(NSString *programName) { fprintf(stderr, "Usage:\n"); diff --git a/Autoupdate/SUBinaryDeltaUnarchiver.m b/Autoupdate/SUBinaryDeltaUnarchiver.m index 98135644..b19bb082 100644 --- a/Autoupdate/SUBinaryDeltaUnarchiver.m +++ b/Autoupdate/SUBinaryDeltaUnarchiver.m @@ -13,9 +13,8 @@ #import "SULog.h" #import "SUFileManager.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface SUBinaryDeltaUnarchiver () diff --git a/Autoupdate/SUCodeSigningVerifier.m b/Autoupdate/SUCodeSigningVerifier.m index 1a115d33..b87851ba 100644 --- a/Autoupdate/SUCodeSigningVerifier.m +++ b/Autoupdate/SUCodeSigningVerifier.m @@ -11,9 +11,8 @@ #import "SUCodeSigningVerifier.h" #import "SULog.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @implementation SUCodeSigningVerifier diff --git a/Autoupdate/SUDSAVerifier.m b/Autoupdate/SUDSAVerifier.m index 7a2f7066..eeea9c09 100644 --- a/Autoupdate/SUDSAVerifier.m +++ b/Autoupdate/SUDSAVerifier.m @@ -16,9 +16,8 @@ #import "SULog.h" #include -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @implementation SUDSAVerifier { SecKeyRef _secKey; diff --git a/Autoupdate/SUDiskImageUnarchiver.m b/Autoupdate/SUDiskImageUnarchiver.m index 98c140e6..4eb9a536 100644 --- a/Autoupdate/SUDiskImageUnarchiver.m +++ b/Autoupdate/SUDiskImageUnarchiver.m @@ -10,9 +10,8 @@ #import "SUUnarchiverNotifier.h" #import "SULog.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface SUDiskImageUnarchiver () diff --git a/Autoupdate/SUGuidedPackageInstaller.m b/Autoupdate/SUGuidedPackageInstaller.m index 4c229cca..c23924d3 100644 --- a/Autoupdate/SUGuidedPackageInstaller.m +++ b/Autoupdate/SUGuidedPackageInstaller.m @@ -10,9 +10,8 @@ #import "SUGuidedPackageInstaller.h" #import "SUErrors.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface SUGuidedPackageInstaller () diff --git a/Autoupdate/SUInstaller.m b/Autoupdate/SUInstaller.m index cb596ecb..ec1a2079 100644 --- a/Autoupdate/SUInstaller.m +++ b/Autoupdate/SUInstaller.m @@ -16,9 +16,8 @@ #import "SUErrors.h" #import "SPUInstallationType.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @implementation SUInstaller diff --git a/Autoupdate/SUPackageInstaller.m b/Autoupdate/SUPackageInstaller.m index b40ac60b..92654742 100644 --- a/Autoupdate/SUPackageInstaller.m +++ b/Autoupdate/SUPackageInstaller.m @@ -11,9 +11,8 @@ #import "SUErrors.h" #import "SULog.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface SUPackageInstaller () diff --git a/Autoupdate/SUPipedUnarchiver.m b/Autoupdate/SUPipedUnarchiver.m index a27a11a8..3c3e2005 100644 --- a/Autoupdate/SUPipedUnarchiver.m +++ b/Autoupdate/SUPipedUnarchiver.m @@ -11,9 +11,8 @@ #import "SULog.h" #import "SUErrors.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface SUPipedUnarchiver () diff --git a/Autoupdate/SUPlainInstaller.m b/Autoupdate/SUPlainInstaller.m index 3ca1acde..5ea74426 100644 --- a/Autoupdate/SUPlainInstaller.m +++ b/Autoupdate/SUPlainInstaller.m @@ -15,9 +15,8 @@ #import "SUVersionComparisonProtocol.h" #import "SUStandardVersionComparator.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface SUPlainInstaller () diff --git a/Autoupdate/SUUnarchiver.m b/Autoupdate/SUUnarchiver.m index d91159f9..9cb33bc6 100644 --- a/Autoupdate/SUUnarchiver.m +++ b/Autoupdate/SUUnarchiver.m @@ -12,9 +12,8 @@ #import "SUDiskImageUnarchiver.h" #import "SUBinaryDeltaUnarchiver.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @implementation SUUnarchiver diff --git a/Autoupdate/SUUnarchiverNotifier.m b/Autoupdate/SUUnarchiverNotifier.m index 914a08e7..643f0eb9 100644 --- a/Autoupdate/SUUnarchiverNotifier.m +++ b/Autoupdate/SUUnarchiverNotifier.m @@ -10,9 +10,8 @@ #import "SULocalizations.h" #import "SUErrors.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface SUUnarchiverNotifier () diff --git a/Autoupdate/StatusInfo.m b/Autoupdate/StatusInfo.m index 2dfe0560..c40c3086 100644 --- a/Autoupdate/StatusInfo.m +++ b/Autoupdate/StatusInfo.m @@ -9,9 +9,8 @@ #import "StatusInfo.h" #import "SPUMessageTypes.h" -#ifdef _APPKITDEFINES_H -#error This is a "daemon-safe" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface StatusInfo () diff --git a/Autoupdate/TerminationListener.m b/Autoupdate/TerminationListener.m index e9062257..05943632 100644 --- a/Autoupdate/TerminationListener.m +++ b/Autoupdate/TerminationListener.m @@ -13,9 +13,8 @@ #include #include -#ifdef _APPKITDEFINES_H -#error This is a "daemon-safe" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface TerminationListener () diff --git a/Autoupdate/main.m b/Autoupdate/main.m index 9ca99024..6bed9fe5 100644 --- a/Autoupdate/main.m +++ b/Autoupdate/main.m @@ -1,9 +1,8 @@ #import #import "AppInstaller.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" int main(int __unused argc, const char __unused *argv[]) { diff --git a/Downloader/SPUDownloader.m b/Downloader/SPUDownloader.m index e5eedd34..3a88b592 100644 --- a/Downloader/SPUDownloader.m +++ b/Downloader/SPUDownloader.m @@ -13,9 +13,8 @@ #import "SPUDownloadData.h" #import "SUErrors.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" typedef NS_ENUM(NSUInteger, SPUDownloadMode) { diff --git a/InstallerConnection/SUInstallerConnection.m b/InstallerConnection/SUInstallerConnection.m index d0ade57b..89fbd75f 100644 --- a/InstallerConnection/SUInstallerConnection.m +++ b/InstallerConnection/SUInstallerConnection.m @@ -9,9 +9,8 @@ #import "SUInstallerConnection.h" #import "SPUSystemAuthorization.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" static NSString *SUInstallerConnectionKeepAliveReason = @"Installer Connection Keep Alive"; diff --git a/InstallerConnection/SUXPCInstallerConnection.m b/InstallerConnection/SUXPCInstallerConnection.m index 36281cb1..2c1e5d7c 100644 --- a/InstallerConnection/SUXPCInstallerConnection.m +++ b/InstallerConnection/SUXPCInstallerConnection.m @@ -8,9 +8,8 @@ #import "SUXPCInstallerConnection.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface SUXPCInstallerConnection () diff --git a/InstallerConnection/main.m b/InstallerConnection/main.m index 59e12d56..56d9e4ef 100644 --- a/InstallerConnection/main.m +++ b/InstallerConnection/main.m @@ -10,9 +10,8 @@ #import "SUInstallerConnection.h" #import "SUInstallerCommunicationProtocol.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface ServiceDelegate : NSObject @end diff --git a/InstallerLauncher/SUInstallerLauncher.m b/InstallerLauncher/SUInstallerLauncher.m index 923855e9..f89d413b 100644 --- a/InstallerLauncher/SUInstallerLauncher.m +++ b/InstallerLauncher/SUInstallerLauncher.m @@ -17,9 +17,8 @@ #import "SUHost.h" #import -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @implementation SUInstallerLauncher diff --git a/InstallerStatus/SUInstallerStatus.m b/InstallerStatus/SUInstallerStatus.m index 93d988d9..af4cc3eb 100644 --- a/InstallerStatus/SUInstallerStatus.m +++ b/InstallerStatus/SUInstallerStatus.m @@ -9,9 +9,8 @@ #import "SUInstallerStatus.h" #import "SPUSystemAuthorization.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface SUInstallerStatus () diff --git a/InstallerStatus/SUXPCInstallerStatus.m b/InstallerStatus/SUXPCInstallerStatus.m index aec4b3bb..8e67ec0d 100644 --- a/InstallerStatus/SUXPCInstallerStatus.m +++ b/InstallerStatus/SUXPCInstallerStatus.m @@ -8,9 +8,8 @@ #import "SUXPCInstallerStatus.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface SUXPCInstallerStatus () diff --git a/InstallerStatus/main.m b/InstallerStatus/main.m index d508428e..95a044f4 100644 --- a/InstallerStatus/main.m +++ b/InstallerStatus/main.m @@ -9,9 +9,8 @@ #import #import "SUInstallerStatus.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface ServiceDelegate : NSObject @end diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index 44e05fd9..f71d25e8 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -956,6 +956,7 @@ 7205C46D1E13245600E370AE /* ConfigUnitTestRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigUnitTestRelease.xcconfig; sourceTree = ""; }; 7205C46E1E13254500E370AE /* ConfigUITestDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigUITestDebug.xcconfig; sourceTree = ""; }; 7205C46F1E13255900E370AE /* ConfigUITestRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigUITestRelease.xcconfig; sourceTree = ""; }; + 720767D11E2EB86200F9A850 /* AppKitPrevention.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppKitPrevention.h; sourceTree = ""; }; 720B16421C66433D006985FB /* UITests-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "UITests-Info.plist"; path = "UITests/UITests-Info.plist"; sourceTree = SOURCE_ROOT; }; 720B16431C66433D006985FB /* SUTestApplicationTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SUTestApplicationTest.swift; path = UITests/SUTestApplicationTest.swift; sourceTree = SOURCE_ROOT; }; 720E21791D0D00BF003A311C /* SPUUpdaterCycle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUUpdaterCycle.h; sourceTree = ""; }; @@ -1502,6 +1503,7 @@ 1495006D195FBBBD00BC5B5B /* Sparkle */ = { isa = PBXGroup; children = ( + 720767D11E2EB86200F9A850 /* AppKitPrevention.h */, 61299B3909CB055000B7442F /* Appcast Support */, 55C14BD5136EEFD000649790 /* Autoupdate */, 72F9EBE41D519425004AC8B6 /* Deprecated */, diff --git a/Sparkle/AppKitPrevention.h b/Sparkle/AppKitPrevention.h new file mode 100644 index 00000000..0ede52ff --- /dev/null +++ b/Sparkle/AppKitPrevention.h @@ -0,0 +1,20 @@ +// +// AppKitPrevention.h +// Sparkle +// +// Created by Mayur Pawashe on 1/17/17. +// Copyright © 2017 Sparkle Project. All rights reserved. +// + +// #include (not #import) this header to prevent AppKit from being imported +// Note this should be your LAST #include in your implementation file + +// If this error is triggered, you can have Xcode indicate to you which source file including this header caused the issue + +// One may wonder for certain targets where AppKit is banned completely, why just not link AppKit instead. +// Well, Xcode has thing called auto-linking that I don't trust very much. +// Even after trying to disable the setting, I've had targets able to link to AppKit without AppKit being specified in the list of linked libraries. + +#ifdef _APPKITDEFINES_H +#error This is a core or daemon-safe module and should NOT import AppKit +#endif diff --git a/Sparkle/SPUAutomaticUpdateDriver.m b/Sparkle/SPUAutomaticUpdateDriver.m index c82439aa..1242de9e 100644 --- a/Sparkle/SPUAutomaticUpdateDriver.m +++ b/Sparkle/SPUAutomaticUpdateDriver.m @@ -16,9 +16,8 @@ #import "SPUUserDriver.h" #import "SUErrors.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface SPUAutomaticUpdateDriver () diff --git a/Sparkle/SPUBasicUpdateDriver.m b/Sparkle/SPUBasicUpdateDriver.m index 2918c7c6..4365d5c0 100644 --- a/Sparkle/SPUBasicUpdateDriver.m +++ b/Sparkle/SPUBasicUpdateDriver.m @@ -18,9 +18,8 @@ #import "SPUInstallationInfo.h" #import "SPUResumableUpdate.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface SPUBasicUpdateDriver () diff --git a/Sparkle/SPUCoreBasedUpdateDriver.m b/Sparkle/SPUCoreBasedUpdateDriver.m index fd1525b6..5847b825 100644 --- a/Sparkle/SPUCoreBasedUpdateDriver.m +++ b/Sparkle/SPUCoreBasedUpdateDriver.m @@ -21,9 +21,8 @@ #import "SULocalizations.h" #import "SPUInstallationType.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface SPUCoreBasedUpdateDriver () diff --git a/Sparkle/SPUDownloadData.m b/Sparkle/SPUDownloadData.m index b183aefd..0d090dbe 100644 --- a/Sparkle/SPUDownloadData.m +++ b/Sparkle/SPUDownloadData.m @@ -8,9 +8,8 @@ #import "SPUDownloadData.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" static NSString *SPUDownloadDataKey = @"SPUDownloadData"; static NSString *SPUDownloadTextEncodingKey = @"SPUDownloadTextEncoding"; diff --git a/Sparkle/SPUDownloadDriver.m b/Sparkle/SPUDownloadDriver.m index f452591a..79dc4435 100644 --- a/Sparkle/SPUDownloadDriver.m +++ b/Sparkle/SPUDownloadDriver.m @@ -20,9 +20,8 @@ #import "SPUDownloadedUpdate.h" #import "SPUDownloadData.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface SPUDownloadDriver () diff --git a/Sparkle/SPUDownloadedUpdate.m b/Sparkle/SPUDownloadedUpdate.m index 2ecc8003..1db4c406 100644 --- a/Sparkle/SPUDownloadedUpdate.m +++ b/Sparkle/SPUDownloadedUpdate.m @@ -8,9 +8,8 @@ #import "SPUDownloadedUpdate.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @implementation SPUDownloadedUpdate diff --git a/Sparkle/SPUInformationalUpdate.m b/Sparkle/SPUInformationalUpdate.m index 6f8e29bc..d5cdfca0 100644 --- a/Sparkle/SPUInformationalUpdate.m +++ b/Sparkle/SPUInformationalUpdate.m @@ -8,9 +8,8 @@ #import "SPUInformationalUpdate.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @implementation SPUInformationalUpdate diff --git a/Sparkle/SPUInstallerDriver.m b/Sparkle/SPUInstallerDriver.m index becac64f..07bf26e6 100644 --- a/Sparkle/SPUInstallerDriver.m +++ b/Sparkle/SPUInstallerDriver.m @@ -26,9 +26,8 @@ #import "SPUDownloadedUpdate.h" #import "SPUInstallationType.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" #define FIRST_INSTALLER_MESSAGE_TIMEOUT 7ull diff --git a/Sparkle/SPULocalCacheDirectory.m b/Sparkle/SPULocalCacheDirectory.m index 885f3e6c..975ec1f0 100644 --- a/Sparkle/SPULocalCacheDirectory.m +++ b/Sparkle/SPULocalCacheDirectory.m @@ -9,9 +9,8 @@ #import "SPULocalCacheDirectory.h" #import "SULog.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" static NSTimeInterval OLD_ITEM_DELETION_INTERVAL = 86400 * 10; // 10 days diff --git a/Sparkle/SPUProbeInstallStatus.m b/Sparkle/SPUProbeInstallStatus.m index 60062e56..71225bb5 100644 --- a/Sparkle/SPUProbeInstallStatus.m +++ b/Sparkle/SPUProbeInstallStatus.m @@ -15,9 +15,8 @@ #import "SUXPCInstallerStatus.h" #import "SULog.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" // This timeout is if probing the installer takes too long // It should be at least more than 1 second since a probe can take around that much time diff --git a/Sparkle/SPUProbingUpdateDriver.m b/Sparkle/SPUProbingUpdateDriver.m index 8988c6e1..a16f045a 100644 --- a/Sparkle/SPUProbingUpdateDriver.m +++ b/Sparkle/SPUProbingUpdateDriver.m @@ -9,9 +9,8 @@ #import "SPUProbingUpdateDriver.h" #import "SPUBasicUpdateDriver.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface SPUProbingUpdateDriver () diff --git a/Sparkle/SPUScheduledUpdateDriver.m b/Sparkle/SPUScheduledUpdateDriver.m index c664dbc0..893430d0 100644 --- a/Sparkle/SPUScheduledUpdateDriver.m +++ b/Sparkle/SPUScheduledUpdateDriver.m @@ -12,9 +12,8 @@ #import "SPUUpdaterDelegate.h" #import "SPUUserDriver.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface SPUScheduledUpdateDriver() diff --git a/Sparkle/SPUSecureCoding.m b/Sparkle/SPUSecureCoding.m index c05b1002..15d0a9b5 100644 --- a/Sparkle/SPUSecureCoding.m +++ b/Sparkle/SPUSecureCoding.m @@ -9,9 +9,8 @@ #import "SPUSecureCoding.h" #import "SULog.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" static NSString *SURootObjectArchiveKey = @"SURootObjectArchive"; diff --git a/Sparkle/SPUSystemAuthorization.m b/Sparkle/SPUSystemAuthorization.m index 237d09c6..87411019 100644 --- a/Sparkle/SPUSystemAuthorization.m +++ b/Sparkle/SPUSystemAuthorization.m @@ -10,9 +10,8 @@ #import "SPUInstallationType.h" #import "SUFileManager.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" BOOL SPUNeedsSystemAuthorizationAccess(NSString *path, NSString *installationType) { diff --git a/Sparkle/SPUUIBasedUpdateDriver.m b/Sparkle/SPUUIBasedUpdateDriver.m index 1b330a64..c826f289 100644 --- a/Sparkle/SPUUIBasedUpdateDriver.m +++ b/Sparkle/SPUUIBasedUpdateDriver.m @@ -18,9 +18,8 @@ #import "SPUDownloadData.h" #import "SPUResumableUpdate.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface SPUUIBasedUpdateDriver() diff --git a/Sparkle/SPUURLDownload.m b/Sparkle/SPUURLDownload.m index a7bdcd18..911befed 100644 --- a/Sparkle/SPUURLDownload.m +++ b/Sparkle/SPUURLDownload.m @@ -15,9 +15,8 @@ #import "SPUDownloader.h" #import "SUErrors.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface SPUTemporaryDownloaderDelegate : NSObject diff --git a/Sparkle/SPUURLRequest.m b/Sparkle/SPUURLRequest.m index 7a303241..f04f4998 100644 --- a/Sparkle/SPUURLRequest.m +++ b/Sparkle/SPUURLRequest.m @@ -8,9 +8,8 @@ #import "SPUURLRequest.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" static NSString *SPUURLRequestURLKey = @"SPUURLRequestURL"; static NSString *SPUURLRequestCachePolicyKey = @"SPUURLRequestCachePolicy"; diff --git a/Sparkle/SPUUpdatePermissionRequest.m b/Sparkle/SPUUpdatePermissionRequest.m index fc0cd245..aea0f70f 100644 --- a/Sparkle/SPUUpdatePermissionRequest.m +++ b/Sparkle/SPUUpdatePermissionRequest.m @@ -8,9 +8,8 @@ #import "SPUUpdatePermissionRequest.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" static NSString *SPUUpdatePermissionRequestSystemProfileKey = @"SPUUpdatePermissionRequestSystemProfile"; diff --git a/Sparkle/SPUUpdater.m b/Sparkle/SPUUpdater.m index b0eb25fb..ea06c896 100644 --- a/Sparkle/SPUUpdater.m +++ b/Sparkle/SPUUpdater.m @@ -30,9 +30,8 @@ #import "SPUUpdaterTimer.h" #import "SPUResumableUpdate.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" NSString *const SUUpdaterDidFinishLoadingAppCastNotification = @"SUUpdaterDidFinishLoadingAppCastNotification"; NSString *const SUUpdaterDidFindValidUpdateNotification = @"SUUpdaterDidFindValidUpdateNotification"; diff --git a/Sparkle/SPUUpdaterCycle.m b/Sparkle/SPUUpdaterCycle.m index 31317212..a3f32249 100644 --- a/Sparkle/SPUUpdaterCycle.m +++ b/Sparkle/SPUUpdaterCycle.m @@ -8,9 +8,8 @@ #import "SPUUpdaterCycle.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface SPUUpdaterCycle () diff --git a/Sparkle/SPUUpdaterSettings.m b/Sparkle/SPUUpdaterSettings.m index 6cb49098..be33ea5d 100644 --- a/Sparkle/SPUUpdaterSettings.m +++ b/Sparkle/SPUUpdaterSettings.m @@ -10,9 +10,8 @@ #import "SUHost.h" #import "SUConstants.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface SPUUpdaterSettings () diff --git a/Sparkle/SPUUpdaterTimer.m b/Sparkle/SPUUpdaterTimer.m index ebecbdb4..4a6ac1c4 100644 --- a/Sparkle/SPUUpdaterTimer.m +++ b/Sparkle/SPUUpdaterTimer.m @@ -8,9 +8,8 @@ #import "SPUUpdaterTimer.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface SPUUpdaterTimer () diff --git a/Sparkle/SPUUserDriverCoreComponent.m b/Sparkle/SPUUserDriverCoreComponent.m index 8d31dfeb..ecac239e 100644 --- a/Sparkle/SPUUserDriverCoreComponent.m +++ b/Sparkle/SPUUserDriverCoreComponent.m @@ -8,9 +8,8 @@ #import "SPUUserDriverCoreComponent.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface SPUUserDriverCoreComponent () diff --git a/Sparkle/SPUUserInitiatedUpdateDriver.m b/Sparkle/SPUUserInitiatedUpdateDriver.m index b37fff20..dd1b0064 100644 --- a/Sparkle/SPUUserInitiatedUpdateDriver.m +++ b/Sparkle/SPUUserInitiatedUpdateDriver.m @@ -10,9 +10,8 @@ #import "SPUUIBasedUpdateDriver.h" #import "SPUUserDriver.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface SPUUserInitiatedUpdateDriver () diff --git a/Sparkle/SPUXPCServiceInfo.m b/Sparkle/SPUXPCServiceInfo.m index 774ad6e1..b0e3f3b4 100644 --- a/Sparkle/SPUXPCServiceInfo.m +++ b/Sparkle/SPUXPCServiceInfo.m @@ -8,9 +8,8 @@ #import "SPUXPCServiceInfo.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" BOOL SPUXPCServiceExists(NSString *bundleName) { diff --git a/Sparkle/SUAppcast.m b/Sparkle/SUAppcast.m index 661bd87e..a00f3ab0 100644 --- a/Sparkle/SUAppcast.m +++ b/Sparkle/SUAppcast.m @@ -17,9 +17,8 @@ #import "SPUURLDownload.h" #import "SPUDownloadData.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface NSXMLElement (SUAppcastExtensions) @property (readonly, copy) NSDictionary *attributesAsDictionary; diff --git a/Sparkle/SUAppcastDriver.m b/Sparkle/SUAppcastDriver.m index d383f8e3..1dfc9f80 100644 --- a/Sparkle/SUAppcastDriver.m +++ b/Sparkle/SUAppcastDriver.m @@ -16,9 +16,8 @@ #import "SUHost.h" #import "SUConstants.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface SUAppcastDriver () diff --git a/Sparkle/SUAppcastItem.m b/Sparkle/SUAppcastItem.m index e02e03a8..1b0f95f2 100644 --- a/Sparkle/SUAppcastItem.m +++ b/Sparkle/SUAppcastItem.m @@ -12,9 +12,8 @@ #import "SUConstants.h" #import "SPUInstallationType.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" static NSString *SUAppcastItemDeltaUpdatesKey = @"deltaUpdates"; static NSString *SUAppcastItemDisplayVersionStringKey = @"displayVersionString"; diff --git a/Sparkle/SUBundleIcon.m b/Sparkle/SUBundleIcon.m index b1f5444f..3061c65e 100644 --- a/Sparkle/SUBundleIcon.m +++ b/Sparkle/SUBundleIcon.m @@ -9,9 +9,8 @@ #import "SUBundleIcon.h" #import "SUHost.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @implementation SUBundleIcon diff --git a/Sparkle/SUConstants.m b/Sparkle/SUConstants.m index 46633c81..f0ec3754 100644 --- a/Sparkle/SUConstants.m +++ b/Sparkle/SUConstants.m @@ -13,9 +13,7 @@ #define DEBUG 0 #endif -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif +#include "AppKitPrevention.h" // Define some minimum intervals to avoid DoS-like checking attacks const NSTimeInterval SUMinimumUpdateCheckInterval = DEBUG ? 60 : (60 * 60); diff --git a/Sparkle/SUFileManager.m b/Sparkle/SUFileManager.m index 3dd37c78..a1af8216 100644 --- a/Sparkle/SUFileManager.m +++ b/Sparkle/SUFileManager.m @@ -14,9 +14,8 @@ #include #include -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" static char SUAppleQuarantineIdentifier[] = "com.apple.quarantine"; diff --git a/Sparkle/SUHost.m b/Sparkle/SUHost.m index 2faff0e9..90c96e4c 100644 --- a/Sparkle/SUHost.m +++ b/Sparkle/SUHost.m @@ -11,9 +11,8 @@ #include // For statfs for isRunningOnReadOnlyVolume #import "SULog.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" // This class should not rely on AppKit and should also be process independent // For example, it should not have code that tests writabilty to somewhere on disk, diff --git a/Sparkle/SULog.m b/Sparkle/SULog.m index aa3192de..69212333 100644 --- a/Sparkle/SULog.m +++ b/Sparkle/SULog.m @@ -11,9 +11,8 @@ #include #import "SUOperatingSystem.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" implementation and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" // For converting constants to string literals using the preprocessor #define STRINGIFY(x) #x diff --git a/Sparkle/SUOperatingSystem.m b/Sparkle/SUOperatingSystem.m index edaae13a..fada18c3 100644 --- a/Sparkle/SUOperatingSystem.m +++ b/Sparkle/SUOperatingSystem.m @@ -7,9 +7,8 @@ #import "SUOperatingSystem.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" #if __MAC_OS_X_VERSION_MAX_ALLOWED < 101000 @interface NSProcessInfo () diff --git a/Sparkle/SUStandardVersionComparator.m b/Sparkle/SUStandardVersionComparator.m index fc87e65a..a2958e82 100644 --- a/Sparkle/SUStandardVersionComparator.m +++ b/Sparkle/SUStandardVersionComparator.m @@ -9,9 +9,8 @@ #import "SUVersionComparisonProtocol.h" #import "SUStandardVersionComparator.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @implementation SUStandardVersionComparator diff --git a/Sparkle/SUSystemProfiler.m b/Sparkle/SUSystemProfiler.m index 1d73d793..b5ef53d9 100644 --- a/Sparkle/SUSystemProfiler.m +++ b/Sparkle/SUSystemProfiler.m @@ -8,14 +8,12 @@ // #import "SUSystemProfiler.h" - #import "SUHost.h" #import "SUOperatingSystem.h" #include -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" static NSString *const SUSystemProfilerApplicationNameKey = @"appName"; static NSString *const SUSystemProfilerApplicationVersionKey = @"appVersion"; diff --git a/Sparkle/SUSystemUpdateInfo.m b/Sparkle/SUSystemUpdateInfo.m index 7ef2dd8f..78325eae 100644 --- a/Sparkle/SUSystemUpdateInfo.m +++ b/Sparkle/SUSystemUpdateInfo.m @@ -11,6 +11,9 @@ #import "SUConstants.h" #import "SUFileManager.h" + +#include "AppKitPrevention.h" + @implementation SUSystemUpdateInfo + (BOOL)systemAllowsAutomaticUpdatesForHost:(SUHost *)host diff --git a/Sparkle/SUUpdatePermissionResponse.m b/Sparkle/SUUpdatePermissionResponse.m index 8795cc87..832e3774 100644 --- a/Sparkle/SUUpdatePermissionResponse.m +++ b/Sparkle/SUUpdatePermissionResponse.m @@ -8,9 +8,8 @@ #import "SUUpdatePermissionResponse.h" -#ifdef _APPKITDEFINES_H -#error This is a "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" static NSString *SUUpdatePermissionAutomaticUpdateChecksKey = @"SUUpdatePermissionAutomaticUpdateChecks"; static NSString *SUUpdatePermissionSendSystemProfileKey = @"SUUpdatePermissionSendSystemProfile"; diff --git a/Sparkle/SUUpdateValidator.m b/Sparkle/SUUpdateValidator.m index ae1acade..1b1cdbe8 100644 --- a/Sparkle/SUUpdateValidator.m +++ b/Sparkle/SUUpdateValidator.m @@ -13,9 +13,8 @@ #import "SUHost.h" #import "SULog.h" -#ifdef _APPKITDEFINES_H -#error This is a "daemon-safe" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface SUUpdateValidator ()