oops
authorClaus Gittinger <cg@exept.de>
Tue, 20 Oct 2009 22:46:36 +0200
changeset 2644428bb83dd360
parent 2643 dbfb457033ff
child 2645 8c2aab033e84
oops
ProjectBuilder.st
     1.1 --- a/ProjectBuilder.st	Tue Oct 20 22:39:17 2009 +0200
     1.2 +++ b/ProjectBuilder.st	Tue Oct 20 22:46:36 2009 +0200
     1.3 @@ -23,96 +23,90 @@
     1.4  
     1.5  !ProjectBuilder class methodsFor:'examples'!
     1.6  
     1.7 +example1
     1.8 +    Smalltalk loadPackage:'stx:projects/helloWorldApp' asAutoloaded:true.
     1.9 +
    1.10 +    self new
    1.11 +        package:'stx:projects/helloWorldApp';
    1.12 +        build
    1.13  !
    1.14  
    1.15 -methodsFor:'examples'
    1.16 +example2
    1.17 +    |builder|
    1.18 +
    1.19 +    Smalltalk loadPackage:'stx:clients/Demos/foxCalcApplication' asAutoloaded:true.
    1.20 +
    1.21 +    builder := self new.
    1.22 +    builder package:'stx:clients/Demos/foxCalcApplication'.
    1.23 +    builder build.
    1.24 +
    1.25 +    UserPreferences fileBrowserClass openOnDirectory:builder packageBuildDirectory.
    1.26  ! !
    1.27  
    1.28  !ProjectBuilder methodsFor:'accessing'!
    1.29  
    1.30 -ileBrowserClass openOnDirectory:builder packageBuildDirectory.
    1.31 +buildDirectory
    1.32 +    ^ buildDirectory
    1.33  !
    1.34  
    1.35  buildDirectory:something
    1.36      buildDirectory := something.
    1.37  !
    1.38  
    1.39 -kageBuildDirectory.
    1.40 +package:aPackageIDOrSymbol
    1.41 +    package := aPackageIDOrSymbol asPackageId.
    1.42  !
    1.43  
    1.44 -he directoray, where the deployable binary is created (xxxSetup.exe)"
    1.45 +packageBuildDirectory
    1.46 +    "the directoray, where the deployable binary is created (xxxSetup.exe)"
    1.47  
    1.48      ^ buildDirectory / (package asPackageId module) / (package asPackageId directory)
    1.49  !
    1.50  
    1.51 -'building'
    1.52 +projectDefinitionClass:something
    1.53 +    projectDefinitionClass := something.
    1.54  ! !
    1.55  
    1.56  !ProjectBuilder methodsFor:'building'!
    1.57  
    1.58 -"/ intermediate - this will move into a commonly used utility class
    1.59 +build
    1.60 +    "/ intermediate - this will move into a commonly used utility class
    1.61      "/ (where all the project code support will be collected).
    1.62  
    1.63 -    |module directory|
    1.64 +    |makeOutput stdOut stdErr lock|
    1.65  
    1.66 -    projectDefinitionClass := ProjectDefinition definitionClassForPackage:package.
    1.67 -    projectDefinitionClass isNil ifTrue:[
    1.68 -        self error:('Missing ProjectDefinition class for "',package asString,'"')
    1.69 -    ].
    1.70 +    lock := Semaphore forMutualExclusion.
    1.71 +    makeOutput := TextStream on:(Text new:10000).
    1.72 +    stdErr := ActorStream new
    1.73 +                    nextPutBlock:[:char |
    1.74 +                        lock critical:[
    1.75 +                            makeOutput emphasis:{#backgroundColor->Color red. #color->Color white.}.
    1.76 +                            makeOutput nextPut:char.
    1.77 +                            makeOutput emphasis:nil.
    1.78 +                        ]
    1.79 +                    ];
    1.80 +                    nextPutAllBlock:[:char |
    1.81 +                        lock critical:[
    1.82 +                            makeOutput emphasis:{#backgroundColor->Color red. #color->Color white.}.
    1.83 +                            makeOutput nextPutAll:char.
    1.84 +                            makeOutput emphasis:nil.
    1.85 +                        ]
    1.86 +                    ].
    1.87 +    stdOut := ActorStream new
    1.88 +                    nextPutBlock:[:char |
    1.89 +                        lock critical:[
    1.90 +                            makeOutput nextPut:char.
    1.91 +                        ]
    1.92 +                    ];
    1.93 +                    nextPutAllBlock:[:char |
    1.94 +                        lock critical:[
    1.95 +                            makeOutput nextPutAll:char.
    1.96 +                        ]
    1.97 +                    ].
    1.98  
    1.99 -    "/ ensure that everything is loaded...
   1.100 -    projectDefinitionClass loadAsAutoloaded:false.
   1.101 -    projectDefinitionClass loadExtensions.
   1.102 -    projectDefinitionClass loadAllClassesAsAutoloaded:false.
   1.103 +    self buildWithOutputTo:stdOut errorTo:stdErr.
   1.104  
   1.105 -    module := package module.
   1.106 -    directory := package directory.
   1.107 -
   1.108 -    buildDirectory isNil ifTrue:[
   1.109 -        buildDirectory := PreviousBuildDirectory ifNil:[ UserPreferences current buildDirectory ].
   1.110 -        buildDirectory isNil ifTrue:[
   1.111 -            buildDirectory := Filename tempDirectory construct:'stx_build'.
   1.112 -        ].
   1.113 -    ].
   1.114 -    buildDirectory := buildDirectory asFilename.
   1.115 -
   1.116 -    "/ self validateBuildDirectoryIsPresent.
   1.117 -
   1.118 -    PreviousBuildDirectory := buildDirectory.
   1.119 -
   1.120 -    "/ UserPreferences current localBuild:true
   1.121 -    UserPreferences current localBuild ifFalse:[
   1.122 -        SourceCodeManager notNil ifTrue:[
   1.123 -            sourceCodeManager := SourceCodeManagerUtilities sourceCodeManagerFor:projectDefinitionClass.
   1.124 -        ]
   1.125 -    ].
   1.126 -    sourceCodeManager := nil.
   1.127 -
   1.128 -    myTopDirectory := 
   1.129 -        Smalltalk packagePath 
   1.130 -            detect:[:aPath |
   1.131 -                (aPath asFilename / 'stx' / 'include') exists
   1.132 -                and: [ (aPath asFilename / 'stx' / 'rules') exists ]]
   1.133 -            ifNone:nil.       
   1.134 -    myTopDirectory isNil ifTrue:[
   1.135 -        self error:('Cannot figure out my top directory (where stx/include and stx/rules are)')
   1.136 -    ].
   1.137 -    myTopDirectory := myTopDirectory asFilename.
   1.138 -    mySTXTopDirectory := myTopDirectory / 'stx'.
   1.139 -
   1.140 -    self setupBuildDirectory.
   1.141 -    self activityNotification:'Generating stc directory...'.
   1.142 -    self copySTCDirectoryForBuild.
   1.143 -    self activityNotification:'Generating source files...'.
   1.144 -    self generateSourceFiles.
   1.145 -    self activityNotification:'Generating dlls for linkage...'.
   1.146 -    self copyDLLsForLinkage.
   1.147 -    self activityNotification:'Generating support files for linkage...'.
   1.148 -    self copySupportFilesForLinkage.
   1.149 -    self copyStartupFilesFromSmalltalk.
   1.150 -
   1.151 -    self activityNotification:'Executing make...'.
   1.152 -    self makeWithOutputTo:stdOut errorTo:stdErr.
   1.153 +    TextView openWith:makeOutput contents.
   1.154  !
   1.155  
   1.156  buildWithOutputTo:stdOut errorTo:stdErr
   1.157 @@ -181,35 +175,441 @@
   1.158      self makeWithOutputTo:stdOut errorTo:stdErr.
   1.159  !
   1.160  
   1.161 -lRelativePath).    
   1.162 +copyDLLsForLinkage
   1.163 +    |targetBuildDir|
   1.164 +
   1.165 +    targetBuildDir := buildDirectory / package module / package directory.
   1.166 +
   1.167 +    (projectDefinitionClass allPreRequisites)
   1.168 +    do:[:eachPackageToFileout |
   1.169 +        |packageId packageDef packageModule packageDirectory packageTargetDir
   1.170 +         dllSource dllSourceDir libraryName dllRelativePath|
   1.171 +
   1.172 +        packageId := eachPackageToFileout asPackageId.
   1.173 +        packageModule := packageId module.
   1.174 +        packageDirectory := packageId directory.
   1.175 +        packageTargetDir := (buildDirectory / packageModule / packageDirectory) recursiveMakeDirectory.
   1.176 +
   1.177 +        packageDef := packageId projectDefinitionClass.
   1.178 +        libraryName := packageDef libraryName.
   1.179 +
   1.180 +        "/ mhmh - take them from my tree or from the projects/smalltalk execution directory ??
   1.181 +        dllSourceDir := myTopDirectory / packageModule / packageDirectory.
   1.182 +        OperatingSystem isMSWINDOWSlike ifTrue:[
   1.183 +"/            dllRelativePath := 'objvc','/',(libraryName,'.dll').
   1.184 +"/            (dllSourceDir / dllRelativePath) exists 
   1.185 +            false ifFalse:[
   1.186 +                dllRelativePath := 'objbc','/',(libraryName,'.dll').
   1.187 +            ]
   1.188 +        ] ifFalse:[
   1.189 +            dllRelativePath := libraryName,'.so'.
   1.190 +        ].
   1.191 +        ((packageTargetDir / dllRelativePath) exists
   1.192 +        and:[ (dllSourceDir / dllRelativePath) fileSize = (packageTargetDir / dllRelativePath) fileSize
   1.193 +        and:[ (dllSourceDir / dllRelativePath) modificationTime < (packageTargetDir / dllRelativePath) modificationTime
   1.194 +        "/ and:[ (dllSourceDir / dllRelativePath) sameContentsAs:(packageTargetDir / dllRelativePath) ]
   1.195 +        ]]) ifFalse:[
   1.196 +            (packageTargetDir / dllRelativePath) directory recursiveMakeDirectory.
   1.197 +            (dllSourceDir / dllRelativePath) copyTo:(packageTargetDir / dllRelativePath).    
   1.198          ]
   1.199      ].
   1.200  !
   1.201  
   1.202 +copyDirectory:relativepath
   1.203 +    "/ need rules in stx
   1.204 +    ((Smalltalk projectDirectoryForPackage:'stx') asFilename construct:relativepath)
   1.205 +        recursiveCopyTo:(buildDirectory construct:'stx').
   1.206  !
   1.207  
   1.208 +copyDirectoryForBuild:subdir
   1.209 +    |targetDir targetFile|
   1.210 +
   1.211 +    targetDir := buildDirectory / 'stx' / subdir.
   1.212 +    targetDir exists ifFalse:[
   1.213 +        targetDir makeDirectory.
   1.214 +    ].
   1.215 +    (mySTXTopDirectory / subdir) directoryContentsAsFilenamesDo:[:eachFile |
   1.216 +        eachFile isDirectory ifFalse:[
   1.217 +            targetFile := targetDir / eachFile baseName.
   1.218 +            (targetFile exists not
   1.219 +            or:[ targetFile modificationTime < eachFile modificationTime ]) ifTrue:[
   1.220 +                self activityNotification:'copying ',eachFile pathName,'...'.
   1.221 +                eachFile copyTo:(targetDir construct:eachFile baseName)
   1.222 +            ]
   1.223 +        ].
   1.224 +    ].
   1.225 +    self activityNotification:nil
   1.226  !
   1.227  
   1.228 +copyResourcesForPackage:aPackage
   1.229 +    |module directory|
   1.230 +
   1.231 +    module := aPackage asPackageId module.
   1.232 +    directory := aPackage asPackageId directory.
   1.233 +
   1.234 +    (myTopDirectory / module / directory / 'resources' ) exists ifTrue:[
   1.235 +        (myTopDirectory / module / directory / 'resources' )
   1.236 +            recursiveCopyTo:(buildDirectory / module / directory)
   1.237 +    ].
   1.238 +    (myTopDirectory / module / directory / 'styles' ) exists ifTrue:[
   1.239 +        (myTopDirectory / module / directory / 'styles' )
   1.240 +            recursiveCopyTo:(buildDirectory / module / directory)
   1.241 +    ].
   1.242  !
   1.243  
   1.244 +copySTCDirectoryForBuild
   1.245 +    |targetDir stc files|
   1.246 +
   1.247 +    targetDir := buildDirectory / 'stx' / 'stc'.
   1.248 +    targetDir exists ifFalse:[ targetDir makeDirectory ].
   1.249 +
   1.250 +    stc := OperatingSystem isMSWINDOWSlike 
   1.251 +                ifTrue:[ 'stc.exe' ]
   1.252 +                ifFalse:[ 'stc' ].
   1.253 +
   1.254 +    files := #( ) copyWith:stc.
   1.255 +
   1.256 +    files do:[:eachFile |
   1.257 +        |sourceFile targetFile|
   1.258 +
   1.259 +        sourceFile := mySTXTopDirectory / 'stc' / eachFile.
   1.260 +        targetFile := targetDir / eachFile.
   1.261 +        (targetFile exists not
   1.262 +        or:[ targetFile modificationTime < sourceFile modificationTime ]) ifTrue:[
   1.263 +            self activityNotification:'copying ',sourceFile pathName,'...'.
   1.264 +            sourceFile copyTo:targetFile
   1.265 +        ].
   1.266 +    ].
   1.267 +    self activityNotification:nil
   1.268  !
   1.269  
   1.270 +copyStartupFilesFromSmalltalk
   1.271 +    (buildDirectory / 'stx' / 'projects/smalltalk' ) exists ifFalse:[
   1.272 +        (buildDirectory / 'stx' / 'projects/smalltalk' ) recursiveMakeDirectory.
   1.273 +    ].
   1.274 +
   1.275 +    #( 'keyboard.rc' 'keyboardMacros.rc' 'display.rc' 'd_win32.rc'
   1.276 +       'host.rc' 'h_win32.rc'  
   1.277 +    ) do:[:fn |
   1.278 +        (myTopDirectory / 'stx' / 'projects/smalltalk' / fn)
   1.279 +            copyTo: (buildDirectory / 'stx' / 'projects/smalltalk' / fn)
   1.280 +    ]
   1.281  !
   1.282  
   1.283 +copySupportFilesForLinkage
   1.284 +    |files|
   1.285 +
   1.286 +    OperatingSystem isMSWINDOWSlike ifTrue:[
   1.287 +        files := #( 
   1.288 +                    'support/win32/borland/cs3245.dll' 
   1.289 +                    'support/win32/X11.dll'
   1.290 +                    'support/win32/Xext.dll'
   1.291 +                    'librun/librun.dll'
   1.292 +                    'libbc/librun.lib'
   1.293 +                    'libbc/cs32i.lib'
   1.294 +                    'librun/genDate.exe'
   1.295 +                    'librun/main.c'
   1.296 +                 ).
   1.297 +    ] ifFalse:[
   1.298 +        files := #(
   1.299 +                    'librun/genDate'
   1.300 +                    'librun/main.c'
   1.301 +                    'librun/librun.so'
   1.302 +                )
   1.303 +    ].
   1.304 +
   1.305 +    files do:[:dllRelativePath |
   1.306 +        ((buildDirectory / 'stx' / dllRelativePath) exists
   1.307 +        and:[ (mySTXTopDirectory / dllRelativePath) fileSize = (buildDirectory / 'stx' / dllRelativePath) fileSize
   1.308 +        and:[ (mySTXTopDirectory / dllRelativePath) modificationTime < (buildDirectory / 'stx' / dllRelativePath) modificationTime
   1.309 +        "/ and:[ (mySTXTopDirectory / dllRelativePath) sameContentsAs:(targetBuildDir / dllRelativePath) ]
   1.310 +        ]]) ifFalse:[
   1.311 +            (buildDirectory / 'stx' / dllRelativePath) directory recursiveMakeDirectory.
   1.312 +            (mySTXTopDirectory / dllRelativePath) copyTo:(buildDirectory / 'stx' / dllRelativePath).    
   1.313 +        ]
   1.314 +    ].
   1.315  !
   1.316  
   1.317 +createHeaderFileFor:aClass in:packageTargetDir
   1.318 +    |instVarList classInstVarList classVarList bindings superclassFilename
   1.319 +     template file newContents oldContents|
   1.320 +
   1.321 +    instVarList := StringCollection new.
   1.322 +    aClass instVarNames do:[:v |
   1.323 +        instVarList add:('OBJ %1;' bindWith:v)
   1.324 +    ].
   1.325 +    classInstVarList := StringCollection new.
   1.326 +    aClass class instVarNames do:[:v |
   1.327 +(v includes:$_) ifTrue:[self halt].
   1.328 +        classInstVarList add:('OBJ %1;' bindWith:v)
   1.329 +    ].
   1.330 +    classVarList := StringCollection new.
   1.331 +    aClass classVarNames do:[:v |
   1.332 +        classVarList add:('extern OBJ %1_%2;' bindWith:aClass name with:v)
   1.333 +    ].
   1.334 +
   1.335 +    bindings := Dictionary new.
   1.336 +    bindings at:'ClassName' put:aClass name. 
   1.337 +    aClass superclass isNil ifTrue:[
   1.338 +        bindings at:'SuperclassName' put:'-'. 
   1.339 +        bindings at:'SuperclassFileInclude' put:nil.
   1.340 +    ] ifFalse:[
   1.341 +        bindings at:'SuperclassName' put:aClass superclass name. 
   1.342 +        bindings at:'SuperclassFileName' put:(superclassFilename := Smalltalk fileNameForClass:aClass superclass).
   1.343 +        bindings at:'SuperclassFileInclude' put:('#include "%1.STH"' bindWith:superclassFilename).
   1.344 +    ].
   1.345 +    bindings at:'InstVarList' put:instVarList asString. 
   1.346 +    bindings at:'ClassVarList' put:classVarList asString. 
   1.347 +    bindings at:'ClassInstVarList' put:classInstVarList asString. 
   1.348 +
   1.349 +    template := 
   1.350 +'/* This file was generated by ProjectBuilder. */
   1.351 +/* !!!!!!!! Do not change by hand !!!!!!!! */
   1.352 +
   1.353 +/* Class: %(ClassName) */
   1.354 +/* Superclass: %(SuperclassName) */
   1.355 +
   1.356 +%(SuperclassFileInclude)
   1.357 +
   1.358 +/* INDIRECTGLOBALS */
   1.359 +#ifdef _HEADER_INST_
   1.360 +%(InstVarList)
   1.361 +#endif /* _HEADER_INST_ */
   1.362 +
   1.363 +#ifdef _HEADER_CLASS_
   1.364 +%(ClassVarList)
   1.365 +#endif /* _HEADER_CLASS_ */
   1.366 +
   1.367 +#ifdef _HEADER_CLASSINST_
   1.368 +%(ClassInstVarList)
   1.369 +#endif /* _HEADER_CLASSINST_ */
   1.370 +'.
   1.371 +    newContents := template bindWithArguments:bindings.
   1.372 +    file := packageTargetDir asFilename / ((Smalltalk fileNameForClass:aClass),'.STH').
   1.373 +    (file exists not
   1.374 +    or:[ (oldContents := file contents) ~= newContents ]) ifTrue:[
   1.375 +        file contents: newContents.
   1.376 +    ].
   1.377  !
   1.378  
   1.379 +generateSourceFiles
   1.380 +    sourceCodeManager notNil ifTrue:[
   1.381 +        "/ check out / generate files there
   1.382 +        self generateSourceFilesByCheckingOutUsing:sourceCodeManager
   1.383 +    ] ifFalse:[
   1.384 +        "/ local build
   1.385 +        "/ fileout the project
   1.386 +        self generateSourceFilesByFilingOut
   1.387 +    ]
   1.388  !
   1.389  
   1.390 +generateSourceFilesByCheckingOutUsing:aSourceCodeManager
   1.391 +    "/ will no longer be needed/supported
   1.392 +
   1.393 +    |repository stxRepository module directory|
   1.394 +
   1.395 +self halt.
   1.396 +    "/ check out / generate files there
   1.397 +    repository := (aSourceCodeManager repositoryNameForModule:module) ifNil:[aSourceCodeManager repositoryName].
   1.398 +    stxRepository := aSourceCodeManager repositoryName.
   1.399 +
   1.400 +    (buildDirectory construct:'stx') exists ifFalse:[
   1.401 +        (module ~= 'stx') ifTrue:[
   1.402 +            OperatingSystem
   1.403 +                executeCommand:('cvs -d ',stxRepository,' co stx')
   1.404 +                inputFrom:nil
   1.405 +                outputTo:Transcript
   1.406 +                errorTo:Transcript
   1.407 +                inDirectory:buildDirectory
   1.408 +                onError:[:status| self error:'cvs update stx failed'].
   1.409 +        ].
   1.410 +    ].
   1.411 +
   1.412 +    ((buildDirectory construct:module) construct:'CVS') exists ifFalse:[
   1.413 +        OperatingSystem
   1.414 +            executeCommand:('cvs -d ',repository,' co -l ',directory)
   1.415 +            inputFrom:nil
   1.416 +            outputTo:Transcript
   1.417 +            errorTo:Transcript
   1.418 +            inDirectory:buildDirectory
   1.419 +            onError:[:status| self error:'cvs update failed'].
   1.420 +    ].
   1.421 +    OperatingSystem
   1.422 +        executeCommand:'cvs upd -d'
   1.423 +        inputFrom:nil
   1.424 +        outputTo:Transcript
   1.425 +        errorTo:Transcript
   1.426 +        inDirectory:(buildDirectory construct:module)
   1.427 +        onError:[:status| self error:'cvs update failed'].
   1.428 +self halt.
   1.429  !
   1.430  
   1.431 +generateSourceFilesByFilingOut
   1.432 +    "/ local build
   1.433 +    "/ fileout the project
   1.434 +
   1.435 +    (package module ~= 'stx') ifTrue:[
   1.436 +        (buildDirectory / package module) makeDirectory.
   1.437 +    ].
   1.438 +
   1.439 +    "/ file out the package(s) which are to be built
   1.440 +    ((Array with:package))
   1.441 +    do:[:eachPackageToFileout |
   1.442 +        |packageId packageModule packageDirectory packageTargetDir packageDef|
   1.443 +
   1.444 +        packageId := eachPackageToFileout asPackageId.
   1.445 +        packageModule := packageId module.
   1.446 +        packageDirectory := packageId directory.
   1.447 +        packageTargetDir := (buildDirectory / packageModule / packageDirectory) recursiveMakeDirectory.
   1.448 +
   1.449 +        packageDef := packageId projectDefinitionClass.
   1.450 +        (packageDef compiled_classNames_common ,
   1.451 +        packageDef compiled_classNamesForPlatform) do:[:eachClassName |
   1.452 +            |cls fileName newSource|
   1.453 +
   1.454 +            cls := Smalltalk classNamed:eachClassName.
   1.455 +            self assert:cls isLoaded.
   1.456 +            fileName := (Smalltalk fileNameForClass:cls),'.st'.
   1.457 +            fileName := packageTargetDir asFilename construct:fileName.
   1.458 +            fileName exists ifTrue:[
   1.459 +                newSource := String streamContents:[:s | cls fileOutOn:s withTimeStamp:false].
   1.460 +                newSource = fileName contentsAsString ifFalse:[
   1.461 +                    fileName contents:newSource
   1.462 +                ].
   1.463 +            ] ifFalse:[
   1.464 +                cls fileOutIn:packageTargetDir withTimeStamp:false
   1.465 +            ].
   1.466 +        ].
   1.467 +
   1.468 +"/        (Smalltalk allClassesInPackage:eachPackageToFileout) do:[:cls |
   1.469 +"/            cls isPrivate ifFalse:[
   1.470 +"/                cls isLoaded ifFalse:[
   1.471 +"/                    self halt.
   1.472 +"/                    cls autoload.
   1.473 +"/                ].
   1.474 +"/                cls fileOutIn:packageTargetDir
   1.475 +"/            ]
   1.476 +"/        ].
   1.477 +
   1.478 +        projectDefinitionClass forEachFileNameAndGeneratedContentsDo:[:fileName :fileContents |
   1.479 +            ((packageTargetDir / fileName) exists
   1.480 +            and:[ (packageTargetDir / fileName) contents = fileContents ]) ifFalse:[
   1.481 +                (packageTargetDir / fileName) contents:fileContents.
   1.482 +            ].
   1.483 +        ].    
   1.484 +    ].
   1.485 +
   1.486 +    "/ generate header files in prerequisite packages...
   1.487 +    (projectDefinitionClass allPreRequisites)
   1.488 +    do:[:eachPackageToFileout |
   1.489 +        |packageId packageDef packageModule packageDirectory packageTargetDir|
   1.490 +
   1.491 +        packageId := eachPackageToFileout asPackageId.
   1.492 +        packageModule := packageId module.
   1.493 +        packageDirectory := packageId directory.
   1.494 +        packageTargetDir := (buildDirectory / packageModule / packageDirectory) recursiveMakeDirectory.
   1.495 +
   1.496 +        packageDef := packageId projectDefinitionClass.
   1.497 +        (packageDef compiled_classNames_common ,
   1.498 +        packageDef compiled_classNamesForPlatform) do:[:eachClassName |
   1.499 +            |cls|
   1.500 +
   1.501 +            cls := Smalltalk classNamed:eachClassName.
   1.502 +            "/ self assert:cls isLoaded.
   1.503 +            cls isLoaded ifTrue:[    
   1.504 +                self createHeaderFileFor:cls in:packageTargetDir
   1.505 +            ].
   1.506 +        ].
   1.507 +        self copyResourcesForPackage:eachPackageToFileout.
   1.508 +    ].
   1.509 +
   1.510 +"/    stx_libbasic2 preRequisitesForBuilding#(#'stx:libbasic')
   1.511  !
   1.512  
   1.513 +makeWithOutputTo:stdOut errorTo:stdErr
   1.514 +    |module directory|
   1.515 +
   1.516 +    module := package module.
   1.517 +    directory := package directory.
   1.518 +
   1.519 +    projectDefinitionClass isLibraryDefinition ifTrue:[
   1.520 +        OperatingSystem
   1.521 +            executeCommand:(ParserFlags makeCommand,' classLibRule')
   1.522 +            inputFrom:nil
   1.523 +            outputTo:stdOut
   1.524 +            errorTo:stdErr
   1.525 +            inDirectory:(buildDirectory / module / directory)
   1.526 +            onError:[:status| self error:'make failed'].
   1.527 +    ] ifFalse:[
   1.528 +        OperatingSystem
   1.529 +            executeCommand:(ParserFlags makeCommand,' exe')
   1.530 +            inputFrom:nil
   1.531 +            outputTo:stdOut
   1.532 +            errorTo:stdErr
   1.533 +            inDirectory:(buildDirectory / module / directory)
   1.534 +            onError:[:status| self error:'make failed'].
   1.535 +
   1.536 +        OperatingSystem
   1.537 +            executeCommand:(ParserFlags makeCommand,' setup')
   1.538 +            inputFrom:nil
   1.539 +            outputTo:stdOut
   1.540 +            errorTo:stdErr
   1.541 +            inDirectory:(buildDirectory / module / directory)
   1.542 +            onError:[:status| self error:'make failed'].
   1.543 +    ]
   1.544  !
   1.545  
   1.546 +setupBuildDirectory
   1.547 +    buildDirectory exists ifFalse:[
   1.548 +        buildDirectory recursiveMakeDirectory.
   1.549 +    ].
   1.550 +    (buildDirectory / 'stx') exists ifFalse:[
   1.551 +        (buildDirectory / 'stx') makeDirectory.
   1.552 +    ].
   1.553 +
   1.554 +    self copyDirectoryForBuild:'include'.
   1.555 +    self copyDirectoryForBuild:'rules'.
   1.556  !
   1.557  
   1.558 +validateBuildDirectoryIsPresent
   1.559 +
   1.560 +    ^ self.
   1.561 +
   1.562 +"/    [
   1.563 +"/        |default directoryIsOKForMe stc |
   1.564 +"/
   1.565 +"/        default := (buildDirectory ?
   1.566 +"/                          PreviousBuildDirectory)
   1.567 +"/                          ifNil:[ UserPreferences current buildDirectory].
   1.568 +"/
   1.569 +"/        buildDirectory := Dialog requestDirectoryName:'Temporary Work-ROOT for build:'
   1.570 +"/                                 default:default.
   1.571 +"/
   1.572 +"/        buildDirectory isEmptyOrNil ifTrue:[^ self].
   1.573 +"/        buildDirectory := buildDirectory asFilename.
   1.574 +"/        directoryIsOKForMe := true.
   1.575 +"/
   1.576 +"/        buildDirectory exists ifFalse:[
   1.577 +"/            Dialog warn:(self classResources string:'Work directory %1 does not exist.' with:buildDirectory).
   1.578 +"/            directoryIsOKForMe := false.
   1.579 +"/        ] ifTrue:[
   1.580 +"/            (buildDirectory construct:'stx') exists ifFalse:[
   1.581 +"/                Dialog warn:(self classResources stringWithCRs:'Work directory must contain an stx subDirectory,\which contains (at least) the stc and include subdirectories.').
   1.582 +"/                directoryIsOKForMe := false.
   1.583 +"/            ] ifTrue:[
   1.584 +"/                stc := (OperatingSystem isMSDOSlike) ifTrue:['stc.exe'] ifFalse:['stc'].
   1.585 +"/                (((buildDirectory construct:'stx')construct:'stc')construct:stc) exists ifFalse:[
   1.586 +"/                    Dialog warn:(self classResources stringWithCRs:'Work directory must contain an stc compiler in the stx/stc subDirectory.').
   1.587 +"/                    directoryIsOKForMe := false.
   1.588 +"/                ].
   1.589 +"/                ((buildDirectory construct:'stx')construct:'include') exists ifFalse:[
   1.590 +"/                    Dialog warn:(self classResources stringWithCRs:'Work directory must have had a make run before (for include files to exists).').
   1.591 +"/                    directoryIsOKForMe := false.
   1.592 +"/                ].
   1.593 +"/            ]
   1.594 +"/        ].
   1.595 +"/        directoryIsOKForMe
   1.596 +"/    ] whileFalse
   1.597  ! !
   1.598  
   1.599  !ProjectBuilder class methodsFor:'documentation'!