ProjectBuilder.st
author Claus Gittinger <cg@exept.de>
Thu, 22 Oct 2009 23:45:10 +0200
changeset 2678 cca2788228ad
parent 2677 e2c24a1be97f
child 2680 3f2dbbd7743f
permissions -rw-r--r--
added: #copySupportFilesForExecution
changed:
#copyStartupFilesFromSmalltalk
#copySupportFilesForLinkage
     1 "{ Package: 'stx:libtool2' }"
     2 
     3 "{ NameSpace: Tools }"
     4 
     5 Object subclass:#ProjectBuilder
     6 	instanceVariableNames:'package projectDefinitionClass sourceCodeManager buildDirectory
     7 		myWorkingDirectory mySTXTopDirectory myTopDirectory outputStream
     8 		makeExeOnly'
     9 	classVariableNames:'PreviousBuildDirectory'
    10 	poolDictionaries:''
    11 	category:'System-Support-Projects'
    12 !
    13 
    14 
    15 !ProjectBuilder class methodsFor:'accessing'!
    16 
    17 previousBuildDirectory
    18     ^ PreviousBuildDirectory
    19 !
    20 
    21 previousBuildDirectory:something
    22     PreviousBuildDirectory := something.
    23 ! !
    24 
    25 !ProjectBuilder class methodsFor:'examples'!
    26 
    27 example1
    28     Smalltalk loadPackage:'stx:projects/helloWorldApp' asAutoloaded:true.
    29 
    30     self new
    31         package:'stx:projects/helloWorldApp';
    32         build
    33 !
    34 
    35 example2
    36     |builder|
    37 
    38     Smalltalk loadPackage:'stx:clients/Demos/foxCalcApplication' asAutoloaded:true.
    39 
    40     builder := self new.
    41     builder package:'stx:clients/Demos/foxCalcApplication'.
    42     builder build.
    43 
    44     UserPreferences fileBrowserClass openOnDirectory:builder packageBuildDirectory.
    45 ! !
    46 
    47 !ProjectBuilder methodsFor:'accessing'!
    48 
    49 buildDirectory
    50     ^ buildDirectory
    51 !
    52 
    53 buildDirectory:something
    54     buildDirectory := something.
    55 !
    56 
    57 makeExeOnly:aBoolean
    58     makeExeOnly := aBoolean.
    59 !
    60 
    61 package:aPackageIDOrSymbol
    62     package := aPackageIDOrSymbol asPackageId.
    63 !
    64 
    65 packageBuildDirectory
    66     "the directoray, where the deployable binary is created (xxxSetup.exe)"
    67 
    68     ^ buildDirectory / (package asPackageId module) / (package asPackageId directory)
    69 !
    70 
    71 projectDefinitionClass:something
    72     projectDefinitionClass := something.
    73 ! !
    74 
    75 !ProjectBuilder methodsFor:'building'!
    76 
    77 build
    78     "/ intermediate - this will move into a commonly used utility class
    79     "/ (where all the project code support will be collected).
    80 
    81     |makeOutput|
    82 
    83     makeOutput := TextStream on:(Text new:10000).
    84     self buildWithColorizedOutputTo:makeOutput.
    85 
    86     TextView openWith:makeOutput contents.
    87 !
    88 
    89 buildWithColorizedOutputTo:makeOutput
    90     "/ intermediate - this will move into a commonly used utility class
    91     "/ (where all the project code support will be collected).
    92 
    93     |stdOut stdErr lock|
    94 
    95     lock := Semaphore forMutualExclusion.
    96 
    97     stdErr := ActorStream new
    98                     nextPutBlock:[:char |
    99                         lock critical:[
   100                             makeOutput emphasis:{#backgroundColor->Color red. #color->Color white.}.
   101                             makeOutput nextPut:char.
   102                             makeOutput emphasis:nil.
   103                         ]
   104                     ];
   105                     nextPutAllBlock:[:char |
   106                         lock critical:[
   107                             makeOutput emphasis:{#backgroundColor->Color red. #color->Color white.}.
   108                             makeOutput nextPutAll:char.
   109                             makeOutput emphasis:nil.
   110                         ]
   111                     ].
   112     stdOut := ActorStream new
   113                     nextPutBlock:[:char |
   114                         lock critical:[
   115                             makeOutput nextPut:char.
   116                         ]
   117                     ];
   118                     nextPutAllBlock:[:char |
   119                         lock critical:[
   120                             makeOutput nextPutAll:char.
   121                         ]
   122                     ].
   123 
   124     self buildWithOutputTo:stdOut errorTo:stdErr.
   125 !
   126 
   127 buildWithOutputTo:stdOut errorTo:stdErr
   128     "/ intermediate - this will move into a commonly used utility class
   129     "/ (where all the project code support will be collected).
   130 
   131     |module directory|
   132 
   133     projectDefinitionClass := ProjectDefinition definitionClassForPackage:package.
   134     projectDefinitionClass isNil ifTrue:[
   135         self error:('Missing ProjectDefinition class for "',package asString,'"')
   136     ].
   137 
   138     "/ ensure that everything is loaded...
   139     projectDefinitionClass loadAsAutoloaded:false.
   140     projectDefinitionClass loadExtensions.
   141     projectDefinitionClass loadAllClassesAsAutoloaded:false.
   142 
   143     module := package module.
   144     directory := package directory.
   145 
   146     buildDirectory isNil ifTrue:[
   147         buildDirectory := PreviousBuildDirectory ifNil:[ UserPreferences current buildDirectory ].
   148         buildDirectory isNil ifTrue:[
   149             buildDirectory := Filename tempDirectory construct:'stx_build'.
   150         ].
   151     ].
   152     buildDirectory := buildDirectory asFilename.
   153 
   154     "/ self validateBuildDirectoryIsPresent.
   155 
   156     PreviousBuildDirectory := buildDirectory.
   157 
   158     "/ UserPreferences current localBuild:true
   159     UserPreferences current localBuild ifFalse:[
   160         SourceCodeManager notNil ifTrue:[
   161             sourceCodeManager := SourceCodeManagerUtilities sourceCodeManagerFor:projectDefinitionClass.
   162         ]
   163     ].
   164     sourceCodeManager := nil.
   165 
   166     myTopDirectory := 
   167         Smalltalk packagePath 
   168             detect:[:aPath |
   169                 (aPath asFilename / 'stx' / 'include') exists
   170                 and: [ (aPath asFilename / 'stx' / 'rules') exists ]]
   171             ifNone:nil.       
   172     myTopDirectory isNil ifTrue:[
   173         self error:('Cannot figure out my top directory (where stx/include and stx/rules are)')
   174     ].
   175     myTopDirectory := myTopDirectory asFilename.
   176     mySTXTopDirectory := myTopDirectory / 'stx'.
   177 
   178     self setupBuildDirectory.
   179     self activityNotification:'Generating stc directory...'.
   180     self copySTCDirectoryForBuild.
   181     self activityNotification:'Generating source files...'.
   182     self generateSourceFiles.
   183     self activityNotification:'Copying dlls for linkage...'.
   184     self copyDLLsForLinkage.
   185     self activityNotification:'Copying support files for linkage...'.
   186     self copySupportFilesForLinkage.
   187     self copyStartupFilesFromSmalltalk.
   188 
   189     self activityNotification:'Executing make...'.
   190     self makeWithOutputTo:stdOut errorTo:stdErr.
   191 !
   192 
   193 copyDLLsForLinkage
   194     |targetBuildDir|
   195 
   196     targetBuildDir := buildDirectory / package module / package directory.
   197 
   198     (projectDefinitionClass allPreRequisites)
   199     do:[:eachPackageToFileout |
   200         |packageId packageDef packageModule packageDirectory packageTargetDir
   201          dllSource dllSourceDir libraryName dllRelativePath|
   202 
   203         packageId := eachPackageToFileout asPackageId.
   204         packageModule := packageId module.
   205         packageDirectory := packageId directory.
   206         packageTargetDir := (buildDirectory / packageModule / packageDirectory) recursiveMakeDirectory.
   207 
   208         packageDef := packageId projectDefinitionClass.
   209         libraryName := packageDef libraryName.
   210 
   211         "/ mhmh - take them from my tree or from the projects/smalltalk execution directory ??
   212         dllSourceDir := myTopDirectory / packageModule / packageDirectory.
   213         OperatingSystem isMSWINDOWSlike ifTrue:[
   214 "/            dllRelativePath := 'objvc','/',(libraryName,'.dll').
   215 "/            (dllSourceDir / dllRelativePath) exists 
   216             false ifFalse:[
   217                 dllRelativePath := 'objbc','/',(libraryName,'.dll').
   218             ]
   219         ] ifFalse:[
   220             dllRelativePath := libraryName,'.so'.
   221         ].
   222         ((packageTargetDir / dllRelativePath) exists
   223         and:[ (dllSourceDir / dllRelativePath) fileSize = (packageTargetDir / dllRelativePath) fileSize
   224         and:[ (dllSourceDir / dllRelativePath) modificationTime < (packageTargetDir / dllRelativePath) modificationTime
   225         "/ and:[ (dllSourceDir / dllRelativePath) sameContentsAs:(packageTargetDir / dllRelativePath) ]
   226         ]]) ifFalse:[
   227             (packageTargetDir / dllRelativePath) directory recursiveMakeDirectory.
   228             (dllSourceDir / dllRelativePath) copyTo:(packageTargetDir / dllRelativePath).    
   229         ]
   230     ].
   231 !
   232 
   233 copyDirectory:relativepath
   234     "/ need rules in stx
   235     ((Smalltalk projectDirectoryForPackage:'stx') asFilename construct:relativepath)
   236         recursiveCopyTo:(buildDirectory construct:'stx').
   237 !
   238 
   239 copyDirectoryForBuild:subdir
   240     |targetDir targetFile|
   241 
   242     targetDir := buildDirectory / 'stx' / subdir.
   243     targetDir exists ifFalse:[
   244         targetDir makeDirectory.
   245     ].
   246     (mySTXTopDirectory / subdir) directoryContentsAsFilenamesDo:[:eachFile |
   247         eachFile isDirectory ifFalse:[
   248             targetFile := targetDir / eachFile baseName.
   249             (targetFile exists not
   250             or:[ targetFile modificationTime < eachFile modificationTime ]) ifTrue:[
   251                 self activityNotification:'copying ',eachFile pathName,'...'.
   252                 eachFile copyTo:(targetDir construct:eachFile baseName)
   253             ]
   254         ].
   255     ].
   256     self activityNotification:nil
   257 !
   258 
   259 copyResourcesForPackage:aPackage
   260     |module directory|
   261 
   262     module := aPackage asPackageId module.
   263     directory := aPackage asPackageId directory.
   264 
   265     (myTopDirectory / module / directory / 'resources' ) exists ifTrue:[
   266         (myTopDirectory / module / directory / 'resources' )
   267             recursiveCopyTo:(buildDirectory / module / directory)
   268     ].
   269     (myTopDirectory / module / directory / 'styles' ) exists ifTrue:[
   270         (myTopDirectory / module / directory / 'styles' )
   271             recursiveCopyTo:(buildDirectory / module / directory)
   272     ].
   273 !
   274 
   275 copySTCDirectoryForBuild
   276     |targetDir stc files|
   277 
   278     targetDir := buildDirectory / 'stx' / 'stc'.
   279     targetDir exists ifFalse:[ targetDir makeDirectory ].
   280 
   281     stc := OperatingSystem isMSWINDOWSlike 
   282                 ifTrue:[ 'stc.exe' ]
   283                 ifFalse:[ 'stc' ].
   284 
   285     files := #( ) copyWith:stc.
   286 
   287     files do:[:eachFile |
   288         |sourceFile targetFile|
   289 
   290         sourceFile := mySTXTopDirectory / 'stc' / eachFile.
   291         targetFile := targetDir / eachFile.
   292         (targetFile exists not
   293         or:[ targetFile modificationTime < sourceFile modificationTime ]) ifTrue:[
   294             self activityNotification:'copying ',sourceFile pathName,'...'.
   295             sourceFile copyTo:targetFile
   296         ].
   297     ].
   298     self activityNotification:nil
   299 !
   300 
   301 copyStartupFilesFromSmalltalk
   302     (buildDirectory / 'stx' / 'projects/smalltalk' ) exists ifFalse:[
   303         (buildDirectory / 'stx' / 'projects/smalltalk' ) recursiveMakeDirectory.
   304     ].
   305 
   306     #( 
   307         'keyboard.rc' 
   308         'keyboardMacros.rc' 
   309         'display.rc' 
   310         'd_win32.rc'
   311         'host.rc' 
   312         'h_win32.rc'  
   313         'smalltalk.rc'  
   314         'private.rc'  
   315     ) do:[:fn |
   316         (myTopDirectory / 'stx' / 'projects/smalltalk' / fn)
   317             copyTo: (buildDirectory / 'stx' / 'projects/smalltalk' / fn)
   318     ].
   319 
   320     (myTopDirectory / 'stx' / 'doc/online/english/LICENCE_STX.html')
   321             copyTo: (buildDirectory / 'stx' / 'projects/smalltalk' / 'LICENCE_STX.html').
   322 !
   323 
   324 copySupportFilesForLinkage
   325     |files|
   326 
   327     OperatingSystem isMSWINDOWSlike ifTrue:[
   328         files := #( 
   329                     'support/win32/borland/cs3245.dll' 
   330                     'support/win32/X11.dll'
   331                     'support/win32/Xext.dll'
   332                     'librun/librun.dll'
   333                     'libbc/librun.lib'
   334                     'libbc/cs32i.lib'
   335                     'librun/genDate.exe'
   336                     'librun/main.c'
   337                     'projects/smalltalk/stx_16x16.ico'
   338                     'projects/smalltalk/stx_32x32.ico'
   339                     'projects/smalltalk/stx_splash.bmp'
   340                  ).
   341     ] ifFalse:[
   342         files := #(
   343                     'librun/genDate'
   344                     'librun/main.c'
   345                     'librun/librun.so'
   346                 )
   347     ].
   348     files := files asOrderedCollection.
   349 
   350     OperatingSystem isMSWINDOWSlike ifTrue:[
   351         projectDefinitionClass applicationIconFileName notNil ifTrue:[
   352             files add:('projects/smalltalk/',projectDefinitionClass applicationIconFileName,'.ico')
   353         ].
   354         projectDefinitionClass splashFileName notNil ifTrue:[
   355             files add:('projects/smalltalk/',projectDefinitionClass splashFileName,'.bmp')
   356         ].
   357     ].
   358 
   359     files do:[:dllRelativePath |
   360         ((buildDirectory / 'stx' / dllRelativePath) exists
   361         and:[ (mySTXTopDirectory / dllRelativePath) fileSize = (buildDirectory / 'stx' / dllRelativePath) fileSize
   362         and:[ (mySTXTopDirectory / dllRelativePath) modificationTime < (buildDirectory / 'stx' / dllRelativePath) modificationTime
   363         "/ and:[ (mySTXTopDirectory / dllRelativePath) sameContentsAs:(targetBuildDir / dllRelativePath) ]
   364         ]]) ifFalse:[
   365             (buildDirectory / 'stx' / dllRelativePath) directory recursiveMakeDirectory.
   366             (mySTXTopDirectory / dllRelativePath) copyTo:(buildDirectory / 'stx' / dllRelativePath).    
   367         ]
   368     ].
   369 !
   370 
   371 createHeaderFileFor:aClass in:packageTargetDir
   372     |instVarList classInstVarList classVarList bindings superclassFilename
   373      template file newContents oldContents|
   374 
   375     instVarList := StringCollection new.
   376     aClass instVarNames do:[:v |
   377         instVarList add:('OBJ %1;' bindWith:v)
   378     ].
   379     classInstVarList := StringCollection new.
   380     aClass class instVarNames do:[:v |
   381 (v includes:$_) ifTrue:[self halt].
   382         classInstVarList add:('OBJ %1;' bindWith:v)
   383     ].
   384     classVarList := StringCollection new.
   385     aClass classVarNames do:[:v |
   386         classVarList add:('extern OBJ %1_%2;' bindWith:aClass name with:v)
   387     ].
   388 
   389     bindings := Dictionary new.
   390     bindings at:'ClassName' put:aClass name. 
   391     aClass superclass isNil ifTrue:[
   392         bindings at:'SuperclassName' put:'-'. 
   393         bindings at:'SuperclassFileInclude' put:nil.
   394     ] ifFalse:[
   395         bindings at:'SuperclassName' put:aClass superclass name. 
   396         bindings at:'SuperclassFileName' put:(superclassFilename := Smalltalk fileNameForClass:aClass superclass).
   397         bindings at:'SuperclassFileInclude' put:('#include "%1.STH"' bindWith:superclassFilename).
   398     ].
   399     bindings at:'InstVarList' put:instVarList asString. 
   400     bindings at:'ClassVarList' put:classVarList asString. 
   401     bindings at:'ClassInstVarList' put:classInstVarList asString. 
   402 
   403     template := 
   404 '/* This file was generated by ProjectBuilder. */
   405 /* !!!!!!!! Do not change by hand !!!!!!!! */
   406 
   407 /* Class: %(ClassName) */
   408 /* Superclass: %(SuperclassName) */
   409 
   410 %(SuperclassFileInclude)
   411 
   412 /* INDIRECTGLOBALS */
   413 #ifdef _HEADER_INST_
   414 %(InstVarList)
   415 #endif /* _HEADER_INST_ */
   416 
   417 #ifdef _HEADER_CLASS_
   418 %(ClassVarList)
   419 #endif /* _HEADER_CLASS_ */
   420 
   421 #ifdef _HEADER_CLASSINST_
   422 %(ClassInstVarList)
   423 #endif /* _HEADER_CLASSINST_ */
   424 '.
   425     newContents := template bindWithArguments:bindings.
   426     file := packageTargetDir asFilename / ((Smalltalk fileNameForClass:aClass),'.STH').
   427     (file exists not
   428     or:[ (oldContents := file contents) ~= newContents ]) ifTrue:[
   429         file contents: newContents.
   430     ].
   431 !
   432 
   433 generateSourceFiles
   434     sourceCodeManager notNil ifTrue:[
   435         "/ check out / generate files there
   436         self generateSourceFilesByCheckingOutUsing:sourceCodeManager
   437     ] ifFalse:[
   438         "/ local build
   439         "/ fileout the project
   440         self generateSourceFilesByFilingOut
   441     ]
   442 !
   443 
   444 generateSourceFilesByCheckingOutUsing:aSourceCodeManager
   445     "/ will no longer be needed/supported
   446 
   447     |repository stxRepository module directory|
   448 
   449 self halt.
   450     "/ check out / generate files there
   451     repository := (aSourceCodeManager repositoryNameForModule:module) ifNil:[aSourceCodeManager repositoryName].
   452     stxRepository := aSourceCodeManager repositoryName.
   453 
   454     (buildDirectory construct:'stx') exists ifFalse:[
   455         (module ~= 'stx') ifTrue:[
   456             OperatingSystem
   457                 executeCommand:('cvs -d ',stxRepository,' co stx')
   458                 inputFrom:nil
   459                 outputTo:Transcript
   460                 errorTo:Transcript
   461                 inDirectory:buildDirectory
   462                 onError:[:status| self error:'cvs update stx failed'].
   463         ].
   464     ].
   465 
   466     ((buildDirectory construct:module) construct:'CVS') exists ifFalse:[
   467         OperatingSystem
   468             executeCommand:('cvs -d ',repository,' co -l ',directory)
   469             inputFrom:nil
   470             outputTo:Transcript
   471             errorTo:Transcript
   472             inDirectory:buildDirectory
   473             onError:[:status| self error:'cvs update failed'].
   474     ].
   475     OperatingSystem
   476         executeCommand:'cvs upd -d'
   477         inputFrom:nil
   478         outputTo:Transcript
   479         errorTo:Transcript
   480         inDirectory:(buildDirectory construct:module)
   481         onError:[:status| self error:'cvs update failed'].
   482 self halt.
   483 !
   484 
   485 generateSourceFilesByFilingOut
   486     "/ local build
   487     "/ fileout the project
   488 
   489     (package module ~= 'stx') ifTrue:[
   490         (buildDirectory / package module) makeDirectory.
   491     ].
   492 
   493     "/ file out the package(s) which are to be built
   494     ((Array with:package))
   495     do:[:eachPackageToFileout |
   496         |packageId packageModule packageDirectory packageTargetDir packageDef|
   497 
   498         packageId := eachPackageToFileout asPackageId.
   499         packageModule := packageId module.
   500         packageDirectory := packageId directory.
   501         packageTargetDir := (buildDirectory / packageModule / packageDirectory) recursiveMakeDirectory.
   502 
   503         packageDef := packageId projectDefinitionClass.
   504         (packageDef compiled_classNames_common ,
   505         packageDef compiled_classNamesForPlatform) do:[:eachClassName |
   506             |cls fileName newSource|
   507 
   508             cls := Smalltalk classNamed:eachClassName.
   509             self assert:cls isLoaded.
   510             fileName := (Smalltalk fileNameForClass:cls),'.st'.
   511             fileName := packageTargetDir asFilename construct:fileName.
   512             fileName exists ifTrue:[
   513                 newSource := String streamContents:[:s | cls fileOutOn:s withTimeStamp:false].
   514                 newSource = fileName contentsAsString ifFalse:[
   515                     fileName contents:newSource
   516                 ].
   517             ] ifFalse:[
   518                 cls fileOutIn:packageTargetDir withTimeStamp:false
   519             ].
   520         ].
   521 
   522 "/        (Smalltalk allClassesInPackage:eachPackageToFileout) do:[:cls |
   523 "/            cls isPrivate ifFalse:[
   524 "/                cls isLoaded ifFalse:[
   525 "/                    self halt.
   526 "/                    cls autoload.
   527 "/                ].
   528 "/                cls fileOutIn:packageTargetDir
   529 "/            ]
   530 "/        ].
   531 
   532         projectDefinitionClass forEachFileNameAndGeneratedContentsDo:[:fileName :fileContents |
   533             ((packageTargetDir / fileName) exists
   534             and:[ (packageTargetDir / fileName) contents = fileContents ]) ifFalse:[
   535                 (packageTargetDir / fileName) contents:fileContents.
   536             ].
   537         ].    
   538     ].
   539 
   540     "/ generate header files in prerequisite packages...
   541     (projectDefinitionClass allPreRequisites)
   542     do:[:eachPackageToFileout |
   543         |packageId packageDef packageModule packageDirectory packageTargetDir|
   544 
   545         packageId := eachPackageToFileout asPackageId.
   546         packageModule := packageId module.
   547         packageDirectory := packageId directory.
   548         packageTargetDir := (buildDirectory / packageModule / packageDirectory) recursiveMakeDirectory.
   549 
   550         packageDef := packageId projectDefinitionClass.
   551         (packageDef compiled_classNames_common ,
   552         packageDef compiled_classNamesForPlatform) do:[:eachClassName |
   553             |cls|
   554 
   555             cls := Smalltalk classNamed:eachClassName.
   556             "/ self assert:cls isLoaded.
   557             cls isLoaded ifTrue:[    
   558                 self createHeaderFileFor:cls in:packageTargetDir
   559             ].
   560         ].
   561         self copyResourcesForPackage:eachPackageToFileout.
   562     ].
   563 
   564 "/    stx_libbasic2 preRequisitesForBuilding#(#'stx:libbasic')
   565 !
   566 
   567 makeWithOutputTo:stdOut errorTo:stdErr
   568     |module directory|
   569 
   570     module := package module.
   571     directory := package directory.
   572 
   573     projectDefinitionClass isLibraryDefinition ifTrue:[
   574         OperatingSystem
   575             executeCommand:(ParserFlags makeCommand,' classLibRule')
   576             inputFrom:nil
   577             outputTo:stdOut
   578             errorTo:stdErr
   579             inDirectory:(buildDirectory / module / directory)
   580             onError:[:status| self error:'make failed'].
   581     ] ifFalse:[
   582         OperatingSystem
   583             executeCommand:(ParserFlags makeCommand,' exe')
   584             inputFrom:nil
   585             outputTo:stdOut
   586             errorTo:stdErr
   587             inDirectory:(buildDirectory / module / directory)
   588             onError:[:status| self error:'make failed'].
   589 
   590         (makeExeOnly ? false) ifFalse:[
   591             OperatingSystem
   592                 executeCommand:(ParserFlags makeCommand,' setup')
   593                 inputFrom:nil
   594                 outputTo:stdOut
   595                 errorTo:stdErr
   596                 inDirectory:(buildDirectory / module / directory)
   597                 onError:[:status| self error:'make failed'].
   598         ]
   599     ]
   600 !
   601 
   602 setupBuildDirectory
   603     buildDirectory exists ifFalse:[
   604         buildDirectory recursiveMakeDirectory.
   605     ].
   606     (buildDirectory / 'stx') exists ifFalse:[
   607         (buildDirectory / 'stx') makeDirectory.
   608     ].
   609 
   610     self copyDirectoryForBuild:'include'.
   611     self copyDirectoryForBuild:'rules'.
   612 !
   613 
   614 validateBuildDirectoryIsPresent
   615 
   616     ^ self.
   617 
   618 "/    [
   619 "/        |default directoryIsOKForMe stc |
   620 "/
   621 "/        default := (buildDirectory ?
   622 "/                          PreviousBuildDirectory)
   623 "/                          ifNil:[ UserPreferences current buildDirectory].
   624 "/
   625 "/        buildDirectory := Dialog requestDirectoryName:'Temporary Work-ROOT for build:'
   626 "/                                 default:default.
   627 "/
   628 "/        buildDirectory isEmptyOrNil ifTrue:[^ self].
   629 "/        buildDirectory := buildDirectory asFilename.
   630 "/        directoryIsOKForMe := true.
   631 "/
   632 "/        buildDirectory exists ifFalse:[
   633 "/            Dialog warn:(self classResources string:'Work directory %1 does not exist.' with:buildDirectory).
   634 "/            directoryIsOKForMe := false.
   635 "/        ] ifTrue:[
   636 "/            (buildDirectory construct:'stx') exists ifFalse:[
   637 "/                Dialog warn:(self classResources stringWithCRs:'Work directory must contain an stx subDirectory,\which contains (at least) the stc and include subdirectories.').
   638 "/                directoryIsOKForMe := false.
   639 "/            ] ifTrue:[
   640 "/                stc := (OperatingSystem isMSDOSlike) ifTrue:['stc.exe'] ifFalse:['stc'].
   641 "/                (((buildDirectory construct:'stx')construct:'stc')construct:stc) exists ifFalse:[
   642 "/                    Dialog warn:(self classResources stringWithCRs:'Work directory must contain an stc compiler in the stx/stc subDirectory.').
   643 "/                    directoryIsOKForMe := false.
   644 "/                ].
   645 "/                ((buildDirectory construct:'stx')construct:'include') exists ifFalse:[
   646 "/                    Dialog warn:(self classResources stringWithCRs:'Work directory must have had a make run before (for include files to exists).').
   647 "/                    directoryIsOKForMe := false.
   648 "/                ].
   649 "/            ]
   650 "/        ].
   651 "/        directoryIsOKForMe
   652 "/    ] whileFalse
   653 ! !
   654 
   655 !ProjectBuilder class methodsFor:'documentation'!
   656 
   657 version_CVS
   658     ^ '$Header$'
   659 ! !