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