From e8fef8104d2073d5ff3d87736510552cbddaec51 Mon Sep 17 00:00:00 2001 From: Alexandre Wilhelm Date: Mon, 21 Apr 2014 17:44:13 -0700 Subject: [PATCH] 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; }