Add AppKitPrevention header to reduce redundancy.

Note this header should be included last in implementation files, which is why I added extra padding.
This commit is contained in:
Zorg committed 2017-01-17 07:08:29 -05:00
1 parent c56694382e
commit 135d05b8b8
32 files changed
+76 -91

No files matched your search

+2
View File
@@ -732,6 +732,7 @@
7205C4331E12C23C00E370AE /* ConfigGenerateAppcast.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigGenerateAppcast.xcconfig; sourceTree = "<group>"; };
7205C4341E12C66D00E370AE /* ConfigGenerateAppcastRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigGenerateAppcastRelease.xcconfig; sourceTree = "<group>"; };
7205C4351E12CA7000E370AE /* ConfigGenerateAppcastDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigGenerateAppcastDebug.xcconfig; sourceTree = "<group>"; };
720767D01E2E3DD300F9A850 /* AppKitPrevention.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppKitPrevention.h; sourceTree = "<group>"; };
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; };
7210C7671B9A9A1500EB90AC /* SUUnarchiverTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SUUnarchiverTest.swift; sourceTree = "<group>"; };
@@ -1036,6 +1037,7 @@
1495006D195FBBBD00BC5B5B /* Sparkle */ = {
isa = PBXGroup;
children = (
720767D01E2E3DD300F9A850 /* AppKitPrevention.h */,
61299B3909CB055000B7442F /* Appcast Support */,
55C14BD5136EEFD000649790 /* Autoupdate */,
089C1665FE841158C02AAC07 /* Framework Resources */,
+16
View File
@@ -0,0 +1,16 @@
//
// 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
#ifdef _APPKITDEFINES_H
#error This is a core or daemon-safe module and should NOT import AppKit
#endif
+2 -3
View File
@@ -12,9 +12,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 NSXMLElement (SUAppcastExtensions)
@property (readonly, copy) NSDictionary *attributesAsDictionary;
+2 -3
View File
@@ -10,9 +10,8 @@
#import "SULog.h"
#import "SUConstants.h"
#ifdef _APPKITDEFINES_H
#error This is a "core" class and should NOT import AppKit
#endif
#include "AppKitPrevention.h"
@interface SUAppcastItem ()
@property (copy, readwrite) NSString *title;
+2 -3
View File
@@ -15,9 +15,8 @@
#include <stdlib.h>
#include <xar/xar.h>
#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)
{
+2 -3
View File
@@ -18,9 +18,8 @@
#include <sys/stat.h>
#include <xar/xar.h>
#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)
{
+2 -3
View File
@@ -21,9 +21,8 @@
#include <sys/xattr.h>
#include <xar/xar.h>
#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);
+1 -3
View File
@@ -20,9 +20,7 @@
#define VERSION_COMMAND @"version"
#define VERSION_ALTERNATE_COMMAND @"--version"
#ifdef _APPKITDEFINES_H
#error This is a "core" class and should NOT import AppKit
#endif
#include "AppKitPrevention.h"
static void printUsage(NSString *programName)
{
+2 -3
View File
@@ -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 ()
+2 -3
View File
@@ -8,9 +8,8 @@
#import "SUBundleIcon.h"
#ifdef _APPKITDEFINES_H
#error This is a "core" class and should NOT import AppKit
#endif
#include "AppKitPrevention.h"
@implementation SUBundleIcon
+2 -3
View File
@@ -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
+1 -3
View File
@@ -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);
+2 -3
View File
@@ -16,9 +16,8 @@
#import "SULog.h"
#include <CommonCrypto/CommonDigest.h>
#ifdef _APPKITDEFINES_H
#error This is a "core" class and should NOT import AppKit
#endif
#include "AppKitPrevention.h"
@implementation SUDSAVerifier {
SecKeyRef _secKey;
+2 -3
View File
@@ -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 ()
+2 -3
View File
@@ -15,9 +15,8 @@
#include <sys/errno.h>
#include <sys/time.h>
#ifdef _APPKITDEFINES_H
#error This is a "core" class and should NOT import AppKit
#endif
#include "AppKitPrevention.h"
static char SUAppleQuarantineIdentifier[] = "com.apple.quarantine";
+2 -3
View File
@@ -9,9 +9,8 @@
#import "SUGuidedPackageInstaller.h"
#import "SUFileManager.h"
#ifdef _APPKITDEFINES_H
#error This is a "core" class and should NOT import AppKit
#endif
#include "AppKitPrevention.h"
@interface SUGuidedPackageInstaller ()
+2 -3
View File
@@ -11,9 +11,8 @@
#include <sys/mount.h> // 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,
+2 -3
View File
@@ -15,9 +15,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"
@implementation SUInstaller
+2 -3
View File
@@ -13,9 +13,8 @@
#include "SULog.h"
#ifdef _APPKITDEFINES_H
#error This is a "core" class and should NOT import AppKit
#endif
#include "AppKitPrevention.h"
// -----------------------------------------------------------------------------
// Constants:
+2 -3
View File
@@ -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 ()
+2 -3
View File
@@ -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 ()
+2 -3
View File
@@ -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 ()
+2 -3
View File
@@ -14,9 +14,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 SUPlainInstaller ()
+2 -3
View File
@@ -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
+2 -4
View File
@@ -9,14 +9,12 @@
#import <Foundation/Foundation.h>
#import "SUSystemProfiler.h"
#import "SUHost.h"
#import "SUOperatingSystem.h"
#include <sys/sysctl.h>
#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";
+2 -3
View File
@@ -11,9 +11,8 @@
#import "SUConstants.h"
#import "SUFileManager.h"
#ifdef _APPKITDEFINES_H
#error This is a "core" class and should NOT import AppKit
#endif
#include "AppKitPrevention.h"
@implementation SUSystemUpdateInfo
+2 -3
View File
@@ -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
+2 -3
View File
@@ -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 ()
+2 -3
View File
@@ -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"
@implementation SUUpdatePermissionResponse
+2 -3
View File
@@ -13,9 +13,8 @@
#import "SUHost.h"
#import "SULog.h"
#ifdef _APPKITDEFINES_H
#error This is a "core" class and should NOT import AppKit
#endif
#include "AppKitPrevention.h"
@interface SUUpdateValidator ()
+2 -3
View File
@@ -8,9 +8,8 @@
#import "SUFileOperationConstants.h"
#ifdef _APPKITDEFINES_H
#error This is a "core" class and should NOT import AppKit
#endif
#include "AppKitPrevention.h"
char * const SUFileOpRemoveQuarantineCommand = "xattr-d-apple-quarantine";
char * const SUFileOpCopyCommand = "cp";
+2 -3
View File
@@ -10,9 +10,8 @@
#import "SUFileManager.h"
#import "SUFileOperationConstants.h"
#ifdef _APPKITDEFINES_H
#error This is a "core" class and should NOT import AppKit
#endif
#include "AppKitPrevention.h"
// If we fail, we exit with a unique status code
// We don't try to NSLog because the logs can't be seen anywhere,