ProjectManager  0.2
MakeBuilder.h
00001 /*
00002     MakeBuilder.h
00003 
00004     Interface declaration of the MakeBuilder class for the ProjectManager
00005     application.
00006 
00007     Copyright (C) 2005  Saso Kiselkov
00008 
00009     This program is free software; you can redistribute it and/or modify
00010     it under the terms of the GNU General Public License as published by
00011     the Free Software Foundation; either version 2 of the License, or
00012     (at your option) any later version.
00013 
00014     This program is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017     GNU General Public License for more details.
00018 
00019     You should have received a copy of the GNU General Public License
00020     along with this program; if not, write to the Free Software
00021     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00022 */
00023 
00024 #import <Foundation/NSObject.h>
00025 #import "../../ProjectModule.h"
00026 
00027 @class NSString,
00028        NSMutableArray,
00029        NSFileHandle,
00030        NSNotification;
00031 
00032 @class NSView,
00033        NSTableView,
00034        NSTableColumn,
00035        NSTask;
00036 
00037 @protocol MakeBuilderDelegate;
00038 
00047 #define MakeBuilderBuildDidBeginNotification \
00048   @"MakeBuilderBuildDidBeginNotification"
00049 
00059 #define MakeBuilderBuildDidEndNotification \
00060   @"MakeBuilderBuildDidEndNotification"
00061 
00070 #define MakeBuilderCleanDidBeginNotification \
00071   @"MakeBuilderCleanDidBeginNotification"
00072 
00082 #define MakeBuilderCleanDidEndNotification \
00083   @"MakeBuilderCleanDidEndNotification"
00084 
00085 typedef enum {
00086   MakeBuilderReady,
00087   MakeBuilderBuilding,
00088   MakeBuilderCleaning
00089 } MakeBuilderState;
00090 
00091 @interface MakeBuilder : NSObject <ProjectModule>
00092 {
00093   // weak reference
00094   ProjectDocument * document;
00095 
00096   NSDictionary * info;
00097 
00098   id bogusWindow, view;
00099 
00100   id buildOutput;
00101   id buildArgs;
00102   id buildArgsManipulationMatrix;
00103   id buildArgsMovementMatrix;
00104   id buildErrors;
00105   id buildTarget;
00106   id verboseBuild;
00107   id warnings;
00108   id allWarnings;
00109 
00110   NSArray * targets;
00111   NSMutableArray * buildArguments;
00112   NSMutableArray * buildErrorList;
00113   NSString * lastIncompleteOutputLine;
00114   NSString * lastIncompleteErrorLine;
00115 
00116   // This stack holds the directories as the build processes passes through
00117   // subprojects. When a line of format "make[*Entering directory `*" is
00118   // received, the new build directory is put on top of this stack, and once
00119   // a "make[*Leaving directory`*" line received, the top element is popped
00120   // off. This way the builder can correctly follow the building process
00121   // when we have subprojects (which reside in subdirectories).
00122   NSMutableArray * buildDirectoryStack;
00123 
00124   MakeBuilderState state;
00125 
00126   NSTask * task;
00127   NSFileHandle * outputFileHandle, * errorFileHandle;
00128 
00129   id <MakeBuilderDelegate> delegate;    // weak reference
00130 }
00131 
00132 - (void) build: sender;
00133 - (void) buildTarget: (NSString *) target;
00134 
00135 - (void) clean: sender;
00136 - (void) cleanTarget: (NSString *) target;
00137 
00138 - (void) stopOperation: sender;
00139 
00140 - (BOOL) isBusy;
00141 
00142 - (void) addBuildArgument: (id)sender;
00143 - (void) removeBuildArgument: (id)sender;
00144 - (void) moveBuildArgumentUp: sender;
00145 - (void) moveBuildArgumentDown: sender;
00146 
00147 - (void) openErrorFile: sender;
00148 
00149 - (int) numberOfRowsInTableView: (NSTableView *)aTableView;
00150 - (id) tableView: (NSTableView *)aTableView 
00151 objectValueForTableColumn: (NSTableColumn *)aTableColumn 
00152              row: (int)rowIndex;
00153 - (void) tableView: (NSTableView *)aTableView 
00154     setObjectValue: (id)anObject 
00155     forTableColumn: (NSTableColumn *)aTableColumn
00156                row: (int)rowIndex;
00157 
00158 - (void) collectOutput: (NSNotification *) notif;
00159 - (void) collectErrorOutput: (NSNotification *) notif;
00160 
00161 - (void) buildCompleted: (NSNotification *) notif;
00162 - (void) cleanCompleted: (NSNotification *) notif;
00163 
00164 - (void) buildOptionChanged: sender;
00165 
00166 @end