ProjectBuilder.st
author Claus Gittinger <cg@exept.de>
Sat, 10 Oct 2009 17:57:31 +0200
changeset 2600 bfde5434dcdd
parent 2599 e8624fcf3c1b
child 2611 706991dee298
permissions -rw-r--r--
added:5 methods
changed:
#build
#generateSourceFilesByFilingOut
cg@2596
     1
"{ Package: 'stx:libtool2' }"
cg@2596
     2
cg@2596
     3
Object subclass:#ProjectBuilder
cg@2596
     4
	instanceVariableNames:'package projectDefinitionClass sourceCodeManager buildDirectory
cg@2598
     5
		myWorkingDirectory mySTXTopDirectory myTopDirectory'
cg@2596
     6
	classVariableNames:'PreviousBuildDirectory'
cg@2596
     7
	poolDictionaries:''
cg@2596
     8
	category:'System-Support-Projects'
cg@2596
     9
!
cg@2596
    10
cg@2596
    11
cg@2596
    12
!ProjectBuilder class methodsFor:'examples'!
cg@2596
    13
cg@2596
    14
example1
cg@2596
    15
    Smalltalk loadPackage:'stx:projects/helloWorldApp' asAutoloaded:true.
cg@2596
    16
cg@2596
    17
    self new
cg@2596
    18
        package:'stx:projects/helloWorldApp';
cg@2596
    19
        build
cg@2596
    20
! !
cg@2596
    21
cg@2596
    22
!ProjectBuilder methodsFor:'accessing'!
cg@2596
    23
cg@2596
    24
package:aPackageIDOrSymbol
cg@2596
    25
    package := aPackageIDOrSymbol asPackageId.
cg@2596
    26
!
cg@2596
    27
cg@2596
    28
projectDefinitionClass:something
cg@2596
    29
    projectDefinitionClass := something.
cg@2596
    30
! !
cg@2596
    31
cg@2596
    32
!ProjectBuilder methodsFor:'building'!
cg@2596
    33
cg@2596
    34
build
cg@2596
    35
    "/ intermediate - this will move into a commonly used utility class
cg@2596
    36
    "/ (where all the project code support will be collected).
cg@2596
    37
cg@2596
    38
    |module directory|
cg@2596
    39
cg@2596
    40
    projectDefinitionClass := ProjectDefinition definitionClassForPackage:package.
cg@2596
    41
    projectDefinitionClass isNil ifTrue:[
cg@2596
    42
        self error:('Missing ProjectDefinition class for "',package asString,'"')
cg@2596
    43
    ].
cg@2596
    44
cg@2596
    45
    "/ ensure that everything is loaded...
cg@2596
    46
    projectDefinitionClass loadAsAutoloaded:false.
cg@2596
    47
    projectDefinitionClass loadExtensions.
cg@2596
    48
    projectDefinitionClass loadAllClassesAsAutoloaded:false.
cg@2596
    49
cg@2596
    50
    module := package module.
cg@2596
    51
    directory := package directory.
cg@2596
    52
cg@2596
    53
    buildDirectory := PreviousBuildDirectory ifNil:[ UserPreferences current buildDirectory ].
cg@2596
    54
    buildDirectory isNil ifTrue:[
cg@2596
    55
        buildDirectory := Filename tempDirectory construct:'stx_build'.
cg@2596
    56
    ].
cg@2596
    57
    buildDirectory := buildDirectory asFilename.
cg@2596
    58
cg@2596
    59
    "/ self validateBuildDirectoryIsPresent.
cg@2596
    60
cg@2596
    61
    PreviousBuildDirectory := buildDirectory.
cg@2596
    62
cg@2596
    63
    "/ UserPreferences current localBuild:true
cg@2596
    64
    UserPreferences current localBuild ifFalse:[
cg@2596
    65
        SourceCodeManager notNil ifTrue:[
cg@2596
    66
            sourceCodeManager := SourceCodeManagerUtilities sourceCodeManagerFor:projectDefinitionClass.
cg@2596
    67
        ]
cg@2596
    68
    ].
cg@2596
    69
    sourceCodeManager := nil.
cg@2596
    70
cg@2598
    71
    myTopDirectory := 
cg@2596
    72
        Smalltalk packagePath 
cg@2596
    73
            detect:[:aPath |
cg@2596
    74
                (aPath asFilename / 'stx' / 'include') exists
cg@2596
    75
                and: [ (aPath asFilename / 'stx' / 'rules') exists ]]
cg@2596
    76
            ifNone:nil.       
cg@2598
    77
    myTopDirectory isNil ifTrue:[
cg@2598
    78
        self error:('Cannot figure out my top directory (where stx/include and stx/rules are)')
cg@2596
    79
    ].
cg@2598
    80
    myTopDirectory := myTopDirectory asFilename.
cg@2598
    81
    mySTXTopDirectory := myTopDirectory / 'stx'.
cg@2596
    82
cg@2596
    83
    self setupBuildDirectory.
cg@2599
    84
    self copySTCDirectoryForBuild.
cg@2596
    85
    self generateSourceFiles.
cg@2600
    86
    self copyDLLsForLinkage.
cg@2600
    87
    self copySupportFilesForLinkage.
cg@2600
    88
    self copyStartupFilesFromSmalltalk.
cg@2596
    89
cg@2596
    90
    OperatingSystem
cg@2599
    91
        executeCommand:(ParserFlags makeCommand,' exe')
cg@2596
    92
        inputFrom:nil
cg@2596
    93
        outputTo:Transcript
cg@2596
    94
        errorTo:Transcript
cg@2599
    95
        inDirectory:(buildDirectory / module / directory)
cg@2596
    96
        onError:[:status| self error:'make failed'].
cg@2596
    97
cg@2596
    98
    "Created: / 09-08-2006 / 18:37:19 / fm"
cg@2596
    99
    "Modified: / 09-08-2006 / 19:55:50 / fm"
cg@2596
   100
    "Modified: / 22-09-2006 / 17:37:11 / cg"
cg@2596
   101
!
cg@2596
   102
cg@2600
   103
copyDLLsForLinkage
cg@2600
   104
    |targetBuildDir|
cg@2600
   105
cg@2600
   106
    targetBuildDir := buildDirectory / package module / package directory.
cg@2600
   107
cg@2600
   108
    (projectDefinitionClass allPreRequisites)
cg@2600
   109
    do:[:eachPackageToFileout |
cg@2600
   110
        |packageId packageDef packageModule packageDirectory packageTargetDir
cg@2600
   111
         dllSource dllSourceDir libraryName dllRelativePath|
cg@2600
   112
cg@2600
   113
        packageId := eachPackageToFileout asPackageId.
cg@2600
   114
        packageModule := packageId module.
cg@2600
   115
        packageDirectory := packageId directory.
cg@2600
   116
        packageTargetDir := (buildDirectory / packageModule / packageDirectory) recursiveMakeDirectory.
cg@2600
   117
cg@2600
   118
        packageDef := packageId projectDefinitionClass.
cg@2600
   119
        libraryName := packageDef libraryName.
cg@2600
   120
cg@2600
   121
        "/ mhmh - take them from my tree or from the projects/smalltalk execution directory ??
cg@2600
   122
        dllSourceDir := myTopDirectory / packageModule / packageDirectory.
cg@2600
   123
        OperatingSystem isMSWINDOWSlike ifTrue:[
cg@2600
   124
"/            dllRelativePath := 'objvc','/',(libraryName,'.dll').
cg@2600
   125
"/            (dllSourceDir / dllRelativePath) exists 
cg@2600
   126
            false ifFalse:[
cg@2600
   127
                dllRelativePath := 'objbc','/',(libraryName,'.dll').
cg@2600
   128
            ]
cg@2600
   129
        ] ifFalse:[
cg@2600
   130
            dllRelativePath := libraryName,'.so'.
cg@2600
   131
        ].
cg@2600
   132
        ((packageTargetDir / dllRelativePath) exists
cg@2600
   133
        and:[ (dllSourceDir / dllRelativePath) fileSize = (packageTargetDir / dllRelativePath) fileSize
cg@2600
   134
        and:[ (dllSourceDir / dllRelativePath) modificationTime < (packageTargetDir / dllRelativePath) modificationTime
cg@2600
   135
        "/ and:[ (dllSourceDir / dllRelativePath) sameContentsAs:(packageTargetDir / dllRelativePath) ]
cg@2600
   136
        ]]) ifFalse:[
cg@2600
   137
            (packageTargetDir / dllRelativePath) directory recursiveMakeDirectory.
cg@2600
   138
            (dllSourceDir / dllRelativePath) copyTo:(packageTargetDir / dllRelativePath).    
cg@2600
   139
        ]
cg@2600
   140
    ].
cg@2600
   141
!
cg@2600
   142
cg@2596
   143
copyDirectory:relativepath
cg@2596
   144
    "/ need rules in stx
cg@2596
   145
    ((Smalltalk projectDirectoryForPackage:'stx') asFilename construct:relativepath)
cg@2596
   146
        recursiveCopyTo:(buildDirectory construct:'stx').
cg@2596
   147
!
cg@2596
   148
cg@2596
   149
copyDirectoryForBuild:subdir
cg@2598
   150
    |targetDir targetFile|
cg@2596
   151
cg@2596
   152
    targetDir := buildDirectory / 'stx' / subdir.
cg@2596
   153
    targetDir exists ifFalse:[
cg@2596
   154
        targetDir makeDirectory.
cg@2598
   155
    ].
cg@2598
   156
    (mySTXTopDirectory / subdir) directoryContentsAsFilenamesDo:[:eachFile |
cg@2598
   157
        eachFile isDirectory ifFalse:[
cg@2598
   158
            targetFile := targetDir / eachFile baseName.
cg@2598
   159
            (targetFile exists not
cg@2598
   160
            or:[ targetFile modificationTime < eachFile modificationTime ]) ifTrue:[
cg@2598
   161
                self activityNotification:'copying ',eachFile pathName,'...'.
cg@2596
   162
                eachFile copyTo:(targetDir construct:eachFile baseName)
cg@2596
   163
            ]
cg@2596
   164
        ].
cg@2596
   165
    ].
cg@2598
   166
    self activityNotification:nil
cg@2598
   167
!
cg@2598
   168
cg@2600
   169
copyResourcesForPackage:aPackage
cg@2600
   170
    |module directory|
cg@2600
   171
cg@2600
   172
    module := aPackage asPackageId module.
cg@2600
   173
    directory := aPackage asPackageId directory.
cg@2600
   174
cg@2600
   175
    (myTopDirectory / module / directory / 'resources' ) exists ifTrue:[
cg@2600
   176
        (myTopDirectory / module / directory / 'resources' )
cg@2600
   177
            recursiveCopyTo:(buildDirectory / module / directory)
cg@2600
   178
    ].
cg@2600
   179
    (myTopDirectory / module / directory / 'styles' ) exists ifTrue:[
cg@2600
   180
        (myTopDirectory / module / directory / 'styles' )
cg@2600
   181
            recursiveCopyTo:(buildDirectory / module / directory)
cg@2600
   182
    ].
cg@2600
   183
!
cg@2600
   184
cg@2599
   185
copySTCDirectoryForBuild
cg@2599
   186
    |targetDir stc files|
cg@2599
   187
cg@2599
   188
    targetDir := buildDirectory / 'stx' / 'stc'.
cg@2599
   189
    targetDir exists ifFalse:[ targetDir makeDirectory ].
cg@2599
   190
cg@2599
   191
    stc := OperatingSystem isMSWINDOWSlike 
cg@2599
   192
                ifTrue:[ 'stc.exe' ]
cg@2599
   193
                ifFalse:[ 'stc' ].
cg@2599
   194
cg@2599
   195
    files := #( ) copyWith:stc.
cg@2599
   196
cg@2599
   197
    files do:[:eachFile |
cg@2599
   198
        |sourceFile targetFile|
cg@2599
   199
cg@2599
   200
        sourceFile := mySTXTopDirectory / 'stc' / eachFile.
cg@2599
   201
        targetFile := targetDir / eachFile.
cg@2599
   202
        (targetFile exists not
cg@2599
   203
        or:[ targetFile modificationTime < sourceFile modificationTime ]) ifTrue:[
cg@2599
   204
            self activityNotification:'copying ',sourceFile pathName,'...'.
cg@2599
   205
            sourceFile copyTo:targetFile
cg@2599
   206
        ].
cg@2599
   207
    ].
cg@2599
   208
    self activityNotification:nil
cg@2599
   209
!
cg@2599
   210
cg@2600
   211
copyStartupFilesFromSmalltalk
cg@2600
   212
    (buildDirectory / 'stx' / 'projects/smalltalk' ) exists ifFalse:[
cg@2600
   213
        (buildDirectory / 'stx' / 'projects/smalltalk' ) recursiveMakeDirectory.
cg@2600
   214
    ].
cg@2600
   215
cg@2600
   216
    #( 'keyboard.rc' 'keyboardMacros.rc' 'display.rc' 'd_win32.rc'
cg@2600
   217
       'host.rc' 'h_win32.rc'  
cg@2600
   218
    ) do:[:fn |
cg@2600
   219
        (myTopDirectory / 'stx' / 'projects/smalltalk' / fn)
cg@2600
   220
            copyTo: (buildDirectory / 'stx' / 'projects/smalltalk' / fn)
cg@2600
   221
    ]
cg@2600
   222
!
cg@2600
   223
cg@2600
   224
copySupportFilesForLinkage
cg@2600
   225
    |files|
cg@2600
   226
cg@2600
   227
    OperatingSystem isMSWINDOWSlike ifTrue:[
cg@2600
   228
        files := #( 
cg@2600
   229
                    'support/win32/borland/cs3245.dll' 
cg@2600
   230
                    'support/win32/X11.dll'
cg@2600
   231
                    'support/win32/Xext.dll'
cg@2600
   232
                    'librun/librun.dll'
cg@2600
   233
                    'libbc/librun.lib'
cg@2600
   234
                    'libbc/cs32i.lib'
cg@2600
   235
                    'librun/genDate.exe'
cg@2600
   236
                    'librun/main.c'
cg@2600
   237
                 ).
cg@2600
   238
    ] ifFalse:[
cg@2600
   239
        files := #(
cg@2600
   240
                    'librun/genDate'
cg@2600
   241
                    'librun/main.c'
cg@2600
   242
                    'librun/librun.so'
cg@2600
   243
                )
cg@2600
   244
    ].
cg@2600
   245
cg@2600
   246
    files do:[:dllRelativePath |
cg@2600
   247
        ((buildDirectory / 'stx' / dllRelativePath) exists
cg@2600
   248
        and:[ (mySTXTopDirectory / dllRelativePath) fileSize = (buildDirectory / 'stx' / dllRelativePath) fileSize
cg@2600
   249
        and:[ (mySTXTopDirectory / dllRelativePath) modificationTime < (buildDirectory / 'stx' / dllRelativePath) modificationTime
cg@2600
   250
        "/ and:[ (mySTXTopDirectory / dllRelativePath) sameContentsAs:(targetBuildDir / dllRelativePath) ]
cg@2600
   251
        ]]) ifFalse:[
cg@2600
   252
            (buildDirectory / 'stx' / dllRelativePath) directory recursiveMakeDirectory.
cg@2600
   253
            (mySTXTopDirectory / dllRelativePath) copyTo:(buildDirectory / 'stx' / dllRelativePath).    
cg@2600
   254
        ]
cg@2600
   255
    ].
cg@2600
   256
!
cg@2600
   257
cg@2598
   258
createHeaderFileFor:aClass in:packageTargetDir
cg@2598
   259
    |instVarList classInstVarList classVarList bindings superclassFilename
cg@2598
   260
     template file newContents oldContents|
cg@2598
   261
cg@2598
   262
    instVarList := StringCollection new.
cg@2598
   263
    aClass instVarNames do:[:v |
cg@2598
   264
        instVarList add:('OBJ %1;' bindWith:v)
cg@2598
   265
    ].
cg@2598
   266
    classInstVarList := StringCollection new.
cg@2598
   267
    aClass class instVarNames do:[:v |
cg@2598
   268
(v includes:$_) ifTrue:[self halt].
cg@2598
   269
        classInstVarList add:('OBJ %1;' bindWith:v)
cg@2598
   270
    ].
cg@2598
   271
    classVarList := StringCollection new.
cg@2598
   272
    aClass classVarNames do:[:v |
cg@2598
   273
        classVarList add:('extern OBJ %1_%2;' bindWith:aClass name with:v)
cg@2598
   274
    ].
cg@2598
   275
cg@2598
   276
    bindings := Dictionary new.
cg@2598
   277
    bindings at:'ClassName' put:aClass name. 
cg@2598
   278
    aClass superclass isNil ifTrue:[
cg@2598
   279
        bindings at:'SuperclassName' put:'-'. 
cg@2598
   280
        bindings at:'SuperclassFileInclude' put:nil.
cg@2598
   281
    ] ifFalse:[
cg@2598
   282
        bindings at:'SuperclassName' put:aClass superclass name. 
cg@2598
   283
        bindings at:'SuperclassFileName' put:(superclassFilename := Smalltalk fileNameForClass:aClass superclass).
cg@2598
   284
        bindings at:'SuperclassFileInclude' put:('#include "%1.STH"' bindWith:superclassFilename).
cg@2598
   285
    ].
cg@2598
   286
    bindings at:'InstVarList' put:instVarList asString. 
cg@2598
   287
    bindings at:'ClassVarList' put:classVarList asString. 
cg@2598
   288
    bindings at:'ClassInstVarList' put:classInstVarList asString. 
cg@2598
   289
cg@2598
   290
    template := 
cg@2598
   291
'/* This file was generated by ProjectBuilder. */
cg@2598
   292
/* !!!!!!!! Do not change by hand !!!!!!!! */
cg@2598
   293
cg@2598
   294
/* Class: %(ClassName) */
cg@2598
   295
/* Superclass: %(SuperclassName) */
cg@2598
   296
cg@2598
   297
%(SuperclassFileInclude)
cg@2598
   298
cg@2598
   299
/* INDIRECTGLOBALS */
cg@2598
   300
#ifdef _HEADER_INST_
cg@2598
   301
%(InstVarList)
cg@2598
   302
#endif /* _HEADER_INST_ */
cg@2598
   303
cg@2598
   304
#ifdef _HEADER_CLASS_
cg@2598
   305
%(ClassVarList)
cg@2598
   306
#endif /* _HEADER_CLASS_ */
cg@2598
   307
cg@2598
   308
#ifdef _HEADER_CLASSINST_
cg@2598
   309
%(ClassInstVarList)
cg@2598
   310
#endif /* _HEADER_CLASSINST_ */
cg@2598
   311
'.
cg@2598
   312
    newContents := template bindWithArguments:bindings.
cg@2598
   313
    file := packageTargetDir asFilename / ((Smalltalk fileNameForClass:aClass),'.STH').
cg@2598
   314
    (file exists not
cg@2598
   315
    or:[ (oldContents := file contents) ~= newContents ]) ifTrue:[
cg@2598
   316
        file contents: newContents.
cg@2598
   317
    ].
cg@2596
   318
!
cg@2596
   319
cg@2596
   320
generateSourceFiles
cg@2596
   321
    sourceCodeManager notNil ifTrue:[
cg@2596
   322
        "/ check out / generate files there
cg@2596
   323
        self generateSourceFilesByCheckingOutUsing:sourceCodeManager
cg@2596
   324
    ] ifFalse:[
cg@2596
   325
        "/ local build
cg@2596
   326
        "/ fileout the project
cg@2596
   327
        self generateSourceFilesByFilingOut
cg@2596
   328
    ]
cg@2596
   329
!
cg@2596
   330
cg@2596
   331
generateSourceFilesByCheckingOutUsing:aSourceCodeManager
cg@2596
   332
    "/ will no longer be needed/supported
cg@2596
   333
cg@2596
   334
    |repository stxRepository module directory|
cg@2596
   335
cg@2596
   336
self halt.
cg@2596
   337
    "/ check out / generate files there
cg@2596
   338
    repository := (aSourceCodeManager repositoryNameForModule:module) ifNil:[aSourceCodeManager repositoryName].
cg@2596
   339
    stxRepository := aSourceCodeManager repositoryName.
cg@2596
   340
cg@2596
   341
    (buildDirectory construct:'stx') exists ifFalse:[
cg@2596
   342
        (module ~= 'stx') ifTrue:[
cg@2596
   343
            OperatingSystem
cg@2596
   344
                executeCommand:('cvs -d ',stxRepository,' co stx')
cg@2596
   345
                inputFrom:nil
cg@2596
   346
                outputTo:Transcript
cg@2596
   347
                errorTo:Transcript
cg@2596
   348
                inDirectory:buildDirectory
cg@2596
   349
                onError:[:status| self error:'cvs update stx failed'].
cg@2596
   350
        ].
cg@2596
   351
    ].
cg@2596
   352
cg@2596
   353
    ((buildDirectory construct:module) construct:'CVS') exists ifFalse:[
cg@2596
   354
        OperatingSystem
cg@2596
   355
            executeCommand:('cvs -d ',repository,' co -l ',directory)
cg@2596
   356
            inputFrom:nil
cg@2596
   357
            outputTo:Transcript
cg@2596
   358
            errorTo:Transcript
cg@2596
   359
            inDirectory:buildDirectory
cg@2596
   360
            onError:[:status| self error:'cvs update failed'].
cg@2596
   361
    ].
cg@2596
   362
    OperatingSystem
cg@2596
   363
        executeCommand:'cvs upd -d'
cg@2596
   364
        inputFrom:nil
cg@2596
   365
        outputTo:Transcript
cg@2596
   366
        errorTo:Transcript
cg@2596
   367
        inDirectory:(buildDirectory construct:module)
cg@2596
   368
        onError:[:status| self error:'cvs update failed'].
cg@2596
   369
self halt.
cg@2596
   370
!
cg@2596
   371
cg@2596
   372
generateSourceFilesByFilingOut
cg@2596
   373
    "/ local build
cg@2596
   374
    "/ fileout the project
cg@2596
   375
cg@2596
   376
    (package module ~= 'stx') ifTrue:[
cg@2596
   377
        (buildDirectory / package module) makeDirectory.
cg@2596
   378
    ].
cg@2596
   379
cg@2599
   380
    "/ file out the package(s) which are to be built
cg@2598
   381
    ((Array with:package))
cg@2598
   382
    do:[:eachPackageToFileout |
cg@2598
   383
        |packageId packageModule packageDirectory packageTargetDir packageDef|
cg@2596
   384
cg@2598
   385
        packageId := eachPackageToFileout asPackageId.
cg@2598
   386
        packageModule := packageId module.
cg@2598
   387
        packageDirectory := packageId directory.
cg@2596
   388
        packageTargetDir := (buildDirectory / packageModule / packageDirectory) recursiveMakeDirectory.
cg@2596
   389
cg@2598
   390
        packageDef := packageId projectDefinitionClass.
cg@2598
   391
        (packageDef compiled_classNames_common ,
cg@2598
   392
        packageDef compiled_classNamesForPlatform) do:[:eachClassName |
cg@2598
   393
            |cls|
cg@2598
   394
cg@2598
   395
            cls := Smalltalk classNamed:eachClassName.
cg@2598
   396
            self assert:cls isLoaded.
cg@2598
   397
            cls fileOutIn:packageTargetDir
cg@2596
   398
        ].
cg@2598
   399
cg@2598
   400
"/        (Smalltalk allClassesInPackage:eachPackageToFileout) do:[:cls |
cg@2598
   401
"/            cls isPrivate ifFalse:[
cg@2598
   402
"/                cls isLoaded ifFalse:[
cg@2598
   403
"/                    self halt.
cg@2598
   404
"/                    cls autoload.
cg@2598
   405
"/                ].
cg@2598
   406
"/                cls fileOutIn:packageTargetDir
cg@2598
   407
"/            ]
cg@2598
   408
"/        ].
cg@2599
   409
cg@2599
   410
        projectDefinitionClass forEachFileNameAndGeneratedContentsDo:[:fileName :fileContents |
cg@2599
   411
            ((packageTargetDir / fileName) exists
cg@2599
   412
            and:[ (packageTargetDir / fileName) contents = fileContents ]) ifFalse:[
cg@2599
   413
                (packageTargetDir / fileName) contents:fileContents.
cg@2599
   414
            ].
cg@2599
   415
        ].    
cg@2598
   416
    ].
cg@2599
   417
cg@2599
   418
    "/ generate header files in prerequisite packages...
cg@2598
   419
    (projectDefinitionClass allPreRequisites)
cg@2598
   420
    do:[:eachPackageToFileout |
cg@2598
   421
        |packageId packageDef packageModule packageDirectory packageTargetDir|
cg@2598
   422
cg@2598
   423
        packageId := eachPackageToFileout asPackageId.
cg@2598
   424
        packageModule := packageId module.
cg@2598
   425
        packageDirectory := packageId directory.
cg@2598
   426
        packageTargetDir := (buildDirectory / packageModule / packageDirectory) recursiveMakeDirectory.
cg@2598
   427
cg@2598
   428
        packageDef := packageId projectDefinitionClass.
cg@2598
   429
        (packageDef compiled_classNames_common ,
cg@2598
   430
        packageDef compiled_classNamesForPlatform) do:[:eachClassName |
cg@2598
   431
            |cls|
cg@2598
   432
cg@2598
   433
            cls := Smalltalk classNamed:eachClassName.
cg@2600
   434
            "/ self assert:cls isLoaded.
cg@2598
   435
            cls isLoaded ifTrue:[    
cg@2598
   436
                self createHeaderFileFor:cls in:packageTargetDir
cg@2598
   437
            ].
cg@2598
   438
        ].
cg@2600
   439
        self copyResourcesForPackage:eachPackageToFileout.
cg@2596
   440
    ].
cg@2596
   441
cg@2596
   442
"/    stx_libbasic2 preRequisitesForBuilding#(#'stx:libbasic')
cg@2596
   443
!
cg@2596
   444
cg@2596
   445
setupBuildDirectory
cg@2596
   446
    buildDirectory exists ifFalse:[
cg@2596
   447
        buildDirectory recursiveMakeDirectory.
cg@2596
   448
    ].
cg@2596
   449
    (buildDirectory / 'stx') exists ifFalse:[
cg@2596
   450
        (buildDirectory / 'stx') makeDirectory.
cg@2596
   451
    ].
cg@2596
   452
cg@2596
   453
    self copyDirectoryForBuild:'include'.
cg@2596
   454
    self copyDirectoryForBuild:'rules'.
cg@2596
   455
!
cg@2596
   456
cg@2596
   457
validateBuildDirectoryIsPresent
cg@2596
   458
cg@2596
   459
    ^ self.
cg@2596
   460
cg@2596
   461
"/    [
cg@2596
   462
"/        |default directoryIsOKForMe stc |
cg@2596
   463
"/
cg@2596
   464
"/        default := (buildDirectory ?
cg@2596
   465
"/                          PreviousBuildDirectory)
cg@2596
   466
"/                          ifNil:[ UserPreferences current buildDirectory].
cg@2596
   467
"/
cg@2596
   468
"/        buildDirectory := Dialog requestDirectoryName:'Temporary Work-ROOT for build:'
cg@2596
   469
"/                                 default:default.
cg@2596
   470
"/
cg@2596
   471
"/        buildDirectory isEmptyOrNil ifTrue:[^ self].
cg@2596
   472
"/        buildDirectory := buildDirectory asFilename.
cg@2596
   473
"/        directoryIsOKForMe := true.
cg@2596
   474
"/
cg@2596
   475
"/        buildDirectory exists ifFalse:[
cg@2596
   476
"/            Dialog warn:(self classResources string:'Work directory %1 does not exist.' with:buildDirectory).
cg@2596
   477
"/            directoryIsOKForMe := false.
cg@2596
   478
"/        ] ifTrue:[
cg@2596
   479
"/            (buildDirectory construct:'stx') exists ifFalse:[
cg@2596
   480
"/                Dialog warn:(self classResources stringWithCRs:'Work directory must contain an stx subDirectory,\which contains (at least) the stc and include subdirectories.').
cg@2596
   481
"/                directoryIsOKForMe := false.
cg@2596
   482
"/            ] ifTrue:[
cg@2596
   483
"/                stc := (OperatingSystem isMSDOSlike) ifTrue:['stc.exe'] ifFalse:['stc'].
cg@2596
   484
"/                (((buildDirectory construct:'stx')construct:'stc')construct:stc) exists ifFalse:[
cg@2596
   485
"/                    Dialog warn:(self classResources stringWithCRs:'Work directory must contain an stc compiler in the stx/stc subDirectory.').
cg@2596
   486
"/                    directoryIsOKForMe := false.
cg@2596
   487
"/                ].
cg@2596
   488
"/                ((buildDirectory construct:'stx')construct:'include') exists ifFalse:[
cg@2596
   489
"/                    Dialog warn:(self classResources stringWithCRs:'Work directory must have had a make run before (for include files to exists).').
cg@2596
   490
"/                    directoryIsOKForMe := false.
cg@2596
   491
"/                ].
cg@2596
   492
"/            ]
cg@2596
   493
"/        ].
cg@2596
   494
"/        directoryIsOKForMe
cg@2596
   495
"/    ] whileFalse
cg@2596
   496
! !
cg@2596
   497
cg@2596
   498
!ProjectBuilder class methodsFor:'documentation'!
cg@2596
   499
cg@2596
   500
version_CVS
cg@2596
   501
    ^ '$Header$'
cg@2596
   502
! !