From c1488b05157a80d15742f69142f8b409645fc143 Mon Sep 17 00:00:00 2001 From: Thomas Tempelmann Date: Mon, 16 Jan 2017 01:02:32 +0100 Subject: [PATCH 01/14] Adds test cases for "sparkle:criticalUpdate" tag. (#999) * Adds a test case for the "criticalUpdate" appcast tag (not as a XCTest but simply as an assert inside the test app, because I was lazy and am working on an older Xcode version that does not support the currently needed swift version for the XCTest in SUAppcastTest.swift). * Tests the "criticalUpdate" appcast tag, using the proper XCTest swift class. I haven't tested this, though, due to the lack of the needed Xcode version. * Test case for Appcast now checks all 4 items for the correct "criticalUpdate" state. * Adds a test case for the "criticalUpdate" appcast tag (not as a XCTest but simply as an assert inside the test app, because I was lazy and am working on an older Xcode version that does not support the currently needed swift version for the XCTest in SUAppcastTest.swift). (reverted from commit 3ce1c9790bb233dbc228379d22a5bf38a31eff37) --- Tests/Resources/testappcast.xml | 1 + Tests/SUAppcastTest.swift | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/Tests/Resources/testappcast.xml b/Tests/Resources/testappcast.xml index 287dbda4..c156b310 100644 --- a/Tests/Resources/testappcast.xml +++ b/Tests/Resources/testappcast.xml @@ -7,6 +7,7 @@ desc Sat, 26 Jul 2014 15:20:11 +0000 + diff --git a/Tests/SUAppcastTest.swift b/Tests/SUAppcastTest.swift index c5250a60..5be4507e 100644 --- a/Tests/SUAppcastTest.swift +++ b/Tests/SUAppcastTest.swift @@ -25,19 +25,23 @@ class SUAppcastTest: XCTestCase { XCTAssertEqual("Version 2.0", items[0].title); XCTAssertEqual("desc", items[0].itemDescription); XCTAssertEqual("Sat, 26 Jul 2014 15:20:11 +0000", items[0].dateString) + XCTAssertTrue(items[0].isCriticalUpdate); // This is the best release matching our system version XCTAssertEqual("Version 3.0", items[1].title); XCTAssertNil(items[1].itemDescription); XCTAssertNil(items[1].dateString) + XCTAssertFalse(items[1].isCriticalUpdate); XCTAssertEqual("Version 4.0", items[2].title); XCTAssertNil(items[2].itemDescription); XCTAssertEqual("Sat, 26 Jul 2014 15:20:13 +0000", items[2].dateString) + XCTAssertFalse(items[2].isCriticalUpdate); XCTAssertEqual("Version 5.0", items[3].title); XCTAssertNil(items[3].itemDescription); XCTAssertNil(items[3].dateString) + XCTAssertFalse(items[3].isCriticalUpdate); // Test best appcast item & a delta update item var deltaItem: SUAppcastItem? = nil From 282f0ae58e15fcdbd9f46bc9704c77912410614a Mon Sep 17 00:00:00 2001 From: Zorg Date: Mon, 16 Jan 2017 18:09:04 -0500 Subject: [PATCH 02/14] Add Obj-C generics where applicable In headers that are exported, we test to see if generic support is available. --- Sparkle/SUAppcast.h | 5 +++++ Sparkle/SUAppcast.m | 2 +- Sparkle/SUSystemProfiler.h | 2 +- Sparkle/SUSystemProfiler.m | 8 ++++---- Sparkle/SUUpdater.h | 4 ++++ Sparkle/SUUpdater.m | 2 +- Sparkle/SUUpdaterDelegate.h | 4 ++++ 7 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Sparkle/SUAppcast.h b/Sparkle/SUAppcast.h index c81994b4..55fc4bc7 100644 --- a/Sparkle/SUAppcast.h +++ b/Sparkle/SUAppcast.h @@ -22,7 +22,12 @@ NS_ASSUME_NONNULL_BEGIN SU_EXPORT @interface SUAppcast : NSObject @property (copy, nullable) NSString *userAgentString; + +#if __has_feature(objc_generics) +@property (copy, nullable) NSDictionary *httpHeaders; +#else @property (copy, nullable) NSDictionary *httpHeaders; +#endif - (void)fetchAppcastFromURL:(NSURL *)url completionBlock:(void (^)(NSError *_Nullable))err; - (SUAppcast *)copyWithoutDeltaUpdates; diff --git a/Sparkle/SUAppcast.m b/Sparkle/SUAppcast.m index 8873854a..70b56f0a 100644 --- a/Sparkle/SUAppcast.m +++ b/Sparkle/SUAppcast.m @@ -65,7 +65,7 @@ if (self.httpHeaders) { for (NSString *key in self.httpHeaders) { - id value = [self.httpHeaders objectForKey:key]; + NSString *value = [self.httpHeaders objectForKey:key]; [request setValue:value forHTTPHeaderField:key]; } } diff --git a/Sparkle/SUSystemProfiler.h b/Sparkle/SUSystemProfiler.h index 6223e22e..4bf05472 100644 --- a/Sparkle/SUSystemProfiler.h +++ b/Sparkle/SUSystemProfiler.h @@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN @class SUHost; @interface SUSystemProfiler : NSObject -+ (NSArray *)systemProfileArrayForHost:(SUHost *)host; ++ (NSArray *> *)systemProfileArrayForHost:(SUHost *)host; @end diff --git a/Sparkle/SUSystemProfiler.m b/Sparkle/SUSystemProfiler.m index ae2f10f5..83a93cee 100644 --- a/Sparkle/SUSystemProfiler.m +++ b/Sparkle/SUSystemProfiler.m @@ -28,19 +28,19 @@ static NSString *const SUSystemProfilerPreferredLanguageKey = @"lang"; @implementation SUSystemProfiler -+ (NSDictionary *)modelTranslationTable ++ (NSDictionary *)modelTranslationTable { // Use explicit class to use the correct bundle even when subclassed NSString *path = [[NSBundle bundleForClass:[SUSystemProfiler class]] pathForResource:@"SUModelTranslation" ofType:@"plist"]; return [[NSDictionary alloc] initWithContentsOfFile:path]; } -+ (NSArray *)systemProfileArrayForHost:(SUHost *)host ++ (NSArray *> *)systemProfileArrayForHost:(SUHost *)host { - NSDictionary *modelTranslation = [self modelTranslationTable]; + NSDictionary *modelTranslation = [self modelTranslationTable]; // Gather profile information and append it to the URL. - NSMutableArray *profileArray = [NSMutableArray array]; + NSMutableArray *> *profileArray = [NSMutableArray array]; NSArray *profileDictKeys = @[@"key", @"displayKey", @"value", @"displayValue"]; int error = 0; int value = 0; diff --git a/Sparkle/SUUpdater.h b/Sparkle/SUUpdater.h index f627ed14..679f1b79 100644 --- a/Sparkle/SUUpdater.h +++ b/Sparkle/SUUpdater.h @@ -160,7 +160,11 @@ SU_EXPORT @interface SUUpdater : NSObject The keys of this dictionary are HTTP header fields (NSString) and values are corresponding values (NSString) */ +#if __has_feature(objc_generics) +@property (copy) NSDictionary *httpHeaders; +#else @property (copy) NSDictionary *httpHeaders; +#endif /*! A property indicating whether or not the user's system profile information is sent when checking for updates. diff --git a/Sparkle/SUUpdater.m b/Sparkle/SUUpdater.m index 7794db19..e9ff87e4 100644 --- a/Sparkle/SUUpdater.m +++ b/Sparkle/SUUpdater.m @@ -210,7 +210,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults } if (shouldPrompt) { - NSArray *profileInfo = [SUSystemProfiler systemProfileArrayForHost:self.host]; + NSArray *> *profileInfo = [SUSystemProfiler systemProfileArrayForHost:self.host]; // Always say we're sending the system profile here so that the delegate displays the parameters it would send. if ([self.delegate respondsToSelector:@selector(feedParametersForUpdater:sendingSystemProfile:)]) { profileInfo = [profileInfo arrayByAddingObjectsFromArray:[self.delegate feedParametersForUpdater:self sendingSystemProfile:YES]]; diff --git a/Sparkle/SUUpdaterDelegate.h b/Sparkle/SUUpdaterDelegate.h index 522764ed..39249ac4 100644 --- a/Sparkle/SUUpdaterDelegate.h +++ b/Sparkle/SUUpdaterDelegate.h @@ -64,7 +64,11 @@ SU_EXPORT extern NSString *const SUUpdaterAppcastNotificationKey; \return An array of dictionaries with keys: "key", "value", "displayKey", "displayValue", the latter two being specifically for display to the user. */ +#if __has_feature(objc_generics) +- (NSArray *> *)feedParametersForUpdater:(SUUpdater *)updater sendingSystemProfile:(BOOL)sendingProfile; +#else - (NSArray *)feedParametersForUpdater:(SUUpdater *)updater sendingSystemProfile:(BOOL)sendingProfile; +#endif /*! Returns a custom appcast URL. From c56694382eb7f545c44f2808949a73a28557d534 Mon Sep 17 00:00:00 2001 From: Zorg Date: Mon, 16 Jan 2017 21:17:25 -0500 Subject: [PATCH 03/14] Add AppKit prevention guards to modules that shouldn't import it --- Sparkle/SUAppcast.m | 4 ++++ Sparkle/SUAppcastItem.m | 4 ++++ Sparkle/SUBinaryDeltaApply.m | 4 ++++ Sparkle/SUBinaryDeltaCommon.m | 4 ++++ Sparkle/SUBinaryDeltaCreate.m | 4 ++++ Sparkle/SUBinaryDeltaTool.m | 4 ++++ Sparkle/SUBinaryDeltaUnarchiver.m | 4 ++++ Sparkle/SUBundleIcon.m | 4 ++++ Sparkle/SUCodeSigningVerifier.m | 4 ++++ Sparkle/SUConstants.m | 4 ++++ Sparkle/SUDSAVerifier.m | 4 ++++ Sparkle/SUDiskImageUnarchiver.m | 4 ++++ Sparkle/SUFileManager.m | 4 ++++ Sparkle/SUGuidedPackageInstaller.m | 4 ++++ Sparkle/SUHost.m | 4 ++++ Sparkle/SUInstaller.m | 4 ++++ Sparkle/SULog.m | 3 +++ Sparkle/SUOperatingSystem.m | 4 ++++ Sparkle/SUPackageInstaller.m | 4 ++++ Sparkle/SUPipedUnarchiver.m | 4 ++++ Sparkle/SUPlainInstaller.m | 4 ++++ Sparkle/SUStandardVersionComparator.m | 4 ++++ Sparkle/SUSystemProfiler.m | 4 ++++ Sparkle/SUSystemUpdateInfo.m | 4 ++++ Sparkle/SUUnarchiver.m | 4 ++++ Sparkle/SUUnarchiverNotifier.m | 4 ++++ Sparkle/SUUpdatePermissionResponse.m | 4 ++++ Sparkle/SUUpdateValidator.m | 4 ++++ fileop/SUFileOperationConstants.m | 4 ++++ fileop/fileop.m | 4 ++++ 30 files changed, 119 insertions(+) diff --git a/Sparkle/SUAppcast.m b/Sparkle/SUAppcast.m index 70b56f0a..2341222e 100644 --- a/Sparkle/SUAppcast.m +++ b/Sparkle/SUAppcast.m @@ -12,6 +12,10 @@ #import "SULocalizations.h" #import "SUErrors.h" +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + @interface NSXMLElement (SUAppcastExtensions) @property (readonly, copy) NSDictionary *attributesAsDictionary; @end diff --git a/Sparkle/SUAppcastItem.m b/Sparkle/SUAppcastItem.m index 164b5bad..0e1acd92 100644 --- a/Sparkle/SUAppcastItem.m +++ b/Sparkle/SUAppcastItem.m @@ -10,6 +10,10 @@ #import "SULog.h" #import "SUConstants.h" +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + @interface SUAppcastItem () @property (copy, readwrite) NSString *title; @property (copy, readwrite) NSString *dateString; diff --git a/Sparkle/SUBinaryDeltaApply.m b/Sparkle/SUBinaryDeltaApply.m index eac297b4..da6c6f85 100644 --- a/Sparkle/SUBinaryDeltaApply.m +++ b/Sparkle/SUBinaryDeltaApply.m @@ -15,6 +15,10 @@ #include #include +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + static BOOL applyBinaryDeltaToFile(xar_t x, xar_file_t file, NSString *sourceFilePath, NSString *destinationFilePath) { NSString *patchFile = temporaryFilename(@"apply-binary-delta"); diff --git a/Sparkle/SUBinaryDeltaCommon.m b/Sparkle/SUBinaryDeltaCommon.m index 5f6ce079..7d2cd316 100644 --- a/Sparkle/SUBinaryDeltaCommon.m +++ b/Sparkle/SUBinaryDeltaCommon.m @@ -18,6 +18,10 @@ #include #include +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + int compareFiles(const FTSENT **a, const FTSENT **b) { return strcoll((*a)->fts_name, (*b)->fts_name); diff --git a/Sparkle/SUBinaryDeltaCreate.m b/Sparkle/SUBinaryDeltaCreate.m index 0a8fbc52..00807cf5 100644 --- a/Sparkle/SUBinaryDeltaCreate.m +++ b/Sparkle/SUBinaryDeltaCreate.m @@ -21,6 +21,10 @@ #include #include +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + extern int bsdiff(int argc, const char **argv); @interface CreateBinaryDeltaOperation : NSOperation diff --git a/Sparkle/SUBinaryDeltaTool.m b/Sparkle/SUBinaryDeltaTool.m index ea83fdd0..2dce1d54 100644 --- a/Sparkle/SUBinaryDeltaTool.m +++ b/Sparkle/SUBinaryDeltaTool.m @@ -20,6 +20,10 @@ #define VERSION_COMMAND @"version" #define VERSION_ALTERNATE_COMMAND @"--version" +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + static void printUsage(NSString *programName) { fprintf(stderr, "Usage:\n"); diff --git a/Sparkle/SUBinaryDeltaUnarchiver.m b/Sparkle/SUBinaryDeltaUnarchiver.m index 6dc2a666..aed4a07e 100644 --- a/Sparkle/SUBinaryDeltaUnarchiver.m +++ b/Sparkle/SUBinaryDeltaUnarchiver.m @@ -13,6 +13,10 @@ #import "SULog.h" #import "SUFileManager.h" +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + @interface SUBinaryDeltaUnarchiver () @property (nonatomic, copy, readonly) NSString *archivePath; diff --git a/Sparkle/SUBundleIcon.m b/Sparkle/SUBundleIcon.m index a3d86a80..30a831a8 100644 --- a/Sparkle/SUBundleIcon.m +++ b/Sparkle/SUBundleIcon.m @@ -8,6 +8,10 @@ #import "SUBundleIcon.h" +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + @implementation SUBundleIcon + (NSURL *)iconURLForBundle:(NSBundle *)bundle diff --git a/Sparkle/SUCodeSigningVerifier.m b/Sparkle/SUCodeSigningVerifier.m index 1da556f2..7fa84625 100644 --- a/Sparkle/SUCodeSigningVerifier.m +++ b/Sparkle/SUCodeSigningVerifier.m @@ -11,6 +11,10 @@ #import "SUCodeSigningVerifier.h" #import "SULog.h" +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + @implementation SUCodeSigningVerifier + (BOOL)codeSignatureAtBundleURL:(NSURL *)oldBundleURL matchesSignatureAtBundleURL:(NSURL *)newBundleURL error:(NSError *__autoreleasing *)error diff --git a/Sparkle/SUConstants.m b/Sparkle/SUConstants.m index f5e73fda..09faeabb 100644 --- a/Sparkle/SUConstants.m +++ b/Sparkle/SUConstants.m @@ -13,6 +13,10 @@ #define DEBUG 0 #endif +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + // Define some minimum intervals to avoid DoS-like checking attacks const NSTimeInterval SUMinimumUpdateCheckInterval = DEBUG ? 60 : (60 * 60); const NSTimeInterval SUDefaultUpdateCheckInterval = DEBUG ? 60 : (60 * 60 * 24); diff --git a/Sparkle/SUDSAVerifier.m b/Sparkle/SUDSAVerifier.m index fa5f9934..5542e3cf 100644 --- a/Sparkle/SUDSAVerifier.m +++ b/Sparkle/SUDSAVerifier.m @@ -16,6 +16,10 @@ #import "SULog.h" #include +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + @implementation SUDSAVerifier { SecKeyRef _secKey; } diff --git a/Sparkle/SUDiskImageUnarchiver.m b/Sparkle/SUDiskImageUnarchiver.m index 60f59780..dfd0c011 100644 --- a/Sparkle/SUDiskImageUnarchiver.m +++ b/Sparkle/SUDiskImageUnarchiver.m @@ -10,6 +10,10 @@ #import "SUUnarchiverNotifier.h" #import "SULog.h" +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + @interface SUDiskImageUnarchiver () @property (nonatomic, copy, readonly) NSString *archivePath; diff --git a/Sparkle/SUFileManager.m b/Sparkle/SUFileManager.m index 26369b63..64a1aa66 100644 --- a/Sparkle/SUFileManager.m +++ b/Sparkle/SUFileManager.m @@ -15,6 +15,10 @@ #include #include +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + static char SUAppleQuarantineIdentifier[] = "com.apple.quarantine"; static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { diff --git a/Sparkle/SUGuidedPackageInstaller.m b/Sparkle/SUGuidedPackageInstaller.m index 308b186c..5093c5e5 100644 --- a/Sparkle/SUGuidedPackageInstaller.m +++ b/Sparkle/SUGuidedPackageInstaller.m @@ -9,6 +9,10 @@ #import "SUGuidedPackageInstaller.h" #import "SUFileManager.h" +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + @interface SUGuidedPackageInstaller () @property (nonatomic, readonly, copy) NSString *packagePath; diff --git a/Sparkle/SUHost.m b/Sparkle/SUHost.m index 8470ae22..0094d669 100644 --- a/Sparkle/SUHost.m +++ b/Sparkle/SUHost.m @@ -11,6 +11,10 @@ #include // For statfs for isRunningOnReadOnlyVolume #import "SULog.h" +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + // 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, // as that may depend on the privileges of the process owner. Or code that depends on diff --git a/Sparkle/SUInstaller.m b/Sparkle/SUInstaller.m index 3ef0c5ff..383754fc 100644 --- a/Sparkle/SUInstaller.m +++ b/Sparkle/SUInstaller.m @@ -15,6 +15,10 @@ #import "SULog.h" #import "SUErrors.h" +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + @implementation SUInstaller + (BOOL)isAliasFolderAtPath:(NSString *)path diff --git a/Sparkle/SULog.m b/Sparkle/SULog.m index 5941aac7..c6519e49 100644 --- a/Sparkle/SULog.m +++ b/Sparkle/SULog.m @@ -13,6 +13,9 @@ #include "SULog.h" +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif // ----------------------------------------------------------------------------- // Constants: diff --git a/Sparkle/SUOperatingSystem.m b/Sparkle/SUOperatingSystem.m index 4a7d73aa..edaae13a 100644 --- a/Sparkle/SUOperatingSystem.m +++ b/Sparkle/SUOperatingSystem.m @@ -7,6 +7,10 @@ #import "SUOperatingSystem.h" +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + #if __MAC_OS_X_VERSION_MAX_ALLOWED < 101000 @interface NSProcessInfo () - (NSOperatingSystemVersion)operatingSystemVersion; diff --git a/Sparkle/SUPackageInstaller.m b/Sparkle/SUPackageInstaller.m index 226cde20..15a463d8 100644 --- a/Sparkle/SUPackageInstaller.m +++ b/Sparkle/SUPackageInstaller.m @@ -11,6 +11,10 @@ #import "SUErrors.h" #import "SULog.h" +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + @interface SUPackageInstaller () @property (nonatomic, readonly, copy) NSString *packagePath; diff --git a/Sparkle/SUPipedUnarchiver.m b/Sparkle/SUPipedUnarchiver.m index b155b408..8b4efb66 100644 --- a/Sparkle/SUPipedUnarchiver.m +++ b/Sparkle/SUPipedUnarchiver.m @@ -11,6 +11,10 @@ #import "SULog.h" #import "SUErrors.h" +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + @interface SUPipedUnarchiver () @property (nonatomic, copy, readonly) NSString *archivePath; diff --git a/Sparkle/SUPlainInstaller.m b/Sparkle/SUPlainInstaller.m index 586ce47f..7d3ad419 100644 --- a/Sparkle/SUPlainInstaller.m +++ b/Sparkle/SUPlainInstaller.m @@ -14,6 +14,10 @@ #import "SULog.h" #import "SUErrors.h" +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + @interface SUPlainInstaller () @property (nonatomic, readonly) SUHost *host; diff --git a/Sparkle/SUStandardVersionComparator.m b/Sparkle/SUStandardVersionComparator.m index 7bc68181..fc87e65a 100644 --- a/Sparkle/SUStandardVersionComparator.m +++ b/Sparkle/SUStandardVersionComparator.m @@ -9,6 +9,10 @@ #import "SUVersionComparisonProtocol.h" #import "SUStandardVersionComparator.h" +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + @implementation SUStandardVersionComparator - (instancetype)init diff --git a/Sparkle/SUSystemProfiler.m b/Sparkle/SUSystemProfiler.m index 83a93cee..822da49b 100644 --- a/Sparkle/SUSystemProfiler.m +++ b/Sparkle/SUSystemProfiler.m @@ -14,6 +14,10 @@ #import "SUOperatingSystem.h" #include +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + static NSString *const SUSystemProfilerApplicationNameKey = @"appName"; static NSString *const SUSystemProfilerApplicationVersionKey = @"appVersion"; static NSString *const SUSystemProfilerCPU64bitKey = @"cpu64bit"; diff --git a/Sparkle/SUSystemUpdateInfo.m b/Sparkle/SUSystemUpdateInfo.m index 7ef2dd8f..e06cb747 100644 --- a/Sparkle/SUSystemUpdateInfo.m +++ b/Sparkle/SUSystemUpdateInfo.m @@ -11,6 +11,10 @@ #import "SUConstants.h" #import "SUFileManager.h" +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + @implementation SUSystemUpdateInfo + (BOOL)systemAllowsAutomaticUpdatesForHost:(SUHost *)host diff --git a/Sparkle/SUUnarchiver.m b/Sparkle/SUUnarchiver.m index 7b808814..d91159f9 100644 --- a/Sparkle/SUUnarchiver.m +++ b/Sparkle/SUUnarchiver.m @@ -12,6 +12,10 @@ #import "SUDiskImageUnarchiver.h" #import "SUBinaryDeltaUnarchiver.h" +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + @implementation SUUnarchiver + (nullable id )unarchiverForPath:(NSString *)path updatingHostBundlePath:(nullable NSString *)hostPath decryptionPassword:(nullable NSString *)decryptionPassword diff --git a/Sparkle/SUUnarchiverNotifier.m b/Sparkle/SUUnarchiverNotifier.m index 727ac7da..914a08e7 100644 --- a/Sparkle/SUUnarchiverNotifier.m +++ b/Sparkle/SUUnarchiverNotifier.m @@ -10,6 +10,10 @@ #import "SULocalizations.h" #import "SUErrors.h" +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + @interface SUUnarchiverNotifier () @property (nonatomic, readonly, copy) void (^completionBlock)(NSError * _Nullable); diff --git a/Sparkle/SUUpdatePermissionResponse.m b/Sparkle/SUUpdatePermissionResponse.m index 02c89acd..6636a2f8 100644 --- a/Sparkle/SUUpdatePermissionResponse.m +++ b/Sparkle/SUUpdatePermissionResponse.m @@ -8,6 +8,10 @@ #import "SUUpdatePermissionResponse.h" +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + @implementation SUUpdatePermissionResponse @synthesize automaticUpdateChecks = _automaticUpdateChecks; diff --git a/Sparkle/SUUpdateValidator.m b/Sparkle/SUUpdateValidator.m index 164da998..efd8ace3 100644 --- a/Sparkle/SUUpdateValidator.m +++ b/Sparkle/SUUpdateValidator.m @@ -13,6 +13,10 @@ #import "SUHost.h" #import "SULog.h" +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + @interface SUUpdateValidator () @property (nonatomic, readonly) SUHost *host; diff --git a/fileop/SUFileOperationConstants.m b/fileop/SUFileOperationConstants.m index 5ece5917..8a90d30b 100644 --- a/fileop/SUFileOperationConstants.m +++ b/fileop/SUFileOperationConstants.m @@ -8,6 +8,10 @@ #import "SUFileOperationConstants.h" +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + char * const SUFileOpRemoveQuarantineCommand = "xattr-d-apple-quarantine"; char * const SUFileOpCopyCommand = "cp"; char * const SUFileOpMoveCommand = "mv"; diff --git a/fileop/fileop.m b/fileop/fileop.m index 044f2abc..d254439a 100644 --- a/fileop/fileop.m +++ b/fileop/fileop.m @@ -10,6 +10,10 @@ #import "SUFileManager.h" #import "SUFileOperationConstants.h" +#ifdef _APPKITDEFINES_H +#error This is a "core" class and should NOT import AppKit +#endif + // If we fail, we exit with a unique status code // We don't try to NSLog because the logs can't be seen anywhere, // and we don't want to log to a file irresponsibly (especially as root), From 135d05b8b8a1463f262b8d7dce4ab4669b828983 Mon Sep 17 00:00:00 2001 From: Zorg Date: Tue, 17 Jan 2017 07:08:29 -0500 Subject: [PATCH 04/14] Add AppKitPrevention header to reduce redundancy. Note this header should be included last in implementation files, which is why I added extra padding. --- Sparkle.xcodeproj/project.pbxproj | 2 ++ Sparkle/AppKitPrevention.h | 16 ++++++++++++++++ Sparkle/SUAppcast.m | 5 ++--- Sparkle/SUAppcastItem.m | 5 ++--- Sparkle/SUBinaryDeltaApply.m | 5 ++--- Sparkle/SUBinaryDeltaCommon.m | 5 ++--- Sparkle/SUBinaryDeltaCreate.m | 5 ++--- Sparkle/SUBinaryDeltaTool.m | 4 +--- Sparkle/SUBinaryDeltaUnarchiver.m | 5 ++--- Sparkle/SUBundleIcon.m | 5 ++--- Sparkle/SUCodeSigningVerifier.m | 5 ++--- Sparkle/SUConstants.m | 4 +--- Sparkle/SUDSAVerifier.m | 5 ++--- Sparkle/SUDiskImageUnarchiver.m | 5 ++--- Sparkle/SUFileManager.m | 5 ++--- Sparkle/SUGuidedPackageInstaller.m | 5 ++--- Sparkle/SUHost.m | 5 ++--- Sparkle/SUInstaller.m | 5 ++--- Sparkle/SULog.m | 5 ++--- Sparkle/SUOperatingSystem.m | 5 ++--- Sparkle/SUPackageInstaller.m | 5 ++--- Sparkle/SUPipedUnarchiver.m | 5 ++--- Sparkle/SUPlainInstaller.m | 5 ++--- Sparkle/SUStandardVersionComparator.m | 5 ++--- Sparkle/SUSystemProfiler.m | 6 ++---- Sparkle/SUSystemUpdateInfo.m | 5 ++--- Sparkle/SUUnarchiver.m | 5 ++--- Sparkle/SUUnarchiverNotifier.m | 5 ++--- Sparkle/SUUpdatePermissionResponse.m | 5 ++--- Sparkle/SUUpdateValidator.m | 5 ++--- fileop/SUFileOperationConstants.m | 5 ++--- fileop/fileop.m | 5 ++--- 32 files changed, 76 insertions(+), 91 deletions(-) create mode 100644 Sparkle/AppKitPrevention.h diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index e83078b9..a713ac34 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -732,6 +732,7 @@ 7205C4331E12C23C00E370AE /* ConfigGenerateAppcast.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigGenerateAppcast.xcconfig; sourceTree = ""; }; 7205C4341E12C66D00E370AE /* ConfigGenerateAppcastRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigGenerateAppcastRelease.xcconfig; sourceTree = ""; }; 7205C4351E12CA7000E370AE /* ConfigGenerateAppcastDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigGenerateAppcastDebug.xcconfig; sourceTree = ""; }; + 720767D01E2E3DD300F9A850 /* 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; }; 7210C7671B9A9A1500EB90AC /* SUUnarchiverTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SUUnarchiverTest.swift; sourceTree = ""; }; @@ -1036,6 +1037,7 @@ 1495006D195FBBBD00BC5B5B /* Sparkle */ = { isa = PBXGroup; children = ( + 720767D01E2E3DD300F9A850 /* AppKitPrevention.h */, 61299B3909CB055000B7442F /* Appcast Support */, 55C14BD5136EEFD000649790 /* Autoupdate */, 089C1665FE841158C02AAC07 /* Framework Resources */, diff --git a/Sparkle/AppKitPrevention.h b/Sparkle/AppKitPrevention.h new file mode 100644 index 00000000..875f72a7 --- /dev/null +++ b/Sparkle/AppKitPrevention.h @@ -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 diff --git a/Sparkle/SUAppcast.m b/Sparkle/SUAppcast.m index 2341222e..fac2d884 100644 --- a/Sparkle/SUAppcast.m +++ b/Sparkle/SUAppcast.m @@ -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; diff --git a/Sparkle/SUAppcastItem.m b/Sparkle/SUAppcastItem.m index 0e1acd92..26cba3e7 100644 --- a/Sparkle/SUAppcastItem.m +++ b/Sparkle/SUAppcastItem.m @@ -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; diff --git a/Sparkle/SUBinaryDeltaApply.m b/Sparkle/SUBinaryDeltaApply.m index da6c6f85..ea93b2be 100644 --- a/Sparkle/SUBinaryDeltaApply.m +++ b/Sparkle/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/Sparkle/SUBinaryDeltaCommon.m b/Sparkle/SUBinaryDeltaCommon.m index 7d2cd316..42e9d6c0 100644 --- a/Sparkle/SUBinaryDeltaCommon.m +++ b/Sparkle/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/Sparkle/SUBinaryDeltaCreate.m b/Sparkle/SUBinaryDeltaCreate.m index 00807cf5..b0dfa3ef 100644 --- a/Sparkle/SUBinaryDeltaCreate.m +++ b/Sparkle/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/Sparkle/SUBinaryDeltaTool.m b/Sparkle/SUBinaryDeltaTool.m index 2dce1d54..fae14ed1 100644 --- a/Sparkle/SUBinaryDeltaTool.m +++ b/Sparkle/SUBinaryDeltaTool.m @@ -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) { diff --git a/Sparkle/SUBinaryDeltaUnarchiver.m b/Sparkle/SUBinaryDeltaUnarchiver.m index aed4a07e..819d8b16 100644 --- a/Sparkle/SUBinaryDeltaUnarchiver.m +++ b/Sparkle/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/Sparkle/SUBundleIcon.m b/Sparkle/SUBundleIcon.m index 30a831a8..84801be2 100644 --- a/Sparkle/SUBundleIcon.m +++ b/Sparkle/SUBundleIcon.m @@ -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 diff --git a/Sparkle/SUCodeSigningVerifier.m b/Sparkle/SUCodeSigningVerifier.m index 7fa84625..85f99a85 100644 --- a/Sparkle/SUCodeSigningVerifier.m +++ b/Sparkle/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/Sparkle/SUConstants.m b/Sparkle/SUConstants.m index 09faeabb..5e883f6f 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/SUDSAVerifier.m b/Sparkle/SUDSAVerifier.m index 5542e3cf..12434c84 100644 --- a/Sparkle/SUDSAVerifier.m +++ b/Sparkle/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/Sparkle/SUDiskImageUnarchiver.m b/Sparkle/SUDiskImageUnarchiver.m index dfd0c011..3ce85cd1 100644 --- a/Sparkle/SUDiskImageUnarchiver.m +++ b/Sparkle/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/Sparkle/SUFileManager.m b/Sparkle/SUFileManager.m index 64a1aa66..98800e3a 100644 --- a/Sparkle/SUFileManager.m +++ b/Sparkle/SUFileManager.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 char SUAppleQuarantineIdentifier[] = "com.apple.quarantine"; diff --git a/Sparkle/SUGuidedPackageInstaller.m b/Sparkle/SUGuidedPackageInstaller.m index 5093c5e5..cea993a2 100644 --- a/Sparkle/SUGuidedPackageInstaller.m +++ b/Sparkle/SUGuidedPackageInstaller.m @@ -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 () diff --git a/Sparkle/SUHost.m b/Sparkle/SUHost.m index 0094d669..63fd0380 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/SUInstaller.m b/Sparkle/SUInstaller.m index 383754fc..98a6c9d5 100644 --- a/Sparkle/SUInstaller.m +++ b/Sparkle/SUInstaller.m @@ -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 diff --git a/Sparkle/SULog.m b/Sparkle/SULog.m index c6519e49..69d136ea 100644 --- a/Sparkle/SULog.m +++ b/Sparkle/SULog.m @@ -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: 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/SUPackageInstaller.m b/Sparkle/SUPackageInstaller.m index 15a463d8..15425fe6 100644 --- a/Sparkle/SUPackageInstaller.m +++ b/Sparkle/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/Sparkle/SUPipedUnarchiver.m b/Sparkle/SUPipedUnarchiver.m index 8b4efb66..178fd5ba 100644 --- a/Sparkle/SUPipedUnarchiver.m +++ b/Sparkle/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/Sparkle/SUPlainInstaller.m b/Sparkle/SUPlainInstaller.m index 7d3ad419..7b86b634 100644 --- a/Sparkle/SUPlainInstaller.m +++ b/Sparkle/SUPlainInstaller.m @@ -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 () 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 822da49b..1d3c085c 100644 --- a/Sparkle/SUSystemProfiler.m +++ b/Sparkle/SUSystemProfiler.m @@ -9,14 +9,12 @@ #import #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 e06cb747..78325eae 100644 --- a/Sparkle/SUSystemUpdateInfo.m +++ b/Sparkle/SUSystemUpdateInfo.m @@ -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 diff --git a/Sparkle/SUUnarchiver.m b/Sparkle/SUUnarchiver.m index d91159f9..9cb33bc6 100644 --- a/Sparkle/SUUnarchiver.m +++ b/Sparkle/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/Sparkle/SUUnarchiverNotifier.m b/Sparkle/SUUnarchiverNotifier.m index 914a08e7..643f0eb9 100644 --- a/Sparkle/SUUnarchiverNotifier.m +++ b/Sparkle/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/Sparkle/SUUpdatePermissionResponse.m b/Sparkle/SUUpdatePermissionResponse.m index 6636a2f8..203ff151 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" @implementation SUUpdatePermissionResponse diff --git a/Sparkle/SUUpdateValidator.m b/Sparkle/SUUpdateValidator.m index efd8ace3..296b5624 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 "core" class and should NOT import AppKit -#endif + +#include "AppKitPrevention.h" @interface SUUpdateValidator () diff --git a/fileop/SUFileOperationConstants.m b/fileop/SUFileOperationConstants.m index 8a90d30b..7476bd6f 100644 --- a/fileop/SUFileOperationConstants.m +++ b/fileop/SUFileOperationConstants.m @@ -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"; diff --git a/fileop/fileop.m b/fileop/fileop.m index d254439a..9bb54411 100644 --- a/fileop/fileop.m +++ b/fileop/fileop.m @@ -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, From 530f3a4a6308c9d91010fc429280afc60afd6ba3 Mon Sep 17 00:00:00 2001 From: Zorg Date: Tue, 17 Jan 2017 07:17:14 -0500 Subject: [PATCH 05/14] Explain why I'm not relying on the compiler to throw linkage errors --- Sparkle/AppKitPrevention.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sparkle/AppKitPrevention.h b/Sparkle/AppKitPrevention.h index 875f72a7..0ede52ff 100644 --- a/Sparkle/AppKitPrevention.h +++ b/Sparkle/AppKitPrevention.h @@ -11,6 +11,10 @@ // 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 From 56db200f06ec0900b8b035f953e7a702a3d9d8b2 Mon Sep 17 00:00:00 2001 From: Bi11 Date: Wed, 18 Jan 2017 01:44:16 +0800 Subject: [PATCH 06/14] Add touch bar build support for Xcode 8.0 and earlier --- Sparkle.xcodeproj/project.pbxproj | 2 + Sparkle/SUAutomaticUpdateAlert.m | 5 +- Sparkle/SUStatusController.m | 5 +- Sparkle/SUTouchBarButtonGroup.h | 4 -- Sparkle/SUTouchBarForwardDeclarations.h | 91 +++++++++++++++++++++++++ Sparkle/SUUpdateAlert.m | 5 +- Sparkle/SUUpdatePermissionPrompt.m | 5 +- 7 files changed, 105 insertions(+), 12 deletions(-) create mode 100644 Sparkle/SUTouchBarForwardDeclarations.h diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index 28ff1914..160ce953 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -800,6 +800,7 @@ C23E88591BE7AF890050BB73 /* SparkleTestCodeSignApp.enc.dmg */ = {isa = PBXFileReference; lastKnownFileType = file; path = SparkleTestCodeSignApp.enc.dmg; sourceTree = ""; }; E1545EC31E1D7E0200FAECE8 /* SUTouchBarButtonGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUTouchBarButtonGroup.h; sourceTree = ""; }; E1545EC41E1D7E0200FAECE8 /* SUTouchBarButtonGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUTouchBarButtonGroup.m; sourceTree = ""; }; + E19CA4901E2E7E4D009D4D18 /* SUTouchBarForwardDeclarations.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUTouchBarForwardDeclarations.h; sourceTree = ""; }; F8761EB01ADC5068000C9034 /* SUCodeSigningVerifierTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUCodeSigningVerifierTest.m; sourceTree = ""; }; F8761EB21ADC50EB000C9034 /* SparkleTestCodeSignApp.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = SparkleTestCodeSignApp.zip; sourceTree = ""; }; FA1941CA0D94A70100DD942E /* ConfigFrameworkDebug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = ConfigFrameworkDebug.xcconfig; sourceTree = ""; }; @@ -1182,6 +1183,7 @@ 7205C4301E1215AD00E370AE /* SUUpdatePermissionResponse.m */, E1545EC31E1D7E0200FAECE8 /* SUTouchBarButtonGroup.h */, E1545EC41E1D7E0200FAECE8 /* SUTouchBarButtonGroup.m */, + E19CA4901E2E7E4D009D4D18 /* SUTouchBarForwardDeclarations.h */, ); name = "User Interface"; sourceTree = ""; diff --git a/Sparkle/SUAutomaticUpdateAlert.m b/Sparkle/SUAutomaticUpdateAlert.m index c5fc0ed9..25d751c6 100644 --- a/Sparkle/SUAutomaticUpdateAlert.m +++ b/Sparkle/SUAutomaticUpdateAlert.m @@ -11,6 +11,7 @@ #import "SUAppcastItem.h" #import "SUApplicationInfo.h" #import "SUHost.h" +#import "SUTouchBarForwardDeclarations.h" #import "SUTouchBarButtonGroup.h" static NSString *const SUAutomaticUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDENTIFIER ".SUAutomaticUpdateAlert"; @@ -109,7 +110,7 @@ static NSString *const SUAutomaticUpdateAlertTouchBarIndentifier = @"" SPARKLE_B - (NSTouchBar *)makeTouchBar { - NSTouchBar *touchBar = [[NSTouchBar alloc] init]; + NSTouchBar *touchBar = [[NSClassFromString(@"NSTouchBar") alloc] init]; touchBar.defaultItemIdentifiers = @[SUAutomaticUpdateAlertTouchBarIndentifier,]; touchBar.principalItemIdentifier = SUAutomaticUpdateAlertTouchBarIndentifier; touchBar.delegate = self; @@ -119,7 +120,7 @@ static NSString *const SUAutomaticUpdateAlertTouchBarIndentifier = @"" SPARKLE_B - (NSTouchBarItem *)touchBar:(NSTouchBar * __unused)touchBar makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier { if ([identifier isEqualToString:SUAutomaticUpdateAlertTouchBarIndentifier]) { - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSCustomTouchBarItem* item = [(NSCustomTouchBarItem *)[NSClassFromString(@"NSCustomTouchBarItem") alloc] initWithIdentifier:identifier]; item.viewController = [[SUTouchBarButtonGroup alloc] initByReferencingButtons:@[self.installButton, self.laterButton, self.skipButton]]; return item; } diff --git a/Sparkle/SUStatusController.m b/Sparkle/SUStatusController.m index f4f8bc04..efe383dd 100644 --- a/Sparkle/SUStatusController.m +++ b/Sparkle/SUStatusController.m @@ -11,6 +11,7 @@ #import "SUHost.h" #import "SULocalizations.h" #import "SUApplicationInfo.h" +#import "SUTouchBarForwardDeclarations.h" #import "SUTouchBarButtonGroup.h" static NSString *const SUStatusControllerTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDENTIFIER ".SUStatusController"; @@ -135,7 +136,7 @@ static NSString *const SUStatusControllerTouchBarIndentifier = @"" SPARKLE_BUNDL - (NSTouchBar *)makeTouchBar { - NSTouchBar *touchBar = [[NSTouchBar alloc] init]; + NSTouchBar *touchBar = [[NSClassFromString(@"NSTouchBar") alloc] init]; touchBar.defaultItemIdentifiers = @[ SUStatusControllerTouchBarIndentifier,]; touchBar.principalItemIdentifier = SUStatusControllerTouchBarIndentifier; touchBar.delegate = self; @@ -145,7 +146,7 @@ static NSString *const SUStatusControllerTouchBarIndentifier = @"" SPARKLE_BUNDL - (NSTouchBarItem *)touchBar:(NSTouchBar * __unused)touchBar makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier { if ([identifier isEqualToString:SUStatusControllerTouchBarIndentifier]) { - NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSCustomTouchBarItem *item = [(NSCustomTouchBarItem *)[NSClassFromString(@"NSCustomTouchBarItem") alloc] initWithIdentifier:identifier]; SUTouchBarButtonGroup *group = [[SUTouchBarButtonGroup alloc] initByReferencingButtons:@[self.actionButton,]]; item.viewController = group; self.touchBarButton = group.buttons.firstObject; diff --git a/Sparkle/SUTouchBarButtonGroup.h b/Sparkle/SUTouchBarButtonGroup.h index 55337b06..e86f9559 100644 --- a/Sparkle/SUTouchBarButtonGroup.h +++ b/Sparkle/SUTouchBarButtonGroup.h @@ -8,10 +8,6 @@ #import -@class NSTouchBar; -@class NSTouchBarItem; -@class NSCustomTouchBarItem; - NS_ASSUME_NONNULL_BEGIN @interface SUTouchBarButtonGroup : NSViewController diff --git a/Sparkle/SUTouchBarForwardDeclarations.h b/Sparkle/SUTouchBarForwardDeclarations.h new file mode 100644 index 00000000..bc228c2b --- /dev/null +++ b/Sparkle/SUTouchBarForwardDeclarations.h @@ -0,0 +1,91 @@ +// +// SUTouchBarForwardDeclarations.h +// Sparkle +// +// Created by Yuxin Wang on 18/01/2017. +// Copyright © 2017 Sparkle Project. All rights reserved. +// + +// Once Sparkle no longer supports OSX 10.12.0, this file can be deleted. + +#import + +#if !defined(MAC_OS_X_VERSION_10_12_1) + +NS_ASSUME_NONNULL_BEGIN + +@class NSTouchBar; +@class NSTouchBarItem; +@class NSCustomTouchBarItem; + +typedef NSString * NSTouchBarItemIdentifier NS_EXTENSIBLE_STRING_ENUM; +typedef NSString * NSTouchBarCustomizationIdentifier NS_EXTENSIBLE_STRING_ENUM; + +@protocol NSTouchBarDelegate; + +NS_CLASS_AVAILABLE_MAC(10_12_2) +@interface NSTouchBar : NSObject + +- (instancetype)init NS_DESIGNATED_INITIALIZER; +- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER; + +@property (copy, nullable) NSTouchBarCustomizationIdentifier customizationIdentifier; +@property (copy) NSArray *customizationAllowedItemIdentifiers; +@property (copy) NSArray *customizationRequiredItemIdentifiers; +@property (copy) NSArray *defaultItemIdentifiers; +@property (copy, readonly) NSArray *itemIdentifiers; +@property (copy, nullable) NSTouchBarItemIdentifier principalItemIdentifier; +@property (copy, nullable) NSTouchBarItemIdentifier escapeKeyReplacementItemIdentifier; +@property (copy) NSSet *templateItems; +@property (nullable, weak) id delegate; +- (nullable __kindof NSTouchBarItem *)itemForIdentifier:(NSTouchBarItemIdentifier)identifier; +@property (readonly, getter=isVisible) BOOL visible; + +@end + +@protocol NSTouchBarDelegate +@optional +- (nullable NSTouchBarItem*)touchBar:(NSTouchBar*)touchBar + makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier; +@end + +typedef float NSTouchBarItemPriority _NS_TYPED_EXTENSIBLE_ENUM; + +NS_CLASS_AVAILABLE_MAC(10_12_2) +@interface NSTouchBarItem : NSObject + +- (instancetype)initWithIdentifier:(NSTouchBarItemIdentifier)identifier NS_DESIGNATED_INITIALIZER; +- (nullable instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER; +- (instancetype)init NS_UNAVAILABLE; + +@property (readonly, copy) NSTouchBarItemIdentifier identifier; +@property NSTouchBarItemPriority visibilityPriority; +@property (readonly, nullable) NSView *view; +@property (readonly, nullable) NSViewController *viewController; +@property (readonly, copy) NSString *customizationLabel; +@property (readonly, getter=isVisible) BOOL visible; + +@end + +NS_CLASS_AVAILABLE_MAC(10_12_2) +@interface NSCustomTouchBarItem : NSTouchBarItem + +@property (readwrite, strong) __kindof NSView *view; +@property (readwrite, strong, nullable) __kindof NSViewController *viewController; +@property (readwrite, copy, null_resettable) NSString *customizationLabel; + +@end + +NS_ASSUME_NONNULL_END + +#elif MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12_1 + +// When compiling against the 10.12.1 SDK or later, just provide forward +// declarations to suppress the partial availability warnings. + +@class NSTouchBar; +@protocol NSTouchBarDelegate; +@class NSTouchBarItem; +@class NSCustomTouchBarItem; + +#endif // MAC_OS_X_VERSION_10_12_1 diff --git a/Sparkle/SUUpdateAlert.m b/Sparkle/SUUpdateAlert.m index 78a01647..0a674f4d 100644 --- a/Sparkle/SUUpdateAlert.m +++ b/Sparkle/SUUpdateAlert.m @@ -21,6 +21,7 @@ #import "SUAppcastItem.h" #import "SUApplicationInfo.h" #import "SUSystemUpdateInfo.h" +#import "SUTouchBarForwardDeclarations.h" #import "SUTouchBarButtonGroup.h" static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDENTIFIER ".SUUpdateAlert"; @@ -325,7 +326,7 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE - (NSTouchBar *)makeTouchBar { - NSTouchBar *touchBar = [[NSTouchBar alloc] init]; + NSTouchBar *touchBar = [[NSClassFromString(@"NSTouchBar") alloc] init]; touchBar.defaultItemIdentifiers = @[SUUpdateAlertTouchBarIndentifier,]; touchBar.principalItemIdentifier = SUUpdateAlertTouchBarIndentifier; touchBar.delegate = self; @@ -335,7 +336,7 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE - (NSTouchBarItem *)touchBar:(NSTouchBar * __unused)touchBar makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier { if ([identifier isEqualToString:SUUpdateAlertTouchBarIndentifier]) { - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSCustomTouchBarItem* item = [(NSCustomTouchBarItem *)[NSClassFromString(@"NSCustomTouchBarItem") alloc] initWithIdentifier:identifier]; item.viewController = [[SUTouchBarButtonGroup alloc] initByReferencingButtons:@[self.installButton, self.laterButton, self.skipButton]]; return item; } diff --git a/Sparkle/SUUpdatePermissionPrompt.m b/Sparkle/SUUpdatePermissionPrompt.m index 9f2802a6..7f1c0055 100644 --- a/Sparkle/SUUpdatePermissionPrompt.m +++ b/Sparkle/SUUpdatePermissionPrompt.m @@ -13,6 +13,7 @@ #import "SUConstants.h" #import "SULocalizations.h" #import "SUApplicationInfo.h" +#import "SUTouchBarForwardDeclarations.h" #import "SUTouchBarButtonGroup.h" static NSString *const SUUpdatePermissionPromptTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDENTIFIER ".SUUpdatePermissionPrompt"; @@ -169,7 +170,7 @@ static NSString *const SUUpdatePermissionPromptTouchBarIndentifier = @"" SPARKLE - (NSTouchBar *)makeTouchBar { - NSTouchBar *touchBar = [[NSTouchBar alloc] init]; + NSTouchBar *touchBar = [[NSClassFromString(@"NSTouchBar") alloc] init]; touchBar.defaultItemIdentifiers = @[SUUpdatePermissionPromptTouchBarIndentifier,]; touchBar.principalItemIdentifier = SUUpdatePermissionPromptTouchBarIndentifier; touchBar.delegate = self; @@ -179,7 +180,7 @@ static NSString *const SUUpdatePermissionPromptTouchBarIndentifier = @"" SPARKLE - (NSTouchBarItem *)touchBar:(NSTouchBar * __unused)touchBar makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier { if ([identifier isEqualToString:SUUpdatePermissionPromptTouchBarIndentifier]) { - NSCustomTouchBarItem* item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + NSCustomTouchBarItem* item = [(NSCustomTouchBarItem *)[NSClassFromString(@"NSCustomTouchBarItem") alloc] initWithIdentifier:identifier]; item.viewController = [[SUTouchBarButtonGroup alloc] initByReferencingButtons:@[self.checkButton, self.cancelButton]]; return item; } From d070bca0b0d70625b67c6a073aecfeedde8e5fa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kornel=20Lesin=CC=81ski?= Date: Tue, 17 Jan 2017 19:38:02 +0000 Subject: [PATCH 07/14] Sort project file --- Sparkle.xcodeproj/project.pbxproj | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index 160ce953..cf48657e 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -1175,15 +1175,15 @@ 6120721109CC5C4B007FE0F6 /* SUAutomaticUpdateAlert.m */, 6196CFE309C71ADE000DC222 /* SUStatusController.h */, 6196CFE409C71ADE000DC222 /* SUStatusController.m */, + E1545EC31E1D7E0200FAECE8 /* SUTouchBarButtonGroup.h */, + E1545EC41E1D7E0200FAECE8 /* SUTouchBarButtonGroup.m */, + E19CA4901E2E7E4D009D4D18 /* SUTouchBarForwardDeclarations.h */, 61B5FCA009C5228F00B25A18 /* SUUpdateAlert.h */, 61B5FCA109C5228F00B25A18 /* SUUpdateAlert.m */, 612DCBAD0D488BC60015DBEA /* SUUpdatePermissionPrompt.h */, 612DCBAE0D488BC60015DBEA /* SUUpdatePermissionPrompt.m */, 7205C42F1E1215AD00E370AE /* SUUpdatePermissionResponse.h */, 7205C4301E1215AD00E370AE /* SUUpdatePermissionResponse.m */, - E1545EC31E1D7E0200FAECE8 /* SUTouchBarButtonGroup.h */, - E1545EC41E1D7E0200FAECE8 /* SUTouchBarButtonGroup.m */, - E19CA4901E2E7E4D009D4D18 /* SUTouchBarForwardDeclarations.h */, ); name = "User Interface"; sourceTree = ""; @@ -1387,7 +1387,6 @@ 6102FE4A0E07803800F85D09 /* SUDiskImageUnarchiver.h in Headers */, 61299A2F09CA2DAB00B7442F /* SUDSAVerifier.h in Headers */, 55E6F33319EC9F6C00005E76 /* SUErrors.h in Headers */, - E1545EC51E1D7E0200FAECE8 /* SUTouchBarButtonGroup.h in Headers */, 14652F8419A978C200959E44 /* SUExport.h in Headers */, 7275F9C11B5F1F2900B1D19E /* SUFileManager.h in Headers */, 722954C41D04E66F00ECF9CA /* SUFileOperationConstants.h in Headers */, @@ -1406,6 +1405,7 @@ 6196CFF909C72148000DC222 /* SUStatusController.h in Headers */, 61A2279C0D1CEE7600430CCD /* SUSystemProfiler.h in Headers */, 72316BE31E0E1C7F0039EFD9 /* SUSystemUpdateInfo.h in Headers */, + E1545EC51E1D7E0200FAECE8 /* SUTouchBarButtonGroup.h in Headers */, 61B93A3C0DD02D7000DCD2F8 /* SUUIBasedUpdateDriver.h in Headers */, 61299A8D09CA790200B7442F /* SUUnarchiver.h in Headers */, 722589DA1E0B19F4005EA0B9 /* SUUnarchiverNotifier.h in Headers */, @@ -1880,7 +1880,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 72464F7D1E213ED400FB341C /* SUOperatingSystem.m in Sources */, 5AE13FA01E0D4F65000D2C2C /* Appcast.swift in Sources */, 5AAD00521E0BE6BE00AF411E /* ArchiveItem.swift in Sources */, 5AAD00681E0C2DAB00AF411E /* bscommon.c in Sources */, @@ -1899,6 +1898,7 @@ 5AE13FA21E0D716F000D2C2C /* SUFileManager.m in Sources */, 5AE13FA41E0D71D1000D2C2C /* SUFileOperationConstants.m in Sources */, 5AE13FB81E0D9F8E000D2C2C /* SULog.m in Sources */, + 72464F7D1E213ED400FB341C /* SUOperatingSystem.m in Sources */, 5AE13FB61E0D9F39000D2C2C /* SUPipedUnarchiver.m in Sources */, 5AE13FA61E0D7275000D2C2C /* SUStandardVersionComparator.m in Sources */, 5AE13FA11E0D7168000D2C2C /* SUUnarchiver.m in Sources */, From 2ccac610f63354c367a4f77c7b4cf195990037ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kornel=20Lesin=CC=81ski?= Date: Tue, 17 Jan 2017 20:38:22 +0000 Subject: [PATCH 08/14] Added declaration for Xcode 7 --- Sparkle/SUTouchBarForwardDeclarations.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Sparkle/SUTouchBarForwardDeclarations.h b/Sparkle/SUTouchBarForwardDeclarations.h index bc228c2b..49ac1d53 100644 --- a/Sparkle/SUTouchBarForwardDeclarations.h +++ b/Sparkle/SUTouchBarForwardDeclarations.h @@ -57,6 +57,7 @@ NS_CLASS_AVAILABLE_MAC(10_12_2) - (instancetype)initWithIdentifier:(NSTouchBarItemIdentifier)identifier NS_DESIGNATED_INITIALIZER; - (nullable instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER; - (instancetype)init NS_UNAVAILABLE; ++ (instancetype)buttonWithTitle:(NSString *)title target:(nullable id)target action:(nullable SEL)action NS_AVAILABLE_MAC(10_12); @property (readonly, copy) NSTouchBarItemIdentifier identifier; @property NSTouchBarItemPriority visibilityPriority; From 942d70d3aaa49af9bc8b5d50d0f782c2e08c710e Mon Sep 17 00:00:00 2001 From: Bi11 Date: Wed, 18 Jan 2017 04:53:37 +0800 Subject: [PATCH 09/14] Suppress partial availability warning on line level --- Sparkle.xcodeproj/project.pbxproj | 4 ++-- Sparkle/SUTouchBarButtonGroup.m | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index 0339c7e4..e2169bb3 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -264,8 +264,8 @@ A5BF4F1D1BC7668B007A052A /* SUTestWebServer.m in Sources */ = {isa = PBXBuildFile; fileRef = A5BF4F1C1BC7668B007A052A /* SUTestWebServer.m */; }; C23E885B1BE7B24F0050BB73 /* SparkleTestCodeSignApp.enc.dmg in Resources */ = {isa = PBXBuildFile; fileRef = C23E88591BE7AF890050BB73 /* SparkleTestCodeSignApp.enc.dmg */; }; E1545EC51E1D7E0200FAECE8 /* SUTouchBarButtonGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = E1545EC31E1D7E0200FAECE8 /* SUTouchBarButtonGroup.h */; }; - E1545EC61E1D7E0200FAECE8 /* SUTouchBarButtonGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = E1545EC41E1D7E0200FAECE8 /* SUTouchBarButtonGroup.m */; settings = {COMPILER_FLAGS = "-Wno-partial-availability"; }; }; - E1EC2A301E21667000245715 /* SUTouchBarButtonGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = E1545EC41E1D7E0200FAECE8 /* SUTouchBarButtonGroup.m */; settings = {COMPILER_FLAGS = "-Wno-partial-availability"; }; }; + E1545EC61E1D7E0200FAECE8 /* SUTouchBarButtonGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = E1545EC41E1D7E0200FAECE8 /* SUTouchBarButtonGroup.m */; }; + E1EC2A301E21667000245715 /* SUTouchBarButtonGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = E1545EC41E1D7E0200FAECE8 /* SUTouchBarButtonGroup.m */; }; F8761EB11ADC5068000C9034 /* SUCodeSigningVerifierTest.m in Sources */ = {isa = PBXBuildFile; fileRef = F8761EB01ADC5068000C9034 /* SUCodeSigningVerifierTest.m */; }; F8761EB31ADC50EB000C9034 /* SparkleTestCodeSignApp.zip in Resources */ = {isa = PBXBuildFile; fileRef = F8761EB21ADC50EB000C9034 /* SparkleTestCodeSignApp.zip */; }; F8761EB61ADC5E7A000C9034 /* SUCodeSigningVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B078CD15A5FB6100600039 /* SUCodeSigningVerifier.m */; }; diff --git a/Sparkle/SUTouchBarButtonGroup.m b/Sparkle/SUTouchBarButtonGroup.m index e8979fe9..d70e9c40 100644 --- a/Sparkle/SUTouchBarButtonGroup.m +++ b/Sparkle/SUTouchBarButtonGroup.m @@ -23,8 +23,11 @@ NSMutableArray *buttonCopies = [NSMutableArray arrayWithCapacity:buttons.count]; for (NSUInteger i = 0; i < buttons.count; i++) { - NSButton *button = buttons[i]; + NSButton *button = [buttons objectAtIndex:i]; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpartial-availability" NSButton *buttonCopy = [NSButton buttonWithTitle:button.title target:button.target action:button.action]; +#pragma clang diagnostic pop buttonCopy.tag = button.tag; buttonCopy.enabled = button.enabled; @@ -46,15 +49,18 @@ if (i == 0) { [constraints addObject:[NSLayoutConstraint constraintWithItem:buttonCopy attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:buttonGroup attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:0.0]]; } else { - [constraints addObject:[NSLayoutConstraint constraintWithItem:buttonCopy attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:buttonCopies[i - 1] attribute:NSLayoutAttributeLeading multiplier:1.0 constant:(i == 1) ? -8 : -32]]; - [constraints addObject:[NSLayoutConstraint constraintWithItem:buttonCopy attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:buttonCopies[i - 1] attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0.0]]; + [constraints addObject:[NSLayoutConstraint constraintWithItem:buttonCopy attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:[buttonCopies objectAtIndex:i - 1] attribute:NSLayoutAttributeLeading multiplier:1.0 constant:(i == 1) ? -8 : -32]]; + [constraints addObject:[NSLayoutConstraint constraintWithItem:buttonCopy attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:[buttonCopies objectAtIndex:i - 1] attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0.0]]; constraints.lastObject.priority = 250; } if (i == buttons.count - 1) { [constraints addObject:[NSLayoutConstraint constraintWithItem:buttonCopy attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:buttonGroup attribute:NSLayoutAttributeLeading multiplier:1.0 constant:0.0]]; } } +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpartial-availability" [NSLayoutConstraint activateConstraints:constraints]; +#pragma clang diagnostic pop _buttons = buttonCopies; return self; From db7f4acc83805f2f33960ac6fdc278124b816539 Mon Sep 17 00:00:00 2001 From: Bi11 Date: Wed, 18 Jan 2017 05:06:09 +0800 Subject: [PATCH 10/14] Add forward declaration for Xcode7 --- Sparkle/SUTouchBarButtonGroup.m | 6 ++++++ Sparkle/SUTouchBarForwardDeclarations.h | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Sparkle/SUTouchBarButtonGroup.m b/Sparkle/SUTouchBarButtonGroup.m index d70e9c40..ef27d131 100644 --- a/Sparkle/SUTouchBarButtonGroup.m +++ b/Sparkle/SUTouchBarButtonGroup.m @@ -8,6 +8,12 @@ #import "SUTouchBarButtonGroup.h" +#if __MAC_OS_X_VERSION_MAX_ALLOWED < 101200 +@interface NSButton (SierraSDK) ++ (instancetype)buttonWithTitle:(NSString*)title target:(id)target action:(SEL)action; +@end +#endif + @implementation SUTouchBarButtonGroup @synthesize buttons = _buttons; diff --git a/Sparkle/SUTouchBarForwardDeclarations.h b/Sparkle/SUTouchBarForwardDeclarations.h index 49ac1d53..bc228c2b 100644 --- a/Sparkle/SUTouchBarForwardDeclarations.h +++ b/Sparkle/SUTouchBarForwardDeclarations.h @@ -57,7 +57,6 @@ NS_CLASS_AVAILABLE_MAC(10_12_2) - (instancetype)initWithIdentifier:(NSTouchBarItemIdentifier)identifier NS_DESIGNATED_INITIALIZER; - (nullable instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER; - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)buttonWithTitle:(NSString *)title target:(nullable id)target action:(nullable SEL)action NS_AVAILABLE_MAC(10_12); @property (readonly, copy) NSTouchBarItemIdentifier identifier; @property NSTouchBarItemPriority visibilityPriority; From 548ae6e2b62b3043dbf11bcc49268f2cec394ea0 Mon Sep 17 00:00:00 2001 From: Bi11 Date: Wed, 18 Jan 2017 05:34:37 +0800 Subject: [PATCH 11/14] Change SDK checking macro to match existing code base --- Sparkle/SUTouchBarForwardDeclarations.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sparkle/SUTouchBarForwardDeclarations.h b/Sparkle/SUTouchBarForwardDeclarations.h index bc228c2b..2844ef03 100644 --- a/Sparkle/SUTouchBarForwardDeclarations.h +++ b/Sparkle/SUTouchBarForwardDeclarations.h @@ -10,7 +10,7 @@ #import -#if !defined(MAC_OS_X_VERSION_10_12_1) +#if __MAC_OS_X_VERSION_MAX_ALLOWED < 101201 NS_ASSUME_NONNULL_BEGIN @@ -78,7 +78,7 @@ NS_CLASS_AVAILABLE_MAC(10_12_2) NS_ASSUME_NONNULL_END -#elif MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12_1 +#else // When compiling against the 10.12.1 SDK or later, just provide forward // declarations to suppress the partial availability warnings. @@ -88,4 +88,4 @@ NS_ASSUME_NONNULL_END @class NSTouchBarItem; @class NSCustomTouchBarItem; -#endif // MAC_OS_X_VERSION_10_12_1 +#endif From 22f5d1f0f8ade8abd2d552379fdb3b1690809e65 Mon Sep 17 00:00:00 2001 From: Bi11 Date: Wed, 18 Jan 2017 15:45:00 +0800 Subject: [PATCH 12/14] Update button outlets for all xib --- Sparkle/ar.lproj/SUAutomaticUpdateAlert.xib | 2 ++ Sparkle/ar.lproj/SUUpdatePermissionPrompt.xib | 2 ++ Sparkle/cs.lproj/SUAutomaticUpdateAlert.xib | 2 ++ Sparkle/cs.lproj/SUUpdatePermissionPrompt.xib | 2 ++ Sparkle/da.lproj/SUAutomaticUpdateAlert.xib | 2 ++ Sparkle/da.lproj/SUUpdatePermissionPrompt.xib | 2 ++ Sparkle/de.lproj/SUAutomaticUpdateAlert.xib | 2 ++ Sparkle/de.lproj/SUUpdatePermissionPrompt.xib | 2 ++ Sparkle/el.lproj/SUAutomaticUpdateAlert.xib | 2 ++ Sparkle/el.lproj/SUUpdatePermissionPrompt.xib | 2 ++ Sparkle/es.lproj/SUAutomaticUpdateAlert.xib | 2 ++ Sparkle/es.lproj/SUUpdatePermissionPrompt.xib | 2 ++ Sparkle/fr.lproj/SUAutomaticUpdateAlert.xib | 2 ++ Sparkle/fr.lproj/SUUpdatePermissionPrompt.xib | 2 ++ Sparkle/is.lproj/SUAutomaticUpdateAlert.xib | 2 ++ Sparkle/is.lproj/SUUpdatePermissionPrompt.xib | 2 ++ Sparkle/it.lproj/SUAutomaticUpdateAlert.xib | 2 ++ Sparkle/it.lproj/SUUpdatePermissionPrompt.xib | 2 ++ Sparkle/ja.lproj/SUAutomaticUpdateAlert.xib | 2 ++ Sparkle/ja.lproj/SUUpdatePermissionPrompt.xib | 2 ++ Sparkle/ko.lproj/SUAutomaticUpdateAlert.xib | 2 ++ Sparkle/ko.lproj/SUUpdatePermissionPrompt.xib | 2 ++ Sparkle/nb.lproj/SUAutomaticUpdateAlert.xib | 2 ++ Sparkle/nb.lproj/SUUpdatePermissionPrompt.xib | 2 ++ Sparkle/nl.lproj/SUAutomaticUpdateAlert.xib | 2 ++ Sparkle/nl.lproj/SUUpdatePermissionPrompt.xib | 2 ++ Sparkle/pl.lproj/SUAutomaticUpdateAlert.xib | 2 ++ Sparkle/pl.lproj/SUUpdatePermissionPrompt.xib | 2 ++ Sparkle/pt_BR.lproj/SUAutomaticUpdateAlert.xib | 2 ++ Sparkle/pt_BR.lproj/SUUpdatePermissionPrompt.xib | 2 ++ Sparkle/pt_PT.lproj/SUAutomaticUpdateAlert.xib | 2 ++ Sparkle/pt_PT.lproj/SUUpdatePermissionPrompt.xib | 2 ++ Sparkle/ro.lproj/SUAutomaticUpdateAlert.xib | 2 ++ Sparkle/ro.lproj/SUUpdatePermissionPrompt.xib | 2 ++ Sparkle/ru.lproj/SUAutomaticUpdateAlert.xib | 2 ++ Sparkle/ru.lproj/SUUpdatePermissionPrompt.xib | 2 ++ Sparkle/sk.lproj/SUAutomaticUpdateAlert.xib | 2 ++ Sparkle/sk.lproj/SUUpdatePermissionPrompt.xib | 2 ++ Sparkle/sl.lproj/SUAutomaticUpdateAlert.xib | 2 ++ Sparkle/sl.lproj/SUUpdatePermissionPrompt.xib | 2 ++ Sparkle/sv.lproj/SUAutomaticUpdateAlert.xib | 2 ++ Sparkle/sv.lproj/SUUpdatePermissionPrompt.xib | 2 ++ Sparkle/th.lproj/SUAutomaticUpdateAlert.xib | 2 ++ Sparkle/th.lproj/SUUpdatePermissionPrompt.xib | 2 ++ Sparkle/tr.lproj/SUAutomaticUpdateAlert.xib | 2 ++ Sparkle/tr.lproj/SUUpdatePermissionPrompt.xib | 2 ++ Sparkle/uk.lproj/SUAutomaticUpdateAlert.xib | 2 ++ Sparkle/uk.lproj/SUUpdatePermissionPrompt.xib | 2 ++ Sparkle/zh_CN.lproj/SUAutomaticUpdateAlert.xib | 2 ++ Sparkle/zh_CN.lproj/SUUpdatePermissionPrompt.xib | 2 ++ Sparkle/zh_TW.lproj/SUAutomaticUpdateAlert.xib | 2 ++ Sparkle/zh_TW.lproj/SUUpdatePermissionPrompt.xib | 2 ++ 52 files changed, 104 insertions(+) diff --git a/Sparkle/ar.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/ar.lproj/SUAutomaticUpdateAlert.xib index 7085a7d9..b327da59 100644 --- a/Sparkle/ar.lproj/SUAutomaticUpdateAlert.xib +++ b/Sparkle/ar.lproj/SUAutomaticUpdateAlert.xib @@ -6,6 +6,8 @@ + + diff --git a/Sparkle/ar.lproj/SUUpdatePermissionPrompt.xib b/Sparkle/ar.lproj/SUUpdatePermissionPrompt.xib index 2f0b6447..947f5e53 100644 --- a/Sparkle/ar.lproj/SUUpdatePermissionPrompt.xib +++ b/Sparkle/ar.lproj/SUUpdatePermissionPrompt.xib @@ -6,6 +6,8 @@ + + diff --git a/Sparkle/cs.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/cs.lproj/SUAutomaticUpdateAlert.xib index 92144753..a4cbdc32 100644 --- a/Sparkle/cs.lproj/SUAutomaticUpdateAlert.xib +++ b/Sparkle/cs.lproj/SUAutomaticUpdateAlert.xib @@ -6,6 +6,8 @@ + + diff --git a/Sparkle/cs.lproj/SUUpdatePermissionPrompt.xib b/Sparkle/cs.lproj/SUUpdatePermissionPrompt.xib index 1d5b985f..14dfbd7f 100644 --- a/Sparkle/cs.lproj/SUUpdatePermissionPrompt.xib +++ b/Sparkle/cs.lproj/SUUpdatePermissionPrompt.xib @@ -6,6 +6,8 @@ + + diff --git a/Sparkle/da.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/da.lproj/SUAutomaticUpdateAlert.xib index cd4e5232..5f1912cd 100644 --- a/Sparkle/da.lproj/SUAutomaticUpdateAlert.xib +++ b/Sparkle/da.lproj/SUAutomaticUpdateAlert.xib @@ -6,6 +6,8 @@ + + diff --git a/Sparkle/da.lproj/SUUpdatePermissionPrompt.xib b/Sparkle/da.lproj/SUUpdatePermissionPrompt.xib index 91ceadc3..d993fddc 100644 --- a/Sparkle/da.lproj/SUUpdatePermissionPrompt.xib +++ b/Sparkle/da.lproj/SUUpdatePermissionPrompt.xib @@ -6,6 +6,8 @@ + + diff --git a/Sparkle/de.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/de.lproj/SUAutomaticUpdateAlert.xib index 42880e77..53f2e062 100644 --- a/Sparkle/de.lproj/SUAutomaticUpdateAlert.xib +++ b/Sparkle/de.lproj/SUAutomaticUpdateAlert.xib @@ -6,6 +6,8 @@ + + diff --git a/Sparkle/de.lproj/SUUpdatePermissionPrompt.xib b/Sparkle/de.lproj/SUUpdatePermissionPrompt.xib index 4a94522d..af334262 100644 --- a/Sparkle/de.lproj/SUUpdatePermissionPrompt.xib +++ b/Sparkle/de.lproj/SUUpdatePermissionPrompt.xib @@ -7,6 +7,8 @@ + + diff --git a/Sparkle/el.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/el.lproj/SUAutomaticUpdateAlert.xib index fb2e0e75..c18f3d2a 100644 --- a/Sparkle/el.lproj/SUAutomaticUpdateAlert.xib +++ b/Sparkle/el.lproj/SUAutomaticUpdateAlert.xib @@ -6,6 +6,8 @@ + + diff --git a/Sparkle/el.lproj/SUUpdatePermissionPrompt.xib b/Sparkle/el.lproj/SUUpdatePermissionPrompt.xib index 74bb2009..5cb92b2c 100644 --- a/Sparkle/el.lproj/SUUpdatePermissionPrompt.xib +++ b/Sparkle/el.lproj/SUUpdatePermissionPrompt.xib @@ -7,6 +7,8 @@ + + diff --git a/Sparkle/es.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/es.lproj/SUAutomaticUpdateAlert.xib index 5fe13502..c8fc6a38 100644 --- a/Sparkle/es.lproj/SUAutomaticUpdateAlert.xib +++ b/Sparkle/es.lproj/SUAutomaticUpdateAlert.xib @@ -6,6 +6,8 @@ + + diff --git a/Sparkle/es.lproj/SUUpdatePermissionPrompt.xib b/Sparkle/es.lproj/SUUpdatePermissionPrompt.xib index ea302622..19541050 100644 --- a/Sparkle/es.lproj/SUUpdatePermissionPrompt.xib +++ b/Sparkle/es.lproj/SUUpdatePermissionPrompt.xib @@ -7,6 +7,8 @@ + + diff --git a/Sparkle/fr.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/fr.lproj/SUAutomaticUpdateAlert.xib index 86fd8bac..a5eadb15 100644 --- a/Sparkle/fr.lproj/SUAutomaticUpdateAlert.xib +++ b/Sparkle/fr.lproj/SUAutomaticUpdateAlert.xib @@ -6,6 +6,8 @@ + + diff --git a/Sparkle/fr.lproj/SUUpdatePermissionPrompt.xib b/Sparkle/fr.lproj/SUUpdatePermissionPrompt.xib index 5659f719..5b36e7f7 100644 --- a/Sparkle/fr.lproj/SUUpdatePermissionPrompt.xib +++ b/Sparkle/fr.lproj/SUUpdatePermissionPrompt.xib @@ -7,6 +7,8 @@ + + diff --git a/Sparkle/is.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/is.lproj/SUAutomaticUpdateAlert.xib index bcc84d01..867d7a18 100644 --- a/Sparkle/is.lproj/SUAutomaticUpdateAlert.xib +++ b/Sparkle/is.lproj/SUAutomaticUpdateAlert.xib @@ -6,6 +6,8 @@ + + diff --git a/Sparkle/is.lproj/SUUpdatePermissionPrompt.xib b/Sparkle/is.lproj/SUUpdatePermissionPrompt.xib index bf1646fe..2cac96f9 100644 --- a/Sparkle/is.lproj/SUUpdatePermissionPrompt.xib +++ b/Sparkle/is.lproj/SUUpdatePermissionPrompt.xib @@ -7,6 +7,8 @@ + + diff --git a/Sparkle/it.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/it.lproj/SUAutomaticUpdateAlert.xib index 6d9a160d..7c2233c5 100644 --- a/Sparkle/it.lproj/SUAutomaticUpdateAlert.xib +++ b/Sparkle/it.lproj/SUAutomaticUpdateAlert.xib @@ -6,6 +6,8 @@ + + diff --git a/Sparkle/it.lproj/SUUpdatePermissionPrompt.xib b/Sparkle/it.lproj/SUUpdatePermissionPrompt.xib index f8953d19..6f415046 100644 --- a/Sparkle/it.lproj/SUUpdatePermissionPrompt.xib +++ b/Sparkle/it.lproj/SUUpdatePermissionPrompt.xib @@ -7,6 +7,8 @@ + + diff --git a/Sparkle/ja.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/ja.lproj/SUAutomaticUpdateAlert.xib index db759968..d5ea8ef9 100644 --- a/Sparkle/ja.lproj/SUAutomaticUpdateAlert.xib +++ b/Sparkle/ja.lproj/SUAutomaticUpdateAlert.xib @@ -6,6 +6,8 @@ + + diff --git a/Sparkle/ja.lproj/SUUpdatePermissionPrompt.xib b/Sparkle/ja.lproj/SUUpdatePermissionPrompt.xib index f057bc28..4d61ba46 100644 --- a/Sparkle/ja.lproj/SUUpdatePermissionPrompt.xib +++ b/Sparkle/ja.lproj/SUUpdatePermissionPrompt.xib @@ -7,6 +7,8 @@ + + diff --git a/Sparkle/ko.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/ko.lproj/SUAutomaticUpdateAlert.xib index bab45f5b..3c4806d2 100644 --- a/Sparkle/ko.lproj/SUAutomaticUpdateAlert.xib +++ b/Sparkle/ko.lproj/SUAutomaticUpdateAlert.xib @@ -6,6 +6,8 @@ + + diff --git a/Sparkle/ko.lproj/SUUpdatePermissionPrompt.xib b/Sparkle/ko.lproj/SUUpdatePermissionPrompt.xib index b690af1b..1fcf7bcf 100644 --- a/Sparkle/ko.lproj/SUUpdatePermissionPrompt.xib +++ b/Sparkle/ko.lproj/SUUpdatePermissionPrompt.xib @@ -7,6 +7,8 @@ + + diff --git a/Sparkle/nb.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/nb.lproj/SUAutomaticUpdateAlert.xib index feb3dd08..b7b462cc 100644 --- a/Sparkle/nb.lproj/SUAutomaticUpdateAlert.xib +++ b/Sparkle/nb.lproj/SUAutomaticUpdateAlert.xib @@ -6,6 +6,8 @@ + + diff --git a/Sparkle/nb.lproj/SUUpdatePermissionPrompt.xib b/Sparkle/nb.lproj/SUUpdatePermissionPrompt.xib index 3521671b..f5388287 100644 --- a/Sparkle/nb.lproj/SUUpdatePermissionPrompt.xib +++ b/Sparkle/nb.lproj/SUUpdatePermissionPrompt.xib @@ -7,6 +7,8 @@ + + diff --git a/Sparkle/nl.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/nl.lproj/SUAutomaticUpdateAlert.xib index 281e6bd3..cf75d6d6 100644 --- a/Sparkle/nl.lproj/SUAutomaticUpdateAlert.xib +++ b/Sparkle/nl.lproj/SUAutomaticUpdateAlert.xib @@ -6,6 +6,8 @@ + + diff --git a/Sparkle/nl.lproj/SUUpdatePermissionPrompt.xib b/Sparkle/nl.lproj/SUUpdatePermissionPrompt.xib index fd3e7136..2fd575ba 100644 --- a/Sparkle/nl.lproj/SUUpdatePermissionPrompt.xib +++ b/Sparkle/nl.lproj/SUUpdatePermissionPrompt.xib @@ -7,6 +7,8 @@ + + diff --git a/Sparkle/pl.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/pl.lproj/SUAutomaticUpdateAlert.xib index aa20f8be..f2ea1090 100644 --- a/Sparkle/pl.lproj/SUAutomaticUpdateAlert.xib +++ b/Sparkle/pl.lproj/SUAutomaticUpdateAlert.xib @@ -6,6 +6,8 @@ + + diff --git a/Sparkle/pl.lproj/SUUpdatePermissionPrompt.xib b/Sparkle/pl.lproj/SUUpdatePermissionPrompt.xib index 2577d660..9f738325 100644 --- a/Sparkle/pl.lproj/SUUpdatePermissionPrompt.xib +++ b/Sparkle/pl.lproj/SUUpdatePermissionPrompt.xib @@ -7,6 +7,8 @@ + + diff --git a/Sparkle/pt_BR.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/pt_BR.lproj/SUAutomaticUpdateAlert.xib index eb78882e..af4be781 100644 --- a/Sparkle/pt_BR.lproj/SUAutomaticUpdateAlert.xib +++ b/Sparkle/pt_BR.lproj/SUAutomaticUpdateAlert.xib @@ -6,6 +6,8 @@ + + diff --git a/Sparkle/pt_BR.lproj/SUUpdatePermissionPrompt.xib b/Sparkle/pt_BR.lproj/SUUpdatePermissionPrompt.xib index 1d7d8f7d..175a511a 100644 --- a/Sparkle/pt_BR.lproj/SUUpdatePermissionPrompt.xib +++ b/Sparkle/pt_BR.lproj/SUUpdatePermissionPrompt.xib @@ -7,6 +7,8 @@ + + diff --git a/Sparkle/pt_PT.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/pt_PT.lproj/SUAutomaticUpdateAlert.xib index 1104f59c..8a318518 100644 --- a/Sparkle/pt_PT.lproj/SUAutomaticUpdateAlert.xib +++ b/Sparkle/pt_PT.lproj/SUAutomaticUpdateAlert.xib @@ -6,6 +6,8 @@ + + diff --git a/Sparkle/pt_PT.lproj/SUUpdatePermissionPrompt.xib b/Sparkle/pt_PT.lproj/SUUpdatePermissionPrompt.xib index 8fb42ec3..9811749d 100644 --- a/Sparkle/pt_PT.lproj/SUUpdatePermissionPrompt.xib +++ b/Sparkle/pt_PT.lproj/SUUpdatePermissionPrompt.xib @@ -7,6 +7,8 @@ + + diff --git a/Sparkle/ro.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/ro.lproj/SUAutomaticUpdateAlert.xib index 62f56ea0..0a4edc1f 100644 --- a/Sparkle/ro.lproj/SUAutomaticUpdateAlert.xib +++ b/Sparkle/ro.lproj/SUAutomaticUpdateAlert.xib @@ -6,6 +6,8 @@ + + diff --git a/Sparkle/ro.lproj/SUUpdatePermissionPrompt.xib b/Sparkle/ro.lproj/SUUpdatePermissionPrompt.xib index b5d7a693..00c4548b 100644 --- a/Sparkle/ro.lproj/SUUpdatePermissionPrompt.xib +++ b/Sparkle/ro.lproj/SUUpdatePermissionPrompt.xib @@ -7,6 +7,8 @@ + + diff --git a/Sparkle/ru.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/ru.lproj/SUAutomaticUpdateAlert.xib index 3de9bde8..9785187f 100644 --- a/Sparkle/ru.lproj/SUAutomaticUpdateAlert.xib +++ b/Sparkle/ru.lproj/SUAutomaticUpdateAlert.xib @@ -6,6 +6,8 @@ + + diff --git a/Sparkle/ru.lproj/SUUpdatePermissionPrompt.xib b/Sparkle/ru.lproj/SUUpdatePermissionPrompt.xib index 68e12bb6..ac66563b 100644 --- a/Sparkle/ru.lproj/SUUpdatePermissionPrompt.xib +++ b/Sparkle/ru.lproj/SUUpdatePermissionPrompt.xib @@ -7,6 +7,8 @@ + + diff --git a/Sparkle/sk.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/sk.lproj/SUAutomaticUpdateAlert.xib index 651178ef..e6ca87d1 100644 --- a/Sparkle/sk.lproj/SUAutomaticUpdateAlert.xib +++ b/Sparkle/sk.lproj/SUAutomaticUpdateAlert.xib @@ -6,6 +6,8 @@ + + diff --git a/Sparkle/sk.lproj/SUUpdatePermissionPrompt.xib b/Sparkle/sk.lproj/SUUpdatePermissionPrompt.xib index 7d43c3ab..97363879 100644 --- a/Sparkle/sk.lproj/SUUpdatePermissionPrompt.xib +++ b/Sparkle/sk.lproj/SUUpdatePermissionPrompt.xib @@ -7,6 +7,8 @@ + + diff --git a/Sparkle/sl.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/sl.lproj/SUAutomaticUpdateAlert.xib index 9c953b8a..513e9300 100644 --- a/Sparkle/sl.lproj/SUAutomaticUpdateAlert.xib +++ b/Sparkle/sl.lproj/SUAutomaticUpdateAlert.xib @@ -6,6 +6,8 @@ + + diff --git a/Sparkle/sl.lproj/SUUpdatePermissionPrompt.xib b/Sparkle/sl.lproj/SUUpdatePermissionPrompt.xib index 76cc3498..27602e21 100644 --- a/Sparkle/sl.lproj/SUUpdatePermissionPrompt.xib +++ b/Sparkle/sl.lproj/SUUpdatePermissionPrompt.xib @@ -7,6 +7,8 @@ + + diff --git a/Sparkle/sv.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/sv.lproj/SUAutomaticUpdateAlert.xib index da5b6fca..e3347629 100644 --- a/Sparkle/sv.lproj/SUAutomaticUpdateAlert.xib +++ b/Sparkle/sv.lproj/SUAutomaticUpdateAlert.xib @@ -6,6 +6,8 @@ + + diff --git a/Sparkle/sv.lproj/SUUpdatePermissionPrompt.xib b/Sparkle/sv.lproj/SUUpdatePermissionPrompt.xib index c284bbbf..c66273f7 100644 --- a/Sparkle/sv.lproj/SUUpdatePermissionPrompt.xib +++ b/Sparkle/sv.lproj/SUUpdatePermissionPrompt.xib @@ -7,6 +7,8 @@ + + diff --git a/Sparkle/th.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/th.lproj/SUAutomaticUpdateAlert.xib index 99247426..65cf51d2 100644 --- a/Sparkle/th.lproj/SUAutomaticUpdateAlert.xib +++ b/Sparkle/th.lproj/SUAutomaticUpdateAlert.xib @@ -6,6 +6,8 @@ + + diff --git a/Sparkle/th.lproj/SUUpdatePermissionPrompt.xib b/Sparkle/th.lproj/SUUpdatePermissionPrompt.xib index 28b147cd..2149d2b5 100644 --- a/Sparkle/th.lproj/SUUpdatePermissionPrompt.xib +++ b/Sparkle/th.lproj/SUUpdatePermissionPrompt.xib @@ -7,6 +7,8 @@ + + diff --git a/Sparkle/tr.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/tr.lproj/SUAutomaticUpdateAlert.xib index ba829acd..a9bd6e13 100644 --- a/Sparkle/tr.lproj/SUAutomaticUpdateAlert.xib +++ b/Sparkle/tr.lproj/SUAutomaticUpdateAlert.xib @@ -6,6 +6,8 @@ + + diff --git a/Sparkle/tr.lproj/SUUpdatePermissionPrompt.xib b/Sparkle/tr.lproj/SUUpdatePermissionPrompt.xib index a3521403..70bfba71 100644 --- a/Sparkle/tr.lproj/SUUpdatePermissionPrompt.xib +++ b/Sparkle/tr.lproj/SUUpdatePermissionPrompt.xib @@ -7,6 +7,8 @@ + + diff --git a/Sparkle/uk.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/uk.lproj/SUAutomaticUpdateAlert.xib index 5acdf402..f4201daa 100644 --- a/Sparkle/uk.lproj/SUAutomaticUpdateAlert.xib +++ b/Sparkle/uk.lproj/SUAutomaticUpdateAlert.xib @@ -6,6 +6,8 @@ + + diff --git a/Sparkle/uk.lproj/SUUpdatePermissionPrompt.xib b/Sparkle/uk.lproj/SUUpdatePermissionPrompt.xib index a2da1864..a1811e4f 100644 --- a/Sparkle/uk.lproj/SUUpdatePermissionPrompt.xib +++ b/Sparkle/uk.lproj/SUUpdatePermissionPrompt.xib @@ -7,6 +7,8 @@ + + diff --git a/Sparkle/zh_CN.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/zh_CN.lproj/SUAutomaticUpdateAlert.xib index 91297175..ad2caf5f 100644 --- a/Sparkle/zh_CN.lproj/SUAutomaticUpdateAlert.xib +++ b/Sparkle/zh_CN.lproj/SUAutomaticUpdateAlert.xib @@ -6,6 +6,8 @@ + + diff --git a/Sparkle/zh_CN.lproj/SUUpdatePermissionPrompt.xib b/Sparkle/zh_CN.lproj/SUUpdatePermissionPrompt.xib index 6d82e121..ba1b4ab0 100644 --- a/Sparkle/zh_CN.lproj/SUUpdatePermissionPrompt.xib +++ b/Sparkle/zh_CN.lproj/SUUpdatePermissionPrompt.xib @@ -7,6 +7,8 @@ + + diff --git a/Sparkle/zh_TW.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/zh_TW.lproj/SUAutomaticUpdateAlert.xib index 737c95b6..ba6f56d8 100644 --- a/Sparkle/zh_TW.lproj/SUAutomaticUpdateAlert.xib +++ b/Sparkle/zh_TW.lproj/SUAutomaticUpdateAlert.xib @@ -6,6 +6,8 @@ + + diff --git a/Sparkle/zh_TW.lproj/SUUpdatePermissionPrompt.xib b/Sparkle/zh_TW.lproj/SUUpdatePermissionPrompt.xib index e821625b..92d677db 100644 --- a/Sparkle/zh_TW.lproj/SUUpdatePermissionPrompt.xib +++ b/Sparkle/zh_TW.lproj/SUUpdatePermissionPrompt.xib @@ -7,6 +7,8 @@ + + From 7e7c97a09f4bd9f23665964ec5a9c6db195810d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kornel=20Lesin=CC=81ski?= Date: Wed, 18 Jan 2017 19:01:45 +0000 Subject: [PATCH 13/14] Use app-independent subsystem identifier --- Sparkle/SULog.m | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Sparkle/SULog.m b/Sparkle/SULog.m index 7b8125d6..b4969ba1 100644 --- a/Sparkle/SULog.m +++ b/Sparkle/SULog.m @@ -31,11 +31,8 @@ void SULog(SULogLevel level, NSString *format, ...) hasOSLogging = [SUOperatingSystem isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){10, 12, 0}]; - NSString *mainBundleIdentifier = mainBundle.bundleIdentifier; - NSString *bundleIdentifier = (mainBundleIdentifier != nil) ? mainBundleIdentifier : @""SPARKLE_BUNDLE_IDENTIFIER; - if (hasOSLogging) { - const char *subsystem = [[bundleIdentifier stringByAppendingString:@".Sparkle"] UTF8String]; + const char *subsystem = SPARKLE_BUNDLE_IDENTIFIER; #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpartial-availability" // This creates a thread-safe object From c104c1b27ebebbc6cbd5933a9e913bb4e7812710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kornel=20Lesin=CC=81ski?= Date: Wed, 18 Jan 2017 22:31:03 +0000 Subject: [PATCH 14/14] Fix facility identifier --- Sparkle/SULog.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sparkle/SULog.m b/Sparkle/SULog.m index b4969ba1..1e816b75 100644 --- a/Sparkle/SULog.m +++ b/Sparkle/SULog.m @@ -43,12 +43,12 @@ void SULog(SULogLevel level, NSString *format, ...) // Act the same way os_log() does; don't log to stderr if a terminal device is attached if (!isatty(STDERR_FILENO)) { options |= ASL_OPT_STDERR; - } + } NSString *displayName = [[NSFileManager defaultManager] displayNameAtPath:mainBundle.bundlePath]; - client = asl_open([displayName stringByAppendingString:@" [Sparkle]"].UTF8String, bundleIdentifier.UTF8String, options); + client = asl_open([displayName stringByAppendingString:@" [Sparkle]"].UTF8String, SPARKLE_BUNDLE_IDENTIFIER, options); queue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); -} + } }); if (!hasOSLogging && client == NULL) {