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 +