From eaa607b48dc63d705f21ca3bbdc0c24ab86c1e15 Mon Sep 17 00:00:00 2001 From: Alexandre Wilhelm Date: Mon, 21 Apr 2014 15:34:12 -0700 Subject: [PATCH 1/7] New: Added option in xCodeCapp for displaying error in notification Previously it wasn't possible to configure xCodeCapp to show or not errors/warnings and capp_lint with notifications --- Tools/XcodeCapp/XcodeCapp/AppController.m | 4 + .../XcodeCapp/ProcessSourceOperation.m | 5 +- Tools/XcodeCapp/XcodeCapp/UserDefaults.h | 4 + Tools/XcodeCapp/XcodeCapp/UserDefaults.m | 4 + Tools/XcodeCapp/XcodeCapp/XcodeCapp.h | 3 + Tools/XcodeCapp/XcodeCapp/XcodeCapp.m | 45 +- .../XcodeCapp/XcodeCapp/en.lproj/MainMenu.xib | 456 ++++++++++++++++-- 7 files changed, 470 insertions(+), 51 deletions(-) diff --git a/Tools/XcodeCapp/XcodeCapp/AppController.m b/Tools/XcodeCapp/XcodeCapp/AppController.m index ab6fcd38c..09d1363b8 100644 --- a/Tools/XcodeCapp/XcodeCapp/AppController.m +++ b/Tools/XcodeCapp/XcodeCapp/AppController.m @@ -146,6 +146,10 @@ AppController *SharedAppControllerInstance = nil; kDefaultXCCReopenLastProject: @YES, kDefaultXCCAutoOpenErrorsPanelOnWarnings: @YES, kDefaultXCCAutoOpenErrorsPanelOnErrors: @YES, + kDefaultXCCAutoOpenErrorsPanelOnCappLint: @YES, + kDefaultXCCAutoShowNotificationOnWarnings: @YES, + kDefaultXCCAutoShowNotificationOnErrors: @YES, + kDefaultXCCAutoShowNotificationOnCappLint: @NO, kDefaultXCCProjectHistory: [NSArray new], kDefaultMaxRecentProjects: @20, kDefaultLogLevel: [NSNumber numberWithInt:LOG_LEVEL_WARN], diff --git a/Tools/XcodeCapp/XcodeCapp/ProcessSourceOperation.m b/Tools/XcodeCapp/XcodeCapp/ProcessSourceOperation.m index e40530853..efafddd00 100644 --- a/Tools/XcodeCapp/XcodeCapp/ProcessSourceOperation.m +++ b/Tools/XcodeCapp/XcodeCapp/ProcessSourceOperation.m @@ -152,8 +152,9 @@ [self postErrorNotificationForPath:self.sourcePath line:0 message:response status:status]; } } - - [self notifyUserWithTitle:notificationTitle message:notificationMessage]; + + if ((status == XCCStatusCodeError && [self.xcc shouldShowErrorNotification]) || (status != XCCStatusCodeError && [self.xcc shouldShowWarningNotification])) + [self notifyUserWithTitle:notificationTitle message:notificationMessage]; } else if (!self.xcc.isLoadingProject) { diff --git a/Tools/XcodeCapp/XcodeCapp/UserDefaults.h b/Tools/XcodeCapp/XcodeCapp/UserDefaults.h index be194584b..37d846f4f 100644 --- a/Tools/XcodeCapp/XcodeCapp/UserDefaults.h +++ b/Tools/XcodeCapp/XcodeCapp/UserDefaults.h @@ -19,6 +19,10 @@ extern NSString * const kDefaultXCCReactToInodeMod; extern NSString * const kDefaultXCCReopenLastProject; extern NSString * const kDefaultXCCAutoOpenErrorsPanelOnWarnings; extern NSString * const kDefaultXCCAutoOpenErrorsPanelOnErrors; +extern NSString * const kDefaultXCCAutoOpenErrorsPanelOnCappLint; +extern NSString * const kDefaultXCCAutoShowNotificationOnWarnings; +extern NSString * const kDefaultXCCAutoShowNotificationOnErrors; +extern NSString * const kDefaultXCCAutoShowNotificationOnCappLint; extern NSString * const kDefaultXCCProjectHistory; extern NSString * const kDefaultLastOpenedPath; extern NSString * const kDefaultPathModificationDates; diff --git a/Tools/XcodeCapp/XcodeCapp/UserDefaults.m b/Tools/XcodeCapp/XcodeCapp/UserDefaults.m index 2be6fcf22..9672c667a 100644 --- a/Tools/XcodeCapp/XcodeCapp/UserDefaults.m +++ b/Tools/XcodeCapp/XcodeCapp/UserDefaults.m @@ -17,6 +17,10 @@ NSString * const kDefaultXCCReactToInodeMod = @"XCCReactMode"; NSString * const kDefaultXCCReopenLastProject = @"XCCReopenLastProject"; NSString * const kDefaultXCCAutoOpenErrorsPanelOnWarnings = @"XCCAutoOpenErrorsPanelOnWarnings"; NSString * const kDefaultXCCAutoOpenErrorsPanelOnErrors = @"XCCAutoOpenErrorsPanelOnErrors"; +NSString * const kDefaultXCCAutoOpenErrorsPanelOnCappLint = @"XCCAutoOpenErrorsPanelOnCappLint"; +NSString * const kDefaultXCCAutoShowNotificationOnWarnings = @"XCCAutoShowNotificationOnWarnings"; +NSString * const kDefaultXCCAutoShowNotificationOnErrors = @"XCCAutoOpenShowNotificationErrors"; +NSString * const kDefaultXCCAutoShowNotificationOnCappLint = @"XCCAutoShowNotificationOnCappLint"; NSString * const kDefaultXCCProjectHistory = @"XCCProjectHistory"; NSString * const kDefaultLastOpenedPath = @"LastOpenedPath"; NSString * const kDefaultPathModificationDates = @"pathModificationDates"; diff --git a/Tools/XcodeCapp/XcodeCapp/XcodeCapp.h b/Tools/XcodeCapp/XcodeCapp/XcodeCapp.h index a7b2039aa..b75187df6 100644 --- a/Tools/XcodeCapp/XcodeCapp/XcodeCapp.h +++ b/Tools/XcodeCapp/XcodeCapp/XcodeCapp.h @@ -132,6 +132,9 @@ extern NSString * const XCCProjectDidFinishLoadingNotification; - (BOOL)isXibFile:(NSString *)path; - (BOOL)isXCCIgnoreFile:(NSString *)path; +- (BOOL)shouldShowWarningNotification; +- (BOOL)shouldShowErrorNotification; + - (NSString *)shadowBasePathForProjectSourcePath:(NSString *)path; - (BOOL)hasErrors; diff --git a/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m b/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m index 3263b1f47..8cab4fae6 100644 --- a/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m +++ b/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m @@ -1641,6 +1641,16 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, [self runTaskWithLaunchPath:executablePath arguments:args returnType:kTaskReturnTypeNone]; } +- (BOOL)shouldShowWarningNotification +{ + return [[NSUserDefaults standardUserDefaults] boolForKey:kDefaultXCCAutoShowNotificationOnWarnings]; +} + +- (BOOL)shouldShowErrorNotification +{ + return [[NSUserDefaults standardUserDefaults] boolForKey:kDefaultXCCAutoShowNotificationOnErrors]; +} + - (void)showErrors { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; @@ -1652,6 +1662,32 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, } } +- (void)showCappLintErrors +{ + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + + if ([defaults boolForKey:kDefaultXCCAutoOpenErrorsPanelOnCappLint] && self.errorList.count) + [self openErrorsPanel:self]; + + if ([defaults boolForKey:kDefaultXCCAutoShowNotificationOnCappLint]) + { + NSUInteger numberError = [self.errorList count]; + int i = 0; + + for (i = 0; i < numberError; i++) + { + NSDictionary *error = [self.errorList objectAtIndex:i]; + NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys: + [NSNumber numberWithInteger:self.projectId] , @"projectId", + @"Capp_lint error", @"title", + [error objectForKey:@"message"] , @"message", + nil]; + + [self wantUserNotificationWithInfo:dict]; + } + } +} + - (void)pruneProcessingErrorsForProjectPath:(NSString *)path { // Remove all errors for the path being processed @@ -1749,11 +1785,11 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, returnType:kTaskReturnTypeStdOut]; NSInteger status = [taskResult[@"status"] intValue]; - NSString *response = taskResult[@"response"]; if (status == 0) return; + NSString *response = taskResult[@"response"]; NSMutableArray *errors = [NSMutableArray arrayWithArray:[response componentsSeparatedByString:@"\n\n"]]; // We need to remove the first object who is the number of errors and the last object who is an empty line @@ -1780,16 +1816,19 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, NSInteger positionOfSecondColon = [errorWithoutPath rangeOfString:@":"].location; line = [errorWithoutPath substringToIndex:positionOfSecondColon]; + NSString *messageError = [NSString stringWithFormat:@"capp_lint error in %@ \n%@", path, errorWithoutPath]; + NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:[line intValue]], @"line", - [NSString stringWithFormat:@"capp_lint error in %@ \n%@", path, errorWithoutPath], @"message", + messageError , @"message", path, @"path", nil]; [self.errorListController addObject:dict]; } - [self showErrors]; + + [self showCappLintErrors]; self.isProcessing = NO; [[NSNotificationCenter defaultCenter] postNotificationName:XCCBatchDidEndNotification object:self]; diff --git a/Tools/XcodeCapp/XcodeCapp/en.lproj/MainMenu.xib b/Tools/XcodeCapp/XcodeCapp/en.lproj/MainMenu.xib index d5d832d90..ffd71b0e2 100644 --- a/Tools/XcodeCapp/XcodeCapp/en.lproj/MainMenu.xib +++ b/Tools/XcodeCapp/XcodeCapp/en.lproj/MainMenu.xib @@ -333,7 +333,7 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA - {{0, 0}, {2560, 1418}} + {{0, 0}, {1440, 878}} {10000000000000, 10000000000000} NO @@ -497,15 +497,15 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA -2080374784 134217728 Clear - + .LucidaGrandeUI 12 - 4883 + 787 -2038284288 164 - + 400 @@ -526,11 +526,11 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA -1543503872 134217728 Open - + -2038284288 164 - + 400 @@ -551,11 +551,11 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA -2080374784 134217728 Close - + -2038284288 164 - + 400 @@ -569,7 +569,7 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA - {{0, 0}, {2560, 1418}} + {{1440, -180}, {1920, 1058}} {315, 99} {10000000000000, 10000000000000} errorPanel @@ -578,7 +578,7 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA 3 2 - {{1964, 505}, {431, 348}} + {{1964, 505}, {487, 401}} 1618478080 Preferences NSWindow @@ -778,13 +778,13 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA NO - {{1, 1}, {395, 139}} + {{1, 1}, {451, 139}} - {{17, 178}, {397, 155}} + {{17, 231}, {453, 155}} @@ -821,7 +821,7 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA 268 - {{16, 100}, {363, 18}} + {{16, 153}, {363, 18}} @@ -846,7 +846,7 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA 268 - {{16, 72}, {363, 18}} + {{16, 125}, {363, 18}} @@ -871,7 +871,7 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA 268 - {{35, 17}, {81, 18}} + {{28, 72}, {81, 18}} @@ -896,10 +896,10 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA 268 - {{137, 17}, {60, 18}} + {{130, 72}, {60, 18}} - + YES -2080374784 @@ -918,10 +918,35 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA NO + + + 268 + {{215, 72}, {82, 18}} + + + + YES + + -2080374784 + 0 + Capp_lint + + + 1211912448 + 2 + + + + + 400 + 75 + + NO + 268 - {{16, 43}, {306, 17}} + {{16, 96}, {381, 17}} @@ -929,7 +954,7 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA 68157504 272630784 - Automatically open Errors & Warnings panel on: + Automatically open Errors & Warnings & Capp_lint panel on: @@ -938,14 +963,109 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA NO 1 + + + 268 + {{28, 17}, {81, 18}} + + + + YES + + -2080374784 + 0 + Warnings + + + 1211912448 + 2 + + + + + 400 + 75 + + NO + + + + 268 + {{130, 17}, {60, 18}} + + + + YES + + -2080374784 + 0 + Errors + + + 1211912448 + 2 + + + + + 400 + 75 + + NO + + + + 268 + {{215, 17}, {82, 18}} + + + + YES + + -2080374784 + 0 + Capp_lint + + + 1211912448 + 2 + + + + + 400 + 75 + + NO + + + + 268 + {{16, 41}, {419, 17}} + + + + YES + + 68157504 + 272630784 + Automatically show Errors & Warnings & Capp_lint notification on: + + + + + + NO + 1 + - {{1, 1}, {395, 131}} + {{1, 1}, {451, 184}} - {{17, 16}, {397, 147}} + {{17, 16}, {453, 200}} @@ -968,12 +1088,12 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA NO - {431, 348} + {487, 401} - {{0, 0}, {2560, 1418}} + {{1440, -180}, {1920, 1058}} {10000000000000, 10000000000000} xcc-prefs YES @@ -1014,7 +1134,7 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA - {{0, 0}, {2560, 1418}} + {{0, 0}, {1440, 878}} {10000000000000, 10000000000000} YES @@ -1271,6 +1391,38 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA 821 + + + save: + + + + XTE-kN-O4x + + + + save: + + + + tWg-qA-1Jq + + + + save: + + + + 6Xe-Bt-eXK + + + + save: + + + + Buu-6t-pce + openXcodeProject: @@ -1717,6 +1869,26 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA aRN-Fd-MPN + + + value: values.XCCAutoOpenErrorsPanelOnCappLint + + + + + + value: values.XCCAutoOpenErrorsPanelOnCappLint + value + values.XCCAutoOpenErrorsPanelOnCappLint + + NSValidatesImmediately + + + 2 + + + du5-hg-MfC + projectPath.length @@ -1733,6 +1905,26 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA b84-dT-kSk + + + value: values.XCCAutoShowNotificationOnCappLint + + + + + + value: values.XCCAutoShowNotificationOnCappLint + value + values.XCCAutoShowNotificationOnCappLint + + NSValidatesImmediately + + + 2 + + + uwx-aq-p86 + values.usesCappLintForEveryNotifications @@ -1753,6 +1945,46 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA JL3-wG-7ik + + + value: values.XCCAutoShowNotificationOnWarnings + + + + + + value: values.XCCAutoShowNotificationOnWarnings + value + values.XCCAutoShowNotificationOnWarnings + + NSValidatesImmediately + + + 2 + + + IHN-Iv-1G1 + + + + value: values.XCCAutoShowNotificationOnErrors + + + + + + value: values.XCCAutoShowNotificationOnErrors + value + values.XCCAutoShowNotificationOnErrors + + NSValidatesImmediately + + + 2 + + + 2Es-cp-MhX + @@ -2156,9 +2388,14 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA + + - + + + + @@ -2227,27 +2464,6 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA - - 543 - - - - - - - - 553 - - - - - - - - 857 - - - 544 @@ -2286,6 +2502,92 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA + + 543 + + + + + + + + 553 + + + + + + + + 857 + + + + + 2M5-3o-Zwl + + + + + + + + sZm-jR-Tet + + + + + btf-8H-I6o + + + + + + + + iiD-Nj-M6o + + + + + + + + QAd-SJ-XIV + + + + + + + + cP1-yQ-cDc + + + + + + + + PzR-WX-kJx + + + + + ptR-WM-qet + + + + + BYW-Rk-rZ4 + + + + + Jft-21-b4j + + + @@ -2301,6 +2603,18 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA com.apple.InterfaceBuilder.CocoaPlugin + + ToolTip + + ToolTip + + When an error or warning occurs, automatically open the Errors & Warnings panel + + + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -2521,8 +2835,26 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + ToolTip + + ToolTip + + When an error or warning occurs, automatically open the Errors & Warnings panel + + + + com.apple.InterfaceBuilder.CocoaPlugin + + ToolTip @@ -2537,8 +2869,40 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA com.apple.InterfaceBuilder.CocoaPlugin + + ToolTip + + ToolTip + + When an error or warning occurs, automatically open the Errors & Warnings panel + + + + com.apple.InterfaceBuilder.CocoaPlugin + + + + com.apple.InterfaceBuilder.CocoaPlugin + + + + ToolTip + + ToolTip + + When an error or warning occurs, automatically open the Errors & Warnings panel + + + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + From 14cb6d21a94d9a87dca96e4219af0ac898d7afba Mon Sep 17 00:00:00 2001 From: Antoine Mercadal Date: Mon, 21 Apr 2014 16:59:06 -0700 Subject: [PATCH 2/7] FIXED: XCC Preferences Coherency This patch fixes various UX weirdness with preferences and makes everything aligned. --- Tools/XcodeCapp/XcodeCapp/AppController.m | 6 +- .../XcodeCapp/ProcessSourceOperation.m | 17 +- Tools/XcodeCapp/XcodeCapp/UserDefaults.h | 4 - Tools/XcodeCapp/XcodeCapp/UserDefaults.m | 4 - Tools/XcodeCapp/XcodeCapp/XcodeCapp.h | 5 +- Tools/XcodeCapp/XcodeCapp/XcodeCapp.m | 46 +- .../XcodeCapp/XcodeCapp/en.lproj/MainMenu.xib | 882 +++++------------- 7 files changed, 259 insertions(+), 705 deletions(-) diff --git a/Tools/XcodeCapp/XcodeCapp/AppController.m b/Tools/XcodeCapp/XcodeCapp/AppController.m index 09d1363b8..055c0029e 100644 --- a/Tools/XcodeCapp/XcodeCapp/AppController.m +++ b/Tools/XcodeCapp/XcodeCapp/AppController.m @@ -144,19 +144,15 @@ AppController *SharedAppControllerInstance = nil; kDefaultXCCAPIMode: [NSNumber numberWithInt:kXCCAPIModeAuto], kDefaultXCCReactToInodeMod: @YES, kDefaultXCCReopenLastProject: @YES, - kDefaultXCCAutoOpenErrorsPanelOnWarnings: @YES, kDefaultXCCAutoOpenErrorsPanelOnErrors: @YES, kDefaultXCCAutoOpenErrorsPanelOnCappLint: @YES, - kDefaultXCCAutoShowNotificationOnWarnings: @YES, kDefaultXCCAutoShowNotificationOnErrors: @YES, kDefaultXCCAutoShowNotificationOnCappLint: @NO, kDefaultXCCProjectHistory: [NSArray new], kDefaultMaxRecentProjects: @20, kDefaultLogLevel: [NSNumber numberWithInt:LOG_LEVEL_WARN], kDefaultAutoOpenXcodeProject: @YES, - kDefaultShowProcessingNotices: @YES, - kDefaultUseSymlinkWhenCreatingProject: @YES, - KDefaultUsesCappLintForEveryNotifications: @NO + kDefaultUseSymlinkWhenCreatingProject: @YES }; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; diff --git a/Tools/XcodeCapp/XcodeCapp/ProcessSourceOperation.m b/Tools/XcodeCapp/XcodeCapp/ProcessSourceOperation.m index efafddd00..e4dafc0d8 100644 --- a/Tools/XcodeCapp/XcodeCapp/ProcessSourceOperation.m +++ b/Tools/XcodeCapp/XcodeCapp/ProcessSourceOperation.m @@ -153,12 +153,23 @@ } } - if ((status == XCCStatusCodeError && [self.xcc shouldShowErrorNotification]) || (status != XCCStatusCodeError && [self.xcc shouldShowWarningNotification])) + if ([self.xcc shouldShowErrorNotification]) [self notifyUserWithTitle:notificationTitle message:notificationMessage]; } else if (!self.xcc.isLoadingProject) { - [self notifyUserWithTitle:notificationTitle message:notificationMessage]; + BOOL showFinalNotification = YES; + + if ([self.xcc shouldProcessWithCappLint]) + { + showFinalNotification = [self.xcc checkCappLintForPath:self.sourcePath]; + + if (!showFinalNotification) + [self.xcc showCappLintErrors]; + } + + if (showFinalNotification) + [self notifyUserWithTitle:notificationTitle message:notificationMessage]; } } @@ -179,7 +190,7 @@ nil]; info[@"projectId"] = self.projectId; - info[@"message"] = [NSString stringWithFormat:@"%@, line %d\n%@", [self.sourcePath lastPathComponent], 0, message]; + info[@"message"] = [NSString stringWithFormat:@"Compilation issue: %@, line %d\n%@", [self.sourcePath lastPathComponent], 0, message]; if (self.isCancelled) return; diff --git a/Tools/XcodeCapp/XcodeCapp/UserDefaults.h b/Tools/XcodeCapp/XcodeCapp/UserDefaults.h index 37d846f4f..11f71d303 100644 --- a/Tools/XcodeCapp/XcodeCapp/UserDefaults.h +++ b/Tools/XcodeCapp/XcodeCapp/UserDefaults.h @@ -17,10 +17,8 @@ extern NSString * const kDefaultFirstLaunchVersion; extern NSString * const kDefaultXCCAPIMode; extern NSString * const kDefaultXCCReactToInodeMod; extern NSString * const kDefaultXCCReopenLastProject; -extern NSString * const kDefaultXCCAutoOpenErrorsPanelOnWarnings; extern NSString * const kDefaultXCCAutoOpenErrorsPanelOnErrors; extern NSString * const kDefaultXCCAutoOpenErrorsPanelOnCappLint; -extern NSString * const kDefaultXCCAutoShowNotificationOnWarnings; extern NSString * const kDefaultXCCAutoShowNotificationOnErrors; extern NSString * const kDefaultXCCAutoShowNotificationOnCappLint; extern NSString * const kDefaultXCCProjectHistory; @@ -29,8 +27,6 @@ extern NSString * const kDefaultPathModificationDates; extern NSString * const kDefaultMaxRecentProjects; extern NSString * const kDefaultLogLevel; extern NSString * const kDefaultAutoOpenXcodeProject; -extern NSString * const kDefaultShowProcessingNotices; extern NSString * const kDefaultUseSymlinkWhenCreatingProject; -extern NSString * const KDefaultUsesCappLintForEveryNotifications; #endif diff --git a/Tools/XcodeCapp/XcodeCapp/UserDefaults.m b/Tools/XcodeCapp/XcodeCapp/UserDefaults.m index 9672c667a..6a388b8ae 100644 --- a/Tools/XcodeCapp/XcodeCapp/UserDefaults.m +++ b/Tools/XcodeCapp/XcodeCapp/UserDefaults.m @@ -15,10 +15,8 @@ NSString * const kDefaultFirstLaunchVersion = @"firstLaunchVersion"; NSString * const kDefaultXCCAPIMode = @"XCCAPIMode"; NSString * const kDefaultXCCReactToInodeMod = @"XCCReactMode"; NSString * const kDefaultXCCReopenLastProject = @"XCCReopenLastProject"; -NSString * const kDefaultXCCAutoOpenErrorsPanelOnWarnings = @"XCCAutoOpenErrorsPanelOnWarnings"; NSString * const kDefaultXCCAutoOpenErrorsPanelOnErrors = @"XCCAutoOpenErrorsPanelOnErrors"; NSString * const kDefaultXCCAutoOpenErrorsPanelOnCappLint = @"XCCAutoOpenErrorsPanelOnCappLint"; -NSString * const kDefaultXCCAutoShowNotificationOnWarnings = @"XCCAutoShowNotificationOnWarnings"; NSString * const kDefaultXCCAutoShowNotificationOnErrors = @"XCCAutoOpenShowNotificationErrors"; NSString * const kDefaultXCCAutoShowNotificationOnCappLint = @"XCCAutoShowNotificationOnCappLint"; NSString * const kDefaultXCCProjectHistory = @"XCCProjectHistory"; @@ -27,6 +25,4 @@ NSString * const kDefaultPathModificationDates = @"pathModificationDates"; NSString * const kDefaultMaxRecentProjects = @"maxRecentProjects"; NSString * const kDefaultLogLevel = @"logLevel"; NSString * const kDefaultAutoOpenXcodeProject = @"autoOpenXcodeProject"; -NSString * const kDefaultShowProcessingNotices = @"showProcessingNotices"; NSString * const kDefaultUseSymlinkWhenCreatingProject = @"useSymlinkWhenCreatingProject"; -NSString * const KDefaultUsesCappLintForEveryNotifications = @"usesCappLintForEveryNotifications"; diff --git a/Tools/XcodeCapp/XcodeCapp/XcodeCapp.h b/Tools/XcodeCapp/XcodeCapp/XcodeCapp.h index b75187df6..018a4b1bc 100644 --- a/Tools/XcodeCapp/XcodeCapp/XcodeCapp.h +++ b/Tools/XcodeCapp/XcodeCapp/XcodeCapp.h @@ -132,7 +132,6 @@ extern NSString * const XCCProjectDidFinishLoadingNotification; - (BOOL)isXibFile:(NSString *)path; - (BOOL)isXCCIgnoreFile:(NSString *)path; -- (BOOL)shouldShowWarningNotification; - (BOOL)shouldShowErrorNotification; - (NSString *)shadowBasePathForProjectSourcePath:(NSString *)path; @@ -146,6 +145,10 @@ extern NSString * const XCCProjectDidFinishLoadingNotification; - (NSDictionary*)createProject:(NSString*)aPath; +- (BOOL)shouldProcessWithCappLint; +- (BOOL)checkCappLintForPath:(NSString*)aPath; +- (void)showCappLintErrors; + @end @interface XcodeCapp (SnowLeopard) diff --git a/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m b/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m index 8cab4fae6..735db4924 100644 --- a/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m +++ b/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m @@ -730,11 +730,6 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, } } - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - - if ([defaults boolForKey:KDefaultUsesCappLintForEveryNotifications]) - [self checkCappLintForPath:path]; - DDLogVerbose(@"%@ %@", NSStringFromSelector(_cmd), path); } @@ -1641,22 +1636,24 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, [self runTaskWithLaunchPath:executablePath arguments:args returnType:kTaskReturnTypeNone]; } -- (BOOL)shouldShowWarningNotification -{ - return [[NSUserDefaults standardUserDefaults] boolForKey:kDefaultXCCAutoShowNotificationOnWarnings]; -} - - (BOOL)shouldShowErrorNotification { return [[NSUserDefaults standardUserDefaults] boolForKey:kDefaultXCCAutoShowNotificationOnErrors]; } +- (BOOL)shouldProcessWithCappLint +{ + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + + return [defaults boolForKey:kDefaultXCCAutoOpenErrorsPanelOnCappLint] + || [defaults boolForKey:kDefaultXCCAutoShowNotificationOnCappLint]; +} + - (void)showErrors { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - if (([defaults boolForKey:kDefaultXCCAutoOpenErrorsPanelOnErrors] && self.hasErrors) || - ([defaults boolForKey:kDefaultXCCAutoOpenErrorsPanelOnWarnings] && self.errorList.count)) + if ([defaults boolForKey:kDefaultXCCAutoOpenErrorsPanelOnErrors] && self.errorList.count) { [self openErrorsPanel:self]; } @@ -1672,15 +1669,16 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, if ([defaults boolForKey:kDefaultXCCAutoShowNotificationOnCappLint]) { NSUInteger numberError = [self.errorList count]; - int i = 0; - for (i = 0; i < numberError; i++) + if (numberError) { - NSDictionary *error = [self.errorList objectAtIndex:i]; + NSDictionary *error = [self.errorList objectAtIndex:0]; + NSString *filename = [error objectForKey:@"path"]; + NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInteger:self.projectId] , @"projectId", - @"Capp_lint error", @"title", - [error objectForKey:@"message"] , @"message", + @"Code Style Issues", @"title", + filename.lastPathComponent , @"message", nil]; [self wantUserNotificationWithInfo:dict]; @@ -1754,8 +1752,7 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, if ([info[@"projectId"] intValue] != self.projectId) return; - if ([[NSUserDefaults standardUserDefaults] boolForKey:kDefaultShowProcessingNotices]) - [self notifyUserWithTitle:info[@"title"] message:info[@"message"]]; + [self notifyUserWithTitle:info[@"title"] message:info[@"message"]]; } - (BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentNotification:(NSUserNotification *)notification @@ -1770,7 +1767,7 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, [self performSelectorInBackground:@selector(checkCappLintForPath:) withObject:self.projectPath]; } -- (void)checkCappLintForPath:(NSString*)aPath +- (BOOL)checkCappLintForPath:(NSString*)aPath { DDLogVerbose(@"Checking path %@ with capp_lint", aPath); @@ -1787,7 +1784,7 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, NSInteger status = [taskResult[@"status"] intValue]; if (status == 0) - return; + return YES; NSString *response = taskResult[@"response"]; NSMutableArray *errors = [NSMutableArray arrayWithArray:[response componentsSeparatedByString:@"\n\n"]]; @@ -1816,7 +1813,7 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, NSInteger positionOfSecondColon = [errorWithoutPath rangeOfString:@":"].location; line = [errorWithoutPath substringToIndex:positionOfSecondColon]; - NSString *messageError = [NSString stringWithFormat:@"capp_lint error in %@ \n%@", path, errorWithoutPath]; + NSString *messageError = [NSString stringWithFormat:@"Code style issue: %@ \n%@", path.lastPathComponent, errorWithoutPath]; NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:[line intValue]], @"line", @@ -1827,11 +1824,10 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, [self.errorListController addObject:dict]; } - - [self showCappLintErrors]; - self.isProcessing = NO; [[NSNotificationCenter defaultCenter] postNotificationName:XCCBatchDidEndNotification object:self]; + + return NO; } @end diff --git a/Tools/XcodeCapp/XcodeCapp/en.lproj/MainMenu.xib b/Tools/XcodeCapp/XcodeCapp/en.lproj/MainMenu.xib index ffd71b0e2..6a0ad009d 100644 --- a/Tools/XcodeCapp/XcodeCapp/en.lproj/MainMenu.xib +++ b/Tools/XcodeCapp/XcodeCapp/en.lproj/MainMenu.xib @@ -2,10 +2,10 @@ 1060 - 13C64 + 13D43 5056 - 1265.19 - 697.40 + 1265.20 + 698.00 5056 5056 @@ -106,6 +106,14 @@ + + + Verify Project Code Style + + 2147483647 + + + Synchronize Project @@ -140,14 +148,6 @@ - - - Check project with capp_lint - - 2147483647 - - - YES @@ -216,7 +216,7 @@ - + 256 @@ -224,8 +224,6 @@ 268 {{164, 20}, {203, 98}} - - YES 68157504 @@ -261,7 +259,6 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA 266 {{164, 126}, {221, 74}} - YES @@ -309,7 +306,6 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA {{17, 63}, {128, 128}} - YES @@ -329,8 +325,6 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA {402, 202} - - {{0, 0}, {1440, 878}} @@ -342,13 +336,13 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA 2 {{1826, 825}, {550, 237}} 1618478080 - Errors & Warnings + Reporting NSPanel {315, 77} - + 256 @@ -364,7 +358,6 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA 256 {550, 201} - YES NO @@ -441,7 +434,6 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA {{1, 1}, {550, 201}} - @@ -452,7 +444,6 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA -2147483392 {{1, 273}, {512, 16}} - NO 1 @@ -464,7 +455,6 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA -2147483392 {{535, 1}, {16, 45}} - NO @@ -473,7 +463,6 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA {{-1, 35}, {552, 203}} - 133682 @@ -489,7 +478,6 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA 289 {{352, 8}, {85, 19}} - {250, 750} YES @@ -518,7 +506,6 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA 292 {{20, 8}, {85, 19}} - {250, 750} YES @@ -543,8 +530,6 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA 289 {{445, 8}, {85, 19}} - - {250, 750} YES @@ -565,11 +550,9 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA {550, 237} - - - {{1440, -180}, {1920, 1058}} + {{0, 0}, {1440, 878}} {315, 99} {10000000000000, 10000000000000} errorPanel @@ -578,14 +561,14 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA 3 2 - {{1964, 505}, {487, 401}} + {{1964, 505}, {393, 357}} 1618478080 Preferences NSWindow - + 256 @@ -601,7 +584,6 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA 268 {{16, 81}, {271, 18}} - YES @@ -635,7 +617,6 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA 268 {{16, 51}, {241, 18}} - YES @@ -660,7 +641,6 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA 268 {{16, 109}, {298, 18}} - YES @@ -685,7 +665,6 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA 268 {{15, 20}, {106, 17}} - YES @@ -705,7 +684,6 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA 268 {{124, 14}, {56, 26}} - YES @@ -778,15 +756,13 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA NO - {{1, 1}, {451, 139}} + {{1, 1}, {357, 139}} - - {{17, 231}, {453, 155}} + {{17, 187}, {359, 155}} - {0, 0} @@ -818,93 +794,17 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA 274 - - - 268 - {{16, 153}, {363, 18}} - - - - YES - - -2080374784 - 0 - Show notifications when individual files are processed - - - 1211912448 - 2 - - - - - 400 - 75 - - NO - - - - 268 - {{16, 125}, {363, 18}} - - - - YES - - -2080374784 - 0 - Check with capp_lint when files are processed - - - 1211912448 - 2 - - - - - 400 - 75 - - NO - - - - 268 - {{28, 72}, {81, 18}} - - - - YES - - -2080374784 - 0 - Warnings - - - 1211912448 - 2 - - - - - 400 - 75 - - NO - 268 - {{130, 72}, {60, 18}} + {{146, 12}, {171, 18}} - - + YES -2080374784 0 - Errors + Open reporting window 1211912448 @@ -918,43 +818,17 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA NO - - - 268 - {{215, 72}, {82, 18}} - - - - YES - - -2080374784 - 0 - Capp_lint - - - 1211912448 - 2 - - - - - 400 - 75 - - NO - 268 - {{16, 96}, {381, 17}} + {{16, 39}, {126, 17}} - - + YES 68157504 272630784 - Automatically open Errors & Warnings & Capp_lint panel on: + Compilation issues: @@ -963,43 +837,17 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA NO 1 - - - 268 - {{28, 17}, {81, 18}} - - - - YES - - -2080374784 - 0 - Warnings - - - 1211912448 - 2 - - - - - 400 - 75 - - NO - 268 - {{130, 17}, {60, 18}} + {{146, 38}, {171, 18}} - - + YES -2080374784 0 - Errors + Show notification 1211912448 @@ -1013,61 +861,14 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA NO - - - 268 - {{215, 17}, {82, 18}} - - - - YES - - -2080374784 - 0 - Capp_lint - - - 1211912448 - 2 - - - - - 400 - 75 - - NO - - - - 268 - {{16, 41}, {419, 17}} - - - - YES - - 68157504 - 272630784 - Automatically show Errors & Warnings & Capp_lint notification on: - - - - - - NO - 1 - - {{1, 1}, {451, 184}} + {{1, 1}, {357, 66}} - - + - {{17, 16}, {453, 200}} + {{17, 101}, {359, 82}} - {0, 0} @@ -1087,13 +888,114 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA 2 NO + + + 12 + + + + 274 + + + + 268 + {{146, 12}, {171, 18}} + + YES + + -2080374784 + 0 + Open reporting window + + + 1211912448 + 2 + + + + + 400 + 75 + + NO + + + + 268 + {{146, 37}, {171, 18}} + + + YES + + -2080374784 + 0 + Show notification + + + 1211912448 + 2 + + + + + 400 + 75 + + NO + + + + 268 + {{16, 38}, {126, 17}} + + + YES + + 68157504 + 272630784 + Code style issues: + + + + + + NO + 1 + + + {{1, 1}, {357, 65}} + + + _NS:11 + + + {{17, 16}, {359, 81}} + + + _NS:9 + {0, 0} + + 67108864 + 0 + Code style + + + + 3 + MCAwLjgwMDAwMDAxMTkAA + + + + 1 + 0 + 2 + NO + - {487, 401} - - + {393, 357} - {{1440, -180}, {1920, 1058}} + {{0, 0}, {1440, 878}} {10000000000000, 10000000000000} xcc-prefs YES @@ -1108,7 +1010,7 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA - + 256 @@ -1120,7 +1022,6 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA {{0, 8}, {716, 654}} - YES 1 @@ -1130,8 +1031,6 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA {716, 662} - - {{0, 0}, {1440, 878}} @@ -1359,30 +1258,6 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA 849 - - - save: - - - - 854 - - - - save: - - - - 3Np-aC-Jh1 - - - - save: - - - - 792 - save: @@ -1391,6 +1266,14 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA 821 + + + save: + + + + Buu-6t-pce + save: @@ -1399,14 +1282,6 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA XTE-kN-O4x - - - save: - - - - tWg-qA-1Jq - save: @@ -1415,14 +1290,6 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA 6Xe-Bt-eXK - - - save: - - - - Buu-6t-pce - openXcodeProject: @@ -1689,26 +1556,6 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA 762 - - - values.XCCAutoOpenErrorsPanelOnWarnings - - - - - - value: values.XCCAutoOpenErrorsPanelOnWarnings - value - values.XCCAutoOpenErrorsPanelOnWarnings - - NSValidatesImmediately - - - 2 - - - 823 - values.maxRecentProjects @@ -1781,26 +1628,6 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA 851 - - - values.showProcessingNotices - - - - - - value: values.showProcessingNotices - value - values.showProcessingNotices - - NSValidatesImmediately - - - 2 - - - 856 - projectPath.length @@ -1889,6 +1716,22 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA du5-hg-MfC + + + enabled: values.usesCappLintForEveryNotifications + + + + + + enabled: values.usesCappLintForEveryNotifications + enabled + values.usesCappLintForEveryNotifications + 2 + + + J8w-G4-Pzy + projectPath.length @@ -1927,55 +1770,31 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA - values.usesCappLintForEveryNotifications - + enabled: values.usesCappLintForEveryNotifications + - + - value: values.usesCappLintForEveryNotifications - value + enabled: values.usesCappLintForEveryNotifications + enabled values.usesCappLintForEveryNotifications - - NSValidatesImmediately - - 2 - JL3-wG-7ik + 5nL-79-ZXW - value: values.XCCAutoShowNotificationOnWarnings - - - - - - value: values.XCCAutoShowNotificationOnWarnings - value - values.XCCAutoShowNotificationOnWarnings - - NSValidatesImmediately - - - 2 - - - IHN-Iv-1G1 - - - - value: values.XCCAutoShowNotificationOnErrors + value: values.XCCAutoOpenShowNotificationErrors - value: values.XCCAutoShowNotificationOnErrors + value: values.XCCAutoOpenShowNotificationErrors value - values.XCCAutoShowNotificationOnErrors + values.XCCAutoOpenShowNotificationErrors NSValidatesImmediately @@ -1983,7 +1802,7 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA 2 - 2Es-cp-MhX + j0c-o6-KBW @@ -2030,12 +1849,12 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA - + @@ -2274,6 +2093,7 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA + @@ -2386,58 +2206,12 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA 848 - - - - - - - - - 843 - - - - - - - - 844 - - - - - RPS-9d-lvV - - - - - - - - TXI-VH-VwH - - - - - 789 - - - - - - - - 790 - - - 819 @@ -2523,27 +2297,6 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA - - 2M5-3o-Zwl - - - - - - - - sZm-jR-Tet - - - - - btf-8H-I6o - - - - - - iiD-Nj-M6o @@ -2552,26 +2305,41 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA + + BYW-Rk-rZ4 + + + + + qFm-3c-NH7 + + + + + + + + + + 2M5-3o-Zwl + + + + + + + + sZm-jR-Tet + + + QAd-SJ-XIV - - - - cP1-yQ-cDc - - - - - - - - PzR-WX-kJx - - + ptR-WM-qet @@ -2579,14 +2347,17 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA - BYW-Rk-rZ4 - - + cwr-C6-dkY + + + + + - Jft-21-b4j - - + dTw-kK-6IJ + + @@ -2732,20 +2503,6 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA com.apple.InterfaceBuilder.CocoaPlugin - - ToolTip - - ToolTip - - When an error or warning occurs, automatically open the Errors & Warnings panel - - - - com.apple.InterfaceBuilder.CocoaPlugin - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin @@ -2808,20 +2565,6 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA com.apple.InterfaceBuilder.CocoaPlugin - - ToolTip - - ToolTip - - If this is checked, when a Cappuccino project is opened, the project’s Xcode support project will be opened automatically - - - - com.apple.InterfaceBuilder.CocoaPlugin - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin @@ -2837,12 +2580,8 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - ToolTip @@ -2855,36 +2594,12 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA com.apple.InterfaceBuilder.CocoaPlugin - - ToolTip - - ToolTip - - If this is checked, when a Cappuccino project is opened, the file who is currently processing will be checked with capp_lint - - - - com.apple.InterfaceBuilder.CocoaPlugin - - - com.apple.InterfaceBuilder.CocoaPlugin - - - ToolTip - - ToolTip - - When an error or warning occurs, automatically open the Errors & Warnings panel - - - - com.apple.InterfaceBuilder.CocoaPlugin - - - - com.apple.InterfaceBuilder.CocoaPlugin - - + + com.apple.InterfaceBuilder.CocoaPlugin + + + com.apple.InterfaceBuilder.CocoaPlugin + ToolTip @@ -2901,6 +2616,7 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -2909,167 +2625,7 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA - - - - AppController - NSObject - - id - id - id - id - id - id - - - - createProject: - id - - - loadProject: - id - - - openAbout: - id - - - openHelp: - id - - - openPreferences: - id - - - showInFinder: - id - - - - NSPanel - PDFView - NSWindow - NSMenuItem - NSMenuItem - NSMenuItem - NSUserDefaultsController - NSWindow - NSMenu - XcodeCapp - - - - aboutWindow - NSPanel - - - helpView - PDFView - - - helpWindow - NSWindow - - - menuItemHistory - NSMenuItem - - - menuItemOpenProject - NSMenuItem - - - menuItemShowInFinder - NSMenuItem - - - preferencesController - NSUserDefaultsController - - - preferencesWindow - NSWindow - - - statusMenu - NSMenu - - - xcc - XcodeCapp - - - - IBProjectSource - ./Classes/AppController.h - - - - XcodeCapp - NSObject - - id - id - id - id - id - id - - - - checkProjectWithCappLint: - id - - - clearErrors: - id - - - openErrorInEditor: - id - - - openErrorsPanel: - id - - - openXcodeProject: - id - - - synchronizeProject: - id - - - - NSArrayController - NSTableView - NSPanel - - - - errorListController - NSArrayController - - - errorTable - NSTableView - - - errorsPanel - NSPanel - - - - IBProjectSource - ./Classes/XcodeCapp.h - - - - + 0 IBCocoaFramework YES From f14add279185abf3987a42816ee6cc068cd02eab Mon Sep 17 00:00:00 2001 From: Alexandre Wilhelm Date: Mon, 21 Apr 2014 17:30:12 -0700 Subject: [PATCH 3/7] New: open reporting window when clickin on a notification in xCodeCapp --- Tools/XcodeCapp/XcodeCapp/AppController.h | 2 +- Tools/XcodeCapp/XcodeCapp/AppController.m | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Tools/XcodeCapp/XcodeCapp/AppController.h b/Tools/XcodeCapp/XcodeCapp/AppController.h index 7278bd236..0e41cc26f 100644 --- a/Tools/XcodeCapp/XcodeCapp/AppController.h +++ b/Tools/XcodeCapp/XcodeCapp/AppController.h @@ -22,7 +22,7 @@ @class XcodeCapp; -@interface AppController : NSObject +@interface AppController : NSObject @property (strong) IBOutlet NSMenu *statusMenu; @property (unsafe_unretained) IBOutlet NSMenuItem *menuItemHistory; diff --git a/Tools/XcodeCapp/XcodeCapp/AppController.m b/Tools/XcodeCapp/XcodeCapp/AppController.m index 055c0029e..551f74751 100644 --- a/Tools/XcodeCapp/XcodeCapp/AppController.m +++ b/Tools/XcodeCapp/XcodeCapp/AppController.m @@ -111,7 +111,10 @@ AppController *SharedAppControllerInstance = nil; [[NSApplication sharedApplication] terminate:self]; return; } - + + NSUserNotificationCenter *center = [NSUserNotificationCenter defaultUserNotificationCenter]; + center.delegate = self; + // If we were opened from the command line, self.pathToOpenAtLaunch will be set. NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; @@ -527,4 +530,12 @@ AppController *SharedAppControllerInstance = nil; self.menuItemHistory.enabled = [projectHistory count] > 0; } +- (void)userNotificationCenter:(NSUserNotificationCenter *)center didActivateNotification:(NSUserNotification *)notification +{ + if ([[self.xcc errorList] count]) + [self.xcc openErrorsPanel:self]; + + [center removeDeliveredNotification:notification]; +} + @end From 30c48df1f082bf6466a419a2178a55c0ecce3279 Mon Sep 17 00:00:00 2001 From: Alexandre Wilhelm Date: Mon, 21 Apr 2014 17:34:39 -0700 Subject: [PATCH 4/7] Fixed: delegate of the notificationCenter is in AppController --- Tools/XcodeCapp/XcodeCapp/AppController.h | 2 +- Tools/XcodeCapp/XcodeCapp/AppController.m | 11 --- Tools/XcodeCapp/XcodeCapp/XcodeCapp.m | 104 ++++++++++++---------- 3 files changed, 59 insertions(+), 58 deletions(-) diff --git a/Tools/XcodeCapp/XcodeCapp/AppController.h b/Tools/XcodeCapp/XcodeCapp/AppController.h index 0e41cc26f..7278bd236 100644 --- a/Tools/XcodeCapp/XcodeCapp/AppController.h +++ b/Tools/XcodeCapp/XcodeCapp/AppController.h @@ -22,7 +22,7 @@ @class XcodeCapp; -@interface AppController : NSObject +@interface AppController : NSObject @property (strong) IBOutlet NSMenu *statusMenu; @property (unsafe_unretained) IBOutlet NSMenuItem *menuItemHistory; diff --git a/Tools/XcodeCapp/XcodeCapp/AppController.m b/Tools/XcodeCapp/XcodeCapp/AppController.m index 551f74751..079c89b55 100644 --- a/Tools/XcodeCapp/XcodeCapp/AppController.m +++ b/Tools/XcodeCapp/XcodeCapp/AppController.m @@ -112,9 +112,6 @@ AppController *SharedAppControllerInstance = nil; return; } - NSUserNotificationCenter *center = [NSUserNotificationCenter defaultUserNotificationCenter]; - center.delegate = self; - // If we were opened from the command line, self.pathToOpenAtLaunch will be set. NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; @@ -530,12 +527,4 @@ AppController *SharedAppControllerInstance = nil; self.menuItemHistory.enabled = [projectHistory count] > 0; } -- (void)userNotificationCenter:(NSUserNotificationCenter *)center didActivateNotification:(NSUserNotification *)notification -{ - if ([[self.xcc errorList] count]) - [self.xcc openErrorsPanel:self]; - - [center removeDeliveredNotification:notification]; -} - @end diff --git a/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m b/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m index 735db4924..aeb2a13a7 100644 --- a/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m +++ b/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m @@ -1713,53 +1713,8 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, return index != NSNotFound; } -#pragma mark - User notifications -- (NSString *)applicationNameForGrowl -{ - return @"XcodeCapp"; -} - -- (void)notifyUserWithTitle:(NSString *)aTitle message:(NSString *)aMessage -{ - if ([NSUserNotificationCenter class]) - { - NSUserNotification *note = [NSUserNotification new]; - note.title = aTitle; - note.informativeText = aMessage; - - [[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:note]; - } - else - { - [GrowlApplicationBridge notifyWithTitle:aTitle - description:aMessage - notificationName:GROWL_NOTIFICATIONS_DEFAULT - iconData:nil - priority:0 - isSticky:NO - clickContext:nil]; - } -} - -- (void)wantUserNotificationWithInfo:(NSDictionary *)info -{ - [self performSelectorOnMainThread:@selector(notifyUserWithInfo:) withObject:info waitUntilDone:NO]; -} - -- (void)notifyUserWithInfo:(NSDictionary *)info -{ - if ([info[@"projectId"] intValue] != self.projectId) - return; - - [self notifyUserWithTitle:info[@"title"] message:info[@"message"]]; -} - -- (BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentNotification:(NSUserNotification *)notification -{ - // Notification Center may decide not to show a notification. We always want them to show. - return YES; -} +#pragma mark - capp_lint - (IBAction)checkProjectWithCappLint:(id)aSender { @@ -1830,6 +1785,63 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, return NO; } + +#pragma mark - User notifications + +- (NSString *)applicationNameForGrowl +{ + return @"XcodeCapp"; +} + +- (void)notifyUserWithTitle:(NSString *)aTitle message:(NSString *)aMessage +{ + if ([NSUserNotificationCenter class]) + { + NSUserNotification *note = [NSUserNotification new]; + note.title = aTitle; + note.informativeText = aMessage; + + [[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:note]; + } + else + { + [GrowlApplicationBridge notifyWithTitle:aTitle + description:aMessage + notificationName:GROWL_NOTIFICATIONS_DEFAULT + iconData:nil + priority:0 + isSticky:NO + clickContext:nil]; + } +} + +- (void)wantUserNotificationWithInfo:(NSDictionary *)info +{ + [self performSelectorOnMainThread:@selector(notifyUserWithInfo:) withObject:info waitUntilDone:NO]; +} + +- (void)notifyUserWithInfo:(NSDictionary *)info +{ + if ([info[@"projectId"] intValue] != self.projectId) + return; + + [self notifyUserWithTitle:info[@"title"] message:info[@"message"]]; +} + +- (BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentNotification:(NSUserNotification *)notification +{ + // Notification Center may decide not to show a notification. We always want them to show. + return YES; +} + +- (void)userNotificationCenter:(NSUserNotificationCenter *)center didActivateNotification:(NSUserNotification *)notification +{ + if ([self.errorList count]) + [self openErrorsPanel:self]; + + [center removeDeliveredNotification:notification]; +} + @end From e8fef8104d2073d5ff3d87736510552cbddaec51 Mon Sep 17 00:00:00 2001 From: Alexandre Wilhelm Date: Mon, 21 Apr 2014 17:44:13 -0700 Subject: [PATCH 5/7] Fixed: check the entire project with capp_lint doesn't open the reporting window or a notification --- Tools/XcodeCapp/XcodeCapp/XcodeCapp.h | 3 ++- Tools/XcodeCapp/XcodeCapp/XcodeCapp.m | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Tools/XcodeCapp/XcodeCapp/XcodeCapp.h b/Tools/XcodeCapp/XcodeCapp/XcodeCapp.h index 018a4b1bc..d127fca46 100644 --- a/Tools/XcodeCapp/XcodeCapp/XcodeCapp.h +++ b/Tools/XcodeCapp/XcodeCapp/XcodeCapp.h @@ -45,7 +45,8 @@ enum { extern NSString * const XCCConversionDidStartNotification; extern NSString * const XCCConversionDidEndNotification; extern NSString * const XCCProjectDidFinishLoadingNotification; - +extern NSString * const XCCCappLintDidStartNotification; +extern NSString * const XCCCappLintDidEndNotification; @interface XcodeCapp : NSObject diff --git a/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m b/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m index aeb2a13a7..6e811ffe5 100644 --- a/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m +++ b/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m @@ -74,6 +74,8 @@ static NSPredicate * XCCDirectoriesToIgnorePredicate = nil; // An array of the default predicates used to ignore paths. static NSArray *XCCDefaultIgnoredPathPredicates = nil; +NSString * const XCCCappLintDidStartNotification = @"XCCCappLintDidStartNotification"; +NSString * const XCCCappLintDidEndNotification = @"XCCCappLintDidEndNotification"; @interface XcodeCapp () @@ -1719,15 +1721,26 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, - (IBAction)checkProjectWithCappLint:(id)aSender { [self clearErrors:self]; + + NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; + [center addObserver:self selector:@selector(cappLintDidEndNotification:) name:XCCCappLintDidEndNotification object:nil]; + [self performSelectorInBackground:@selector(checkCappLintForPath:) withObject:self.projectPath]; } +- (void)cappLintDidEndNotification:(NSNotification*)aNotification +{ + [self showCappLintErrors]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:XCCCappLintDidEndNotification object:nil]; +} + - (BOOL)checkCappLintForPath:(NSString*)aPath { DDLogVerbose(@"Checking path %@ with capp_lint", aPath); self.isProcessing = YES; [[NSNotificationCenter defaultCenter] postNotificationName:XCCBatchDidStartNotification object:self]; + [[NSNotificationCenter defaultCenter] postNotificationName:XCCCappLintDidStartNotification object:self]; NSString *baseDirectory = [NSString stringWithFormat:@"--basedir='%@'", self.projectPath]; NSArray *arguments = [NSArray arrayWithObjects:baseDirectory, aPath, nil]; @@ -1781,6 +1794,7 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, self.isProcessing = NO; [[NSNotificationCenter defaultCenter] postNotificationName:XCCBatchDidEndNotification object:self]; + [[NSNotificationCenter defaultCenter] postNotificationName:XCCCappLintDidEndNotification object:self]; return NO; } From 41ed80e0c4cb462b0a6f35a4c70acab764dffb9c Mon Sep 17 00:00:00 2001 From: Alexandre Wilhelm Date: Mon, 21 Apr 2014 19:11:48 -0700 Subject: [PATCH 6/7] Fixed: capp_lint in xCodeCapp doesn't care about xcodecapp-ignore --- .../XcodeCapp/ProcessSourceOperation.m | 2 +- Tools/XcodeCapp/XcodeCapp/XcodeCapp.h | 5 +- Tools/XcodeCapp/XcodeCapp/XcodeCapp.m | 56 +++++++++++++++---- 3 files changed, 51 insertions(+), 12 deletions(-) diff --git a/Tools/XcodeCapp/XcodeCapp/ProcessSourceOperation.m b/Tools/XcodeCapp/XcodeCapp/ProcessSourceOperation.m index e4dafc0d8..81e9b7cf6 100644 --- a/Tools/XcodeCapp/XcodeCapp/ProcessSourceOperation.m +++ b/Tools/XcodeCapp/XcodeCapp/ProcessSourceOperation.m @@ -162,7 +162,7 @@ if ([self.xcc shouldProcessWithCappLint]) { - showFinalNotification = [self.xcc checkCappLintForPath:self.sourcePath]; + showFinalNotification = [self.xcc checkCappLintForPath:[NSArray arrayWithObject:self.sourcePath]]; if (!showFinalNotification) [self.xcc showCappLintErrors]; diff --git a/Tools/XcodeCapp/XcodeCapp/XcodeCapp.h b/Tools/XcodeCapp/XcodeCapp/XcodeCapp.h index d127fca46..88fbac78a 100644 --- a/Tools/XcodeCapp/XcodeCapp/XcodeCapp.h +++ b/Tools/XcodeCapp/XcodeCapp/XcodeCapp.h @@ -110,6 +110,9 @@ extern NSString * const XCCCappLintDidEndNotification; // A list of errors generated from the current batch of source processing @property NSMutableArray *errorList; +// A list of files name who can be processed, based on xcapp-ignore and path pf the project +@property NSMutableArray *xCodeCappTargetedFiles; + // Panel, table and controller used to display errors @property (strong) IBOutlet NSPanel *errorsPanel; @property (unsafe_unretained) IBOutlet NSTableView *errorTable; @@ -147,7 +150,7 @@ extern NSString * const XCCCappLintDidEndNotification; - (NSDictionary*)createProject:(NSString*)aPath; - (BOOL)shouldProcessWithCappLint; -- (BOOL)checkCappLintForPath:(NSString*)aPath; +- (BOOL)checkCappLintForPath:(NSArray*)paths; - (void)showCappLintErrors; @end diff --git a/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m b/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m index 6e811ffe5..ac7ac96a7 100644 --- a/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m +++ b/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m @@ -319,9 +319,10 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, [self clearErrors:self]; [self computeIgnoredPaths]; - + [self prepareXcodeSupport]; [self populateXcodeProject]; + [self populatexCodeCappTargetedFiles]; [self waitForOperationQueueToFinishWithSelector:@selector(projectDidFinishLoading)]; } @@ -374,6 +375,25 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, return projectCompatibilityVersion.doubleValue >= appCompatibilityVersion; } +- (void)populatexCodeCappTargetedFiles +{ + NSFileManager *fm = [NSFileManager defaultManager]; + NSDirectoryEnumerator *filesOfProject = [fm enumeratorAtPath:self.projectPath]; + NSString *filename; + + self.xCodeCappTargetedFiles = [NSMutableArray array]; + + while ((filename = [filesOfProject nextObject] )) { + + NSString *fullPath = [self.projectPath stringByAppendingPathComponent:filename]; + + if (![self isSourceFile:fullPath]) + continue; + + [self.xCodeCappTargetedFiles addObject:fullPath]; + } +} + - (void)createXcodeProject { if ([self.fm fileExistsAtPath:self.xcodeProjectPath]) @@ -1361,6 +1381,7 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, return [path substringFromIndex:self.projectPath.length + 1]; } + #pragma mark - Shadow Files Management - (NSString *)shadowBasePathForProjectSourcePath:(NSString *)path @@ -1725,7 +1746,7 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; [center addObserver:self selector:@selector(cappLintDidEndNotification:) name:XCCCappLintDidEndNotification object:nil]; - [self performSelectorInBackground:@selector(checkCappLintForPath:) withObject:self.projectPath]; + [self performSelectorInBackground:@selector(checkCappLintForPath:) withObject:self.xCodeCappTargetedFiles]; } - (void)cappLintDidEndNotification:(NSNotification*)aNotification @@ -1734,16 +1755,22 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, [[NSNotificationCenter defaultCenter] removeObserver:self name:XCCCappLintDidEndNotification object:nil]; } -- (BOOL)checkCappLintForPath:(NSString*)aPath +- (BOOL)checkCappLintForPath:(NSArray*)paths { - DDLogVerbose(@"Checking path %@ with capp_lint", aPath); + DDLogVerbose(@"Checking path %@ with capp_lint", paths); + + NSUInteger numberOfFiles = [paths count]; + + if (!numberOfFiles) + return YES; self.isProcessing = YES; [[NSNotificationCenter defaultCenter] postNotificationName:XCCBatchDidStartNotification object:self]; [[NSNotificationCenter defaultCenter] postNotificationName:XCCCappLintDidStartNotification object:self]; NSString *baseDirectory = [NSString stringWithFormat:@"--basedir='%@'", self.projectPath]; - NSArray *arguments = [NSArray arrayWithObjects:baseDirectory, aPath, nil]; + NSMutableArray *arguments = [NSMutableArray arrayWithObjects:baseDirectory, nil]; + [arguments addObjectsFromArray:paths]; NSDictionary *taskResult = [self runTaskWithLaunchPath:self.executablePaths[@"capp_lint"] arguments:arguments @@ -1752,7 +1779,11 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, NSInteger status = [taskResult[@"status"] intValue]; if (status == 0) + { + [[NSNotificationCenter defaultCenter] postNotificationName:XCCBatchDidEndNotification object:self]; + [[NSNotificationCenter defaultCenter] postNotificationName:XCCCappLintDidEndNotification object:self]; return YES; + } NSString *response = taskResult[@"response"]; NSMutableArray *errors = [NSMutableArray arrayWithArray:[response componentsSeparatedByString:@"\n\n"]]; @@ -1761,21 +1792,26 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, [errors removeLastObject]; [errors removeObjectAtIndex:0]; - NSInteger i = 0; NSInteger numberOfErrors = [errors count]; + NSInteger i = 0; + NSString *path; + + if (numberOfFiles == 1) + path = [paths objectAtIndex:0]; for (i = 0; i < numberOfErrors; i++) { NSMutableString *error = (NSMutableString*)[errors objectAtIndex:i]; - NSString *firstCaract = [NSString stringWithFormat:@"%c" ,[error characterAtIndex:0]]; - NSString *path; NSString *line; + NSString *firstCaract = [NSString stringWithFormat:@"%c" ,[error characterAtIndex:0]]; if ([[NSScanner scannerWithString:firstCaract] scanInt:nil]) - error = (NSMutableString*)[NSString stringWithFormat:@"%@:%@",aPath,error]; + error = (NSMutableString*)[NSString stringWithFormat:@"%@:%@", path, error]; NSInteger positionOfFirstColon = [error rangeOfString:@":"].location; - path = [error substringToIndex:positionOfFirstColon]; + + if (numberOfFiles > 1) + path = [error substringToIndex:positionOfFirstColon]; NSString *errorWithoutPath = [error substringFromIndex:(positionOfFirstColon + 1)]; NSInteger positionOfSecondColon = [errorWithoutPath rangeOfString:@":"].location; From e8528271ee1e782b14dec0414593fa91731022fc Mon Sep 17 00:00:00 2001 From: Alexandre Wilhelm Date: Tue, 22 Apr 2014 11:42:19 -0700 Subject: [PATCH 7/7] Fixed: tableView doens't update its content with capp_lint --- Tools/XcodeCapp/XcodeCapp/XcodeCapp.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m b/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m index ac7ac96a7..3fe93840e 100644 --- a/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m +++ b/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m @@ -1795,6 +1795,7 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, NSInteger numberOfErrors = [errors count]; NSInteger i = 0; NSString *path; + NSMutableArray *dicts = [NSMutableArray array]; if (numberOfFiles == 1) path = [paths objectAtIndex:0]; @@ -1825,9 +1826,11 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, path, @"path", nil]; - [self.errorListController addObject:dict]; + [dicts addObject:dict]; } + [self performSelectorOnMainThread:@selector(cappLintConversionDidGenerateError:) withObject:dicts waitUntilDone:NO]; + self.isProcessing = NO; [[NSNotificationCenter defaultCenter] postNotificationName:XCCBatchDidEndNotification object:self]; [[NSNotificationCenter defaultCenter] postNotificationName:XCCCappLintDidEndNotification object:self]; @@ -1835,6 +1838,10 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, return NO; } +- (void)cappLintConversionDidGenerateError:(NSArray*)errors +{ + [self.errorListController addObjects:errors]; +} #pragma mark - User notifications