2000-08-27 19:11:42 +00:00
/ *
GNUstep ProjectCenter - http : // www . projectcenter . ch
Copyright ( C ) 2000 Philippe C . D . Robert
Author : Philippe C . D . Robert < phr @ projectcenter . ch >
This file is part of ProjectCenter .
This application is free software ; you can redistribute it and / or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation ; either
version 2 of the License , or ( at your option ) any later version .
This application is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU
Library General Public License for more details .
You should have received a copy of the GNU General Public
License along with this library ; if not , write to the Free
Software Foundation , Inc . , 59 Temple Place , Suite 330 , Boston , MA 02111 USA .
$ Id $
* /
# import "PCProjectBuilder.h"
# import "PCProject.h"
2000-09-17 12:13:10 +00:00
# import "PCProjectManager.h"
2000-08-27 19:11:42 +00:00
# import < AppKit / AppKit . h >
2000-10-20 18:13:36 +00:00
# ifndef IMAGE
# define IMAGE ( X ) [ [ [ NSImage alloc ] initWithContentsOfFile : [ [ NSBundle mainBundle ] pathForImageResource : ( X ) ] ] autorelease ]
# endif
2000-10-29 12:00:24 +00:00
# ifndef NOTIFICATION_CENTER
# define NOTIFICATION_CENTER [ NSNotificationCenter defaultCenter ]
# endif
2001-01-10 15:19:42 +00:00
# define DEFAULT_RPM _PATH @ "/usr/src/redhat/SOURCES/"
2000-08-27 19:11:42 +00:00
@ interface PCProjectBuilder ( CreateUI )
2000-10-29 20:15:39 +00:00
- ( void ) _createComponentView ;
2000-08-27 19:11:42 +00:00
@ end
@ implementation PCProjectBuilder ( CreateUI )
2000-10-29 20:15:39 +00:00
- ( void ) _createComponentView
2000-08-27 19:11:42 +00:00
{
NSSplitView * split ;
NSScrollView * scrollView1 ;
NSScrollView * scrollView2 ;
2000-09-17 12:13:10 +00:00
NSMatrix * matrix ;
2000-08-27 19:11:42 +00:00
NSRect _w _frame ;
2000-09-17 12:13:10 +00:00
NSButtonCell * buttonCell = [ [ [ NSButtonCell alloc ] init ] autorelease ] ;
id button ;
2000-09-22 10:33:12 +00:00
id textField ;
2000-08-27 19:11:42 +00:00
2000-10-29 20:15:39 +00:00
componentView = [ [ NSBox alloc ] initWithFrame : NSMakeRect ( 0 , 0 , 544 , 248 ) ] ;
[ componentView setTitlePosition : NSNoTitle ] ;
[ componentView setBorderType : NSNoBorder ] ;
[ componentView setAutoresizingMask : NSViewWidthSizable | NSViewHeightSizable ] ;
2000-08-27 19:11:42 +00:00
/ *
* /
2000-10-29 20:15:39 +00:00
logOutput = [ [ NSTextView alloc ] initWithFrame : NSMakeRect ( 0 , 0 , 516 , 32 ) ] ;
2000-08-27 19:11:42 +00:00
[ logOutput setMaxSize : NSMakeSize ( 1 e7 , 1 e7 ) ] ;
2001-01-10 15:19:42 +00:00
// [ logOutput setMinSize : NSMakeSize ( 516 , 48 ) ] ;
2000-10-29 12:00:24 +00:00
[ logOutput setRichText : NO ] ;
[ logOutput setEditable : NO ] ;
[ logOutput setSelectable : YES ] ;
2000-08-27 19:11:42 +00:00
[ logOutput setAutoresizingMask : NSViewWidthSizable | NSViewHeightSizable ] ;
2000-09-20 09:59:53 +00:00
[ logOutput setBackgroundColor : [ NSColor lightGrayColor ] ] ;
2000-08-27 19:11:42 +00:00
[ [ logOutput textContainer ] setWidthTracksTextView : YES ] ;
2000-10-29 20:15:39 +00:00
scrollView1 = [ [ NSScrollView alloc ] initWithFrame : NSMakeRect ( 0 , 0 , 540 , 46 ) ] ;
2000-08-27 19:11:42 +00:00
[ scrollView1 setDocumentView : logOutput ] ;
[ [ logOutput textContainer ] setContainerSize : NSMakeSize ( [ scrollView1 contentSize ] . width , 1 e7 ) ] ;
2000-09-20 09:53:38 +00:00
[ scrollView1 setHasHorizontalScroller : NO ] ;
2000-08-27 19:11:42 +00:00
[ scrollView1 setHasVerticalScroller : YES ] ;
[ scrollView1 setBorderType : NSBezelBorder ] ;
[ scrollView1 setAutoresizingMask : ( NSViewWidthSizable | NSViewHeightSizable ) ] ;
/ *
*
* /
2000-10-29 20:15:39 +00:00
errorOutput = [ [ NSTextView alloc ] initWithFrame : NSMakeRect ( 0 , 0 , 516 , 80 ) ] ;
2000-10-15 12:27:52 +00:00
[ errorOutput setMaxSize : NSMakeSize ( 1 e7 , 1 e7 ) ] ;
2001-01-10 15:19:42 +00:00
// [ errorOutput setMinSize : NSMakeSize ( 516 , 48 ) ] ;
2000-10-29 12:00:24 +00:00
[ errorOutput setRichText : NO ] ;
[ errorOutput setEditable : NO ] ;
[ errorOutput setSelectable : YES ] ;
2000-10-15 12:27:52 +00:00
[ errorOutput setAutoresizingMask : NSViewWidthSizable | NSViewHeightSizable ] ;
[ errorOutput setBackgroundColor : [ NSColor whiteColor ] ] ;
[ [ errorOutput textContainer ] setWidthTracksTextView : YES ] ;
2000-08-27 19:11:42 +00:00
2000-10-29 20:15:39 +00:00
scrollView2 = [ [ NSScrollView alloc ] initWithFrame : NSMakeRect ( 0 , 0 , 540 , 92 ) ] ;
2000-10-15 12:27:52 +00:00
[ scrollView2 setDocumentView : errorOutput ] ;
[ [ errorOutput textContainer ] setContainerSize : NSMakeSize ( [ scrollView2 contentSize ] . width , 1 e7 ) ] ;
2000-09-20 09:59:53 +00:00
[ scrollView2 setHasHorizontalScroller : NO ] ;
[ scrollView2 setHasVerticalScroller : YES ] ;
2000-08-27 19:11:42 +00:00
[ scrollView2 setBorderType : NSBezelBorder ] ;
[ scrollView2 setAutoresizingMask : ( NSViewWidthSizable | NSViewHeightSizable ) ] ;
2000-10-29 20:15:39 +00:00
split = [ [ NSSplitView alloc ] initWithFrame : NSMakeRect ( 0 , 0 , 540 , 188 ) ] ;
2000-08-27 19:11:42 +00:00
[ split setAutoresizingMask : ( NSViewWidthSizable | NSViewHeightSizable ) ] ;
[ split addSubview : scrollView1 ] ;
[ split addSubview : scrollView2 ] ;
2000-10-29 20:15:39 +00:00
[ split adjustSubviews ] ;
[ componentView addSubview : split ] ;
2001-01-10 15:19:42 +00:00
RELEASE ( scrollView1 ) ;
RELEASE ( scrollView2 ) ;
RELEASE ( split ) ;
2000-09-17 12:13:10 +00:00
/ *
2001-01-10 15:19:42 +00:00
* 6 build Buttons
2000-09-17 12:13:10 +00:00
* /
2001-01-10 15:19:42 +00:00
_w _frame = NSMakeRect ( 0 , 194 , 272 , 44 ) ;
matrix = [ [ NSMatrix alloc ] initWithFrame : _w _frame
mode : NSHighlightModeMatrix
prototype : buttonCell
numberOfRows : 1
numberOfColumns : 6 ] ;
2000-09-19 15:39:55 +00:00
[ matrix sizeToCells ] ;
2000-09-17 12:13:10 +00:00
[ matrix setSelectionByRect : YES ] ;
[ matrix setAutoresizingMask : ( NSViewMaxXMargin | NSViewMinYMargin ) ] ;
2000-09-17 14:40:56 +00:00
[ matrix setTarget : self ] ;
[ matrix setAction : @ selector ( build : ) ] ;
2000-10-29 20:15:39 +00:00
[ componentView addSubview : matrix ] ;
2000-09-17 12:13:10 +00:00
2001-01-10 15:19:42 +00:00
RELEASE ( matrix ) ;
2000-09-17 12:13:10 +00:00
button = [ matrix cellAtRow : 0 column : 0 ] ;
2000-09-17 14:40:56 +00:00
[ button setTag : 0 ] ;
2000-10-20 18:13:36 +00:00
[ button setImagePosition : NSImageOnly ] ;
[ button setImage : IMAGE ( @ "ProjectCenter_make" ) ] ;
2000-09-17 12:13:10 +00:00
[ button setButtonType : NSMomentaryPushButton ] ;
2000-09-17 14:40:56 +00:00
[ button setTitle : @ "Build" ] ;
2000-09-17 12:13:10 +00:00
button = [ matrix cellAtRow : 0 column : 1 ] ;
2000-09-17 14:40:56 +00:00
[ button setTag : 1 ] ;
2000-10-20 18:13:36 +00:00
[ button setImagePosition : NSImageOnly ] ;
[ button setImage : IMAGE ( @ "ProjectCenter_clean" ) ] ;
2000-09-17 12:13:10 +00:00
[ button setButtonType : NSMomentaryPushButton ] ;
2000-09-17 14:40:56 +00:00
[ button setTitle : @ "Clean" ] ;
2000-09-17 12:13:10 +00:00
button = [ matrix cellAtRow : 0 column : 2 ] ;
2000-09-17 14:40:56 +00:00
[ button setTag : 2 ] ;
2000-10-20 18:13:36 +00:00
[ button setImagePosition : NSImageOnly ] ;
[ button setImage : IMAGE ( @ "ProjectCenter_debug" ) ] ;
2000-09-17 12:13:10 +00:00
[ button setButtonType : NSMomentaryPushButton ] ;
2000-09-17 14:40:56 +00:00
[ button setTitle : @ "Debug" ] ;
button = [ matrix cellAtRow : 0 column : 3 ] ;
[ button setTag : 3 ] ;
2000-10-20 18:13:36 +00:00
[ button setImagePosition : NSImageOnly ] ;
[ button setImage : IMAGE ( @ "ProjectCenter_profile" ) ] ;
2000-09-17 14:40:56 +00:00
[ button setButtonType : NSMomentaryPushButton ] ;
[ button setTitle : @ "Profile" ] ;
button = [ matrix cellAtRow : 0 column : 4 ] ;
[ button setTag : 4 ] ;
2000-10-20 18:13:36 +00:00
[ button setImagePosition : NSImageOnly ] ;
[ button setImage : IMAGE ( @ "ProjectCenter_install" ) ] ;
2000-09-17 14:40:56 +00:00
[ button setButtonType : NSMomentaryPushButton ] ;
[ button setTitle : @ "Install" ] ;
2000-09-22 10:33:12 +00:00
2001-01-10 15:19:42 +00:00
button = [ matrix cellAtRow : 0 column : 5 ] ;
[ button setTag : 5 ] ;
[ button setImagePosition : NSImageOnly ] ;
[ button setImage : IMAGE ( @ "ProjectCenter_rpm" ) ] ;
[ button setButtonType : NSMomentaryPushButton ] ;
[ button setTitle : @ "Packaging" ] ;
2000-09-22 10:33:12 +00:00
/ *
* Status
* /
2001-01-10 15:19:42 +00:00
textField = [ [ NSTextField alloc ] initWithFrame : NSMakeRect ( 288 , 220 , 48 , 15 ) ] ;
2000-09-22 10:33:12 +00:00
[ textField setAlignment : NSRightTextAlignment ] ;
[ textField setBordered : NO ] ;
[ textField setEditable : NO ] ;
[ textField setBezeled : NO ] ;
[ textField setDrawsBackground : NO ] ;
[ textField setStringValue : @ "Status:" ] ;
[ textField setAutoresizingMask : ( NSViewMaxXMargin |
NSViewMinYMargin ) ] ;
2001-01-10 15:19:42 +00:00
[ componentView addSubview : textField ] ;
RELEASE ( textField ) ;
2000-09-22 10:33:12 +00:00
/ *
* Status message
* /
2001-01-10 15:19:42 +00:00
buildStatusField = [ [ NSTextField alloc ] initWithFrame : NSMakeRect ( 340 , 220 , 104 , 15 ) ] ;
2000-09-22 10:33:12 +00:00
[ buildStatusField setAlignment : NSLeftTextAlignment ] ;
[ buildStatusField setBordered : NO ] ;
[ buildStatusField setEditable : NO ] ;
[ buildStatusField setBezeled : NO ] ;
[ buildStatusField setDrawsBackground : NO ] ;
[ buildStatusField setStringValue : @ "waiting..." ] ;
[ buildStatusField setAutoresizingMask : ( NSViewMaxXMargin |
NSViewWidthSizable |
NSViewMinYMargin ) ] ;
2001-01-10 15:19:42 +00:00
[ componentView addSubview : buildStatusField ] ;
RELEASE ( buildStatusField ) ;
2000-09-22 10:33:12 +00:00
/ *
* Target
* /
2001-01-10 15:19:42 +00:00
textField = [ [ NSTextField alloc ] initWithFrame : NSMakeRect ( 288 , 196 , 48 , 15 ) ] ;
2000-09-22 10:33:12 +00:00
[ textField setAlignment : NSRightTextAlignment ] ;
[ textField setBordered : NO ] ;
[ textField setBezeled : NO ] ;
[ textField setEditable : NO ] ;
[ textField setDrawsBackground : NO ] ;
[ textField setStringValue : @ "Target:" ] ;
[ textField setAutoresizingMask : ( NSViewMaxXMargin |
NSViewMinYMargin ) ] ;
2001-01-10 15:19:42 +00:00
[ componentView addSubview : textField ] ;
RELEASE ( textField ) ;
2000-09-22 10:33:12 +00:00
/ *
* Target message
* /
2001-01-10 15:19:42 +00:00
targetField = [ [ NSTextField alloc ] initWithFrame : NSMakeRect ( 340 , 196 , 104 , 15 ) ] ;
2000-09-22 10:33:12 +00:00
[ targetField setAlignment : NSLeftTextAlignment ] ;
[ targetField setBordered : NO ] ;
[ targetField setEditable : NO ] ;
[ targetField setBezeled : NO ] ;
[ targetField setDrawsBackground : NO ] ;
[ targetField setStringValue : @ "Default..." ] ;
[ targetField setAutoresizingMask : ( NSViewMaxXMargin |
NSViewWidthSizable |
NSViewMinYMargin ) ] ;
2001-01-10 15:19:42 +00:00
[ componentView addSubview : targetField ] ;
RELEASE ( targetField ) ;
2000-08-27 19:11:42 +00:00
}
@ end
@ implementation PCProjectBuilder
2000-10-29 20:15:39 +00:00
- ( id ) initWithProject : ( PCProject * ) aProject
2000-08-27 19:11:42 +00:00
{
2000-10-29 20:15:39 +00:00
NSAssert ( aProject , @ "No project specified!" ) ;
2000-08-27 19:11:42 +00:00
if ( ( self = [ super init ] ) ) {
makePath = [ [ NSString stringWithString : @ "/usr/bin/make" ] retain ] ;
2000-10-29 20:15:39 +00:00
currentProject = aProject ;
2000-08-27 19:11:42 +00:00
}
return self ;
}
- ( void ) dealloc
{
2000-10-29 20:15:39 +00:00
[ componentView release ] ;
2000-08-27 19:11:42 +00:00
[ makePath release ] ;
[ super dealloc ] ;
}
2000-10-29 20:15:39 +00:00
- ( NSView * ) componentView ;
2000-09-17 12:13:10 +00:00
{
2000-10-29 20:15:39 +00:00
if ( ! componentView ) {
[ self _createComponentView ] ;
2000-09-17 12:13:10 +00:00
}
2000-10-29 20:15:39 +00:00
return componentView ;
2000-09-17 12:13:10 +00:00
}
- ( void ) build : ( id ) sender
2000-08-27 19:11:42 +00:00
{
NSString * tg = nil ;
NSTask * makeTask ;
NSMutableArray * args ;
NSPipe * logPipe ;
2000-10-15 12:27:52 +00:00
NSPipe * errorPipe ;
2000-09-17 12:13:10 +00:00
NSDictionary * optionDict ;
2000-10-15 12:27:52 +00:00
NSString * status ;
NSString * target ;
2001-01-10 15:19:42 +00:00
SEL postProcess = NULL ;
2000-09-17 12:13:10 +00:00
2000-08-27 19:11:42 +00:00
logPipe = [ NSPipe pipe ] ;
2000-10-29 12:00:24 +00:00
readHandle = [ [ logPipe fileHandleForReading ] retain ] ;
2000-10-15 12:27:52 +00:00
2000-10-29 12:00:24 +00:00
errorPipe = [ NSPipe pipe ] ;
errorReadHandle = [ [ errorPipe fileHandleForReading ] retain ] ;
2000-10-15 12:27:52 +00:00
2000-08-27 19:11:42 +00:00
makeTask = [ [ NSTask alloc ] init ] ;
2000-09-17 12:13:10 +00:00
optionDict = [ currentProject buildOptions ] ;
2000-09-17 14:40:56 +00:00
args = [ NSMutableArray array ] ;
switch ( [ [ sender selectedCell ] tag ] ) {
case 0 :
2000-10-15 12:27:52 +00:00
status = [ NSString stringWithString : @ "Building..." ] ;
target = [ NSString stringWithString : @ "Default" ] ;
2000-09-17 14:40:56 +00:00
break ;
case 1 :
2000-10-15 12:27:52 +00:00
if ( NSRunAlertPanel ( @ "Clean Project?" , @ "Really clean %@?" , @ "Yes" , @ "No" , nil , [ currentProject projectName ] ) = = NSAlertAlternateReturn ) {
return ;
}
status = [ NSString stringWithString : @ "Cleaning..." ] ;
target = [ NSString stringWithString : @ "Clean" ] ;
2001-01-10 15:19:42 +00:00
[ args addObject : @ "distclean" ] ;
2000-09-17 14:40:56 +00:00
break ;
case 2 :
2000-10-15 12:27:52 +00:00
status = [ NSString stringWithString : @ "Building..." ] ;
target = [ NSString stringWithString : @ "Debug" ] ;
2000-09-17 14:40:56 +00:00
[ args addObject : @ "debug=yes" ] ;
break ;
case 3 :
2000-10-15 12:27:52 +00:00
status = [ NSString stringWithString : @ "Building..." ] ;
target = [ NSString stringWithString : @ "Profile" ] ;
2000-09-17 14:40:56 +00:00
[ args addObject : @ "profile=yes" ] ;
[ args addObject : @ "static=yes" ] ;
break ;
case 4 :
2000-10-15 12:27:52 +00:00
status = [ NSString stringWithString : @ "Installing..." ] ;
target = [ NSString stringWithString : @ "Install" ] ;
2000-09-17 14:40:56 +00:00
[ args addObject : @ "install" ] ;
break ;
2001-01-10 15:19:42 +00:00
case 5 :
status = [ NSString stringWithString : @ "Packaging..." ] ;
target = [ NSString stringWithString : @ "Making RPM" ] ;
[ args addObject : @ "specfile" ] ;
postProcess = @ selector ( copyPackageTo : ) ;
NSRunAlertPanel ( @ "Creating RPM SPEC" , @ "After creating the RPM SPEC file you have to invoke \" rpm - ba % @ . spec \ " in the project directory.\nThis only works if you made a \" make install \ " before!" , @ "OK" , nil , nil , [ currentProject projectName ] ) ;
break ;
2000-09-17 14:40:56 +00:00
}
2000-10-15 12:27:52 +00:00
[ buildStatusField setStringValue : status ] ;
[ targetField setStringValue : target ] ;
2000-09-17 12:13:10 +00:00
2000-10-29 12:00:24 +00:00
[ NOTIFICATION_CENTER addObserver : self
selector : @ selector ( logStdOut : )
name : NSFileHandleDataAvailableNotification
object : readHandle ] ;
2000-10-15 12:27:52 +00:00
2000-10-29 12:00:24 +00:00
[ NOTIFICATION_CENTER addObserver : self
selector : @ selector ( logErrOut : )
name : NSFileHandleDataAvailableNotification
object : errorReadHandle ] ;
2000-10-15 12:27:52 +00:00
2000-10-29 12:00:24 +00:00
[ NOTIFICATION_CENTER addObserver : self
selector : @ selector ( buildDidTerminate : )
name : NSTaskDidTerminateNotification
object : makeTask ] ;
[ makeTask setArguments : args ] ;
2000-09-17 14:40:56 +00:00
[ makeTask setCurrentDirectoryPath : [ currentProject projectPath ] ] ;
[ makeTask setLaunchPath : makePath ] ;
[ makeTask setStandardOutput : logPipe ] ;
2000-10-15 12:27:52 +00:00
[ makeTask setStandardError : errorPipe ] ;
2000-10-15 18:24:09 +00:00
2000-10-15 12:27:52 +00:00
[ logOutput setString : @ "" ] ;
2000-10-29 12:00:24 +00:00
[ readHandle waitForDataInBackgroundAndNotify ] ;
2000-10-15 18:24:09 +00:00
2000-10-15 12:27:52 +00:00
[ errorOutput setString : @ "" ] ;
2000-10-29 12:00:24 +00:00
[ errorReadHandle waitForDataInBackgroundAndNotify ] ;
2000-09-17 14:40:56 +00:00
2000-10-29 12:00:24 +00:00
[ makeTask launch ] ;
2000-09-17 14:40:56 +00:00
[ makeTask waitUntilExit ] ;
2000-10-15 12:27:52 +00:00
2001-01-10 15:19:42 +00:00
if ( postProcess ) {
[ self performSelector : postProcess ] ;
}
2000-10-15 12:27:52 +00:00
[ buildStatusField setStringValue : @ "Waiting..." ] ;
[ targetField setStringValue : @ "" ] ;
2000-10-29 12:00:24 +00:00
[ NOTIFICATION_CENTER removeObserver : self
name : NSFileHandleDataAvailableNotification
object : readHandle ] ;
[ NOTIFICATION_CENTER removeObserver : self
name : NSFileHandleDataAvailableNotification
object : errorReadHandle ] ;
[ NOTIFICATION_CENTER removeObserver : self
name : NSTaskDidTerminateNotification
object : makeTask ] ;
2000-10-15 12:27:52 +00:00
2001-01-10 15:19:42 +00:00
RELEASE ( readHandle ) ;
RELEASE ( errorReadHandle ) ;
AUTORELEASE ( makeTask ) ;
2000-09-17 12:13:10 +00:00
}
2000-08-27 19:11:42 +00:00
2000-10-29 12:00:24 +00:00
- ( void ) logStdOut : ( NSNotification * ) aNotif
{
NSData * data ;
if ( ( data = [ readHandle availableData ] ) ) {
[ self logData : data error : NO ] ;
}
[ readHandle waitForDataInBackgroundAndNotifyForModes : nil ] ;
}
- ( void ) logErrOut : ( NSNotification * ) aNotif
{
NSData * data ;
if ( ( data = [ errorReadHandle availableData ] ) ) {
[ self logData : data error : YES ] ;
}
[ errorReadHandle waitForDataInBackgroundAndNotifyForModes : nil ] ;
}
- ( void ) buildDidTerminate : ( NSNotification * ) aNotif
2000-09-17 12:13:10 +00:00
{
2000-10-29 12:00:24 +00:00
int status = [ [ aNotif object ] terminationStatus ] ;
2000-08-27 19:11:42 +00:00
2000-10-29 12:00:24 +00:00
if ( status = = 0 ) {
[ self logString : @ "*** Build Succeeded!\n" error : NO newLine : YES ] ;
}
else {
[ self logString : @ "*** Build Failed!" error : YES newLine : YES ] ;
[ [ logOutput window ] orderFront : self ] ;
}
2000-09-17 12:13:10 +00:00
}
2000-08-27 19:11:42 +00:00
2001-01-10 15:19:42 +00:00
- ( void ) copyPackageTo : ( NSString * ) path
{
NSString * dest ;
NSString * source = nil ;
if ( ! path ) {
dest = [ NSString stringWithString : DEFAULT_RPM _PATH ] ;
}
else {
dest = path ;
}
// Create the tar . gz package
// Copy it
if ( source ) {
[ [ NSFileManager defaultManager ] copyPath : source toPath : dest handler : nil ] ;
}
// Copy the package to path
postProcess = NULL ;
}
2000-08-27 19:11:42 +00:00
@ end
2000-10-29 12:00:24 +00:00
@ implementation PCProjectBuilder ( BuildLogging )
- ( void ) logString : ( NSString * ) string error : ( BOOL ) yn
{
[ self logString : string error : yn newLine : YES ] ;
}
- ( void ) logString : ( NSString * ) str error : ( BOOL ) yn newLine : ( BOOL ) newLine
{
NSTextView * out = ( yn ) ? errorOutput : logOutput ;
[ out replaceCharactersInRange : NSMakeRange ( [ [ out string ] length ] , 0 ) withString : str ] ;
if ( newLine ) {
[ out replaceCharactersInRange : NSMakeRange ( [ [ out string ] length ] , 0 ) withString : @ "\n" ] ;
}
else {
[ out replaceCharactersInRange : NSMakeRange ( [ [ out string ] length ] , 0 ) withString : @ " " ] ;
}
[ out scrollRangeToVisible : NSMakeRange ( [ [ out string ] length ] , 0 ) ] ;
}
- ( void ) logData : ( NSData * ) data error : ( BOOL ) yn
{
NSString * s = [ [ NSString alloc ] initWithData : data
encoding : [ NSString defaultCStringEncoding ] ] ;
[ self logString : s error : yn newLine : YES ] ;
[ s autorelease ] ;
}
@ end
2000-10-29 20:15:39 +00:00