ProjectBuilder.st
author Claus Gittinger <cg@exept.de>
Wed, 05 Sep 2012 20:22:28 +0200
changeset 2918 47d5c20da62d
parent 2916 59c84eca29fd
child 2921 bea9c6bb6a90
permissions -rw-r--r--
ming
cg@2741
     1
"
cg@2741
     2
 COPYRIGHT (c) 2009 by eXept Software AG
cg@2741
     3
              All Rights Reserved
cg@2741
     4
cg@2741
     5
 This software is furnished under a license and may be used
cg@2741
     6
 only in accordance with the terms of that license and with the
cg@2741
     7
 inclusion of the above copyright notice.   This software may not
cg@2741
     8
 be provided or otherwise made available to, or used by, any
cg@2741
     9
 other person.  No title to or ownership of the software is
cg@2741
    10
 hereby transferred.
cg@2741
    11
"
cg@2596
    12
"{ Package: 'stx:libtool2' }"
cg@2596
    13
cg@2635
    14
"{ NameSpace: Tools }"
cg@2635
    15
cg@2596
    16
Object subclass:#ProjectBuilder
cg@2596
    17
	instanceVariableNames:'package projectDefinitionClass sourceCodeManager buildDirectory
cg@2673
    18
		myWorkingDirectory mySTXTopDirectory myTopDirectory outputStream
cg@2680
    19
		makeExeOnly usedCompiler'
cg@2596
    20
	classVariableNames:'PreviousBuildDirectory'
cg@2596
    21
	poolDictionaries:''
cg@2596
    22
	category:'System-Support-Projects'
cg@2596
    23
!
cg@2596
    24
cg@2741
    25
!ProjectBuilder class methodsFor:'documentation'!
cg@2741
    26
cg@2741
    27
copyright
cg@2741
    28
"
cg@2741
    29
 COPYRIGHT (c) 2009 by eXept Software AG
cg@2741
    30
              All Rights Reserved
cg@2741
    31
cg@2741
    32
 This software is furnished under a license and may be used
cg@2741
    33
 only in accordance with the terms of that license and with the
cg@2741
    34
 inclusion of the above copyright notice.   This software may not
cg@2741
    35
 be provided or otherwise made available to, or used by, any
cg@2741
    36
 other person.  No title to or ownership of the software is
cg@2741
    37
 hereby transferred.
cg@2741
    38
"
cg@2741
    39
! !
cg@2596
    40
cg@2633
    41
!ProjectBuilder class methodsFor:'accessing'!
cg@2633
    42
cg@2633
    43
previousBuildDirectory
cg@2633
    44
    ^ PreviousBuildDirectory
cg@2633
    45
!
cg@2633
    46
cg@2633
    47
previousBuildDirectory:something
cg@2633
    48
    PreviousBuildDirectory := something.
cg@2633
    49
! !
cg@2633
    50
cg@2596
    51
!ProjectBuilder class methodsFor:'examples'!
cg@2596
    52
cg@2644
    53
example1
cg@2644
    54
    Smalltalk loadPackage:'stx:projects/helloWorldApp' asAutoloaded:true.
cg@2644
    55
cg@2644
    56
    self new
cg@2644
    57
        package:'stx:projects/helloWorldApp';
cg@2644
    58
        build
cg@2622
    59
!
cg@2622
    60
cg@2644
    61
example2
cg@2644
    62
    |builder|
cg@2644
    63
cg@2644
    64
    Smalltalk loadPackage:'stx:clients/Demos/foxCalcApplication' asAutoloaded:true.
cg@2644
    65
cg@2644
    66
    builder := self new.
cg@2909
    67
    builder 
cg@2909
    68
        package:'stx:clients/Demos/foxCalcApplication';
cg@2909
    69
        build.
cg@2644
    70
cg@2644
    71
    UserPreferences fileBrowserClass openOnDirectory:builder packageBuildDirectory.
cg@2909
    72
cg@2909
    73
    "Modified: / 03-09-2012 / 19:23:53 / cg"
cg@2596
    74
! !
cg@2596
    75
cg@2873
    76
!ProjectBuilder class methodsFor:'queries'!
cg@2873
    77
cg@2873
    78
defaultUsedCompiler
cg@2873
    79
    |compiler|
cg@2873
    80
cg@2873
    81
    (compiler := UserPreferences current usedCompilerForBuild) notNil ifTrue:[
cg@2873
    82
        ^ compiler
cg@2873
    83
    ].
cg@2873
    84
cg@2873
    85
    OperatingSystem isMSWINDOWSlike ifTrue:[
cg@2873
    86
        ^ 'bcc'
cg@2873
    87
    ].
cg@2873
    88
    ^ 'gcc'
cg@2873
    89
cg@2873
    90
    "Created: / 21-01-2012 / 14:06:51 / cg"
cg@2873
    91
!
cg@2873
    92
cg@2873
    93
listOfPossibleCompilers
cg@2873
    94
    OperatingSystem isMSWINDOWSlike ifTrue:[
cg@2918
    95
        OperatingSystem getLoginName = 'cg' ifTrue:[
cg@2918
    96
            ^ #('bcc' 'vc' 'lcc' 'tcc' 'mingw'  )
cg@2918
    97
        ].
cg@2918
    98
        ^ #('bcc' 'vc' 'lcc'  )
cg@2873
    99
    ].
cg@2873
   100
    ^ #('gcc')
cg@2873
   101
cg@2873
   102
    "Created: / 21-01-2012 / 14:04:15 / cg"
cg@2873
   103
! !
cg@2873
   104
cg@2596
   105
!ProjectBuilder methodsFor:'accessing'!
cg@2596
   106
cg@2644
   107
buildDirectory
cg@2644
   108
    ^ buildDirectory
cg@2622
   109
!
cg@2622
   110
cg@2634
   111
buildDirectory:something
cg@2634
   112
    buildDirectory := something.
cg@2634
   113
!
cg@2634
   114
cg@2673
   115
makeExeOnly:aBoolean
cg@2673
   116
    makeExeOnly := aBoolean.
cg@2673
   117
!
cg@2673
   118
cg@2644
   119
package:aPackageIDOrSymbol
cg@2644
   120
    package := aPackageIDOrSymbol asPackageId.
cg@2596
   121
!
cg@2596
   122
cg@2644
   123
packageBuildDirectory
cg@2644
   124
    "the directoray, where the deployable binary is created (xxxSetup.exe)"
cg@2622
   125
cg@2622
   126
    ^ buildDirectory / (package asPackageId module) / (package asPackageId directory)
cg@2635
   127
!
cg@2635
   128
cg@2644
   129
projectDefinitionClass:something
cg@2644
   130
    projectDefinitionClass := something.
cg@2680
   131
!
cg@2680
   132
sr@2683
   133
suffixForHeaderFiles
sr@2683
   134
    ^ OperatingSystem isUNIXlike ifTrue:['.H'] ifFalse:['.STH']
sr@2683
   135
!
sr@2683
   136
cg@2873
   137
usedCompilerForBuild:something
cg@2680
   138
    usedCompiler := something.
cg@2873
   139
cg@2873
   140
    "Created: / 22-01-2012 / 10:50:48 / cg"
cg@2596
   141
! !
cg@2596
   142
cg@2596
   143
!ProjectBuilder methodsFor:'building'!
cg@2596
   144
cg@2644
   145
build
cg@2644
   146
    "/ intermediate - this will move into a commonly used utility class
cg@2635
   147
    "/ (where all the project code support will be collected).
cg@2635
   148
cg@2647
   149
    |makeOutput|
cg@2647
   150
cg@2647
   151
    makeOutput := TextStream on:(Text new:10000).
cg@2647
   152
    self buildWithColorizedOutputTo:makeOutput.
cg@2647
   153
cg@2647
   154
    TextView openWith:makeOutput contents.
cg@2647
   155
!
cg@2647
   156
cg@2647
   157
buildWithColorizedOutputTo:makeOutput
cg@2647
   158
    "/ intermediate - this will move into a commonly used utility class
cg@2647
   159
    "/ (where all the project code support will be collected).
cg@2647
   160
cg@2647
   161
    |stdOut stdErr lock|
cg@2635
   162
cg@2644
   163
    lock := Semaphore forMutualExclusion.
cg@2647
   164
cg@2644
   165
    stdErr := ActorStream new
cg@2644
   166
                    nextPutBlock:[:char |
cg@2644
   167
                        lock critical:[
cg@2644
   168
                            makeOutput emphasis:{#backgroundColor->Color red. #color->Color white.}.
cg@2644
   169
                            makeOutput nextPut:char.
cg@2644
   170
                            makeOutput emphasis:nil.
cg@2644
   171
                        ]
cg@2644
   172
                    ];
sr@2683
   173
                    nextPutAllBlock:[:string |
cg@2873
   174
                        lock critical:[          
cg@2873
   175
                            "/ (string includesString:'das Ziel' )ifTrue:[self halt].
cg@2644
   176
                            makeOutput emphasis:{#backgroundColor->Color red. #color->Color white.}.
sr@2683
   177
                            makeOutput nextPutAll:string.
cg@2644
   178
                            makeOutput emphasis:nil.
cg@2644
   179
                        ]
cg@2644
   180
                    ].
cg@2644
   181
    stdOut := ActorStream new
cg@2644
   182
                    nextPutBlock:[:char |
cg@2644
   183
                        lock critical:[
cg@2644
   184
                            makeOutput nextPut:char.
cg@2644
   185
                        ]
cg@2644
   186
                    ];
sr@2683
   187
                    nextPutAllBlock:[:string |
cg@2873
   188
                        lock critical:[         
cg@2873
   189
                            "/ (string includesString:'das Ziel' )ifTrue:[self halt].
sr@2683
   190
                            makeOutput nextPutAll:string.
cg@2644
   191
                        ]
cg@2644
   192
                    ].
cg@2635
   193
cg@2644
   194
    self buildWithOutputTo:stdOut errorTo:stdErr.
cg@2873
   195
cg@2873
   196
    "Modified: / 21-01-2012 / 13:49:13 / cg"
cg@2611
   197
!
cg@2611
   198
cg@2611
   199
buildWithOutputTo:stdOut errorTo:stdErr
cg@2611
   200
    "/ intermediate - this will move into a commonly used utility class
cg@2611
   201
    "/ (where all the project code support will be collected).
cg@2611
   202
cg@2596
   203
    |module directory|
cg@2596
   204
cg@2596
   205
    projectDefinitionClass := ProjectDefinition definitionClassForPackage:package.
cg@2596
   206
    projectDefinitionClass isNil ifTrue:[
cg@2596
   207
        self error:('Missing ProjectDefinition class for "',package asString,'"')
cg@2596
   208
    ].
cg@2596
   209
cg@2596
   210
    "/ ensure that everything is loaded...
cg@2596
   211
    projectDefinitionClass loadAsAutoloaded:false.
cg@2596
   212
    projectDefinitionClass loadExtensions.
cg@2596
   213
    projectDefinitionClass loadAllClassesAsAutoloaded:false.
cg@2596
   214
cg@2596
   215
    module := package module.
cg@2596
   216
    directory := package directory.
cg@2596
   217
cg@2596
   218
    buildDirectory isNil ifTrue:[
cg@2634
   219
        buildDirectory := PreviousBuildDirectory ifNil:[ UserPreferences current buildDirectory ].
cg@2634
   220
        buildDirectory isNil ifTrue:[
cg@2634
   221
            buildDirectory := Filename tempDirectory construct:'stx_build'.
cg@2634
   222
        ].
cg@2596
   223
    ].
cg@2596
   224
    buildDirectory := buildDirectory asFilename.
cg@2596
   225
cg@2596
   226
    "/ self validateBuildDirectoryIsPresent.
cg@2596
   227
cg@2596
   228
    PreviousBuildDirectory := buildDirectory.
cg@2596
   229
cg@2596
   230
    "/ UserPreferences current localBuild:true
cg@2596
   231
    UserPreferences current localBuild ifFalse:[
cg@2596
   232
        SourceCodeManager notNil ifTrue:[
sv@2861
   233
            sourceCodeManager := SourceCodeManagerUtilities default sourceCodeManagerFor:projectDefinitionClass.
cg@2596
   234
        ]
cg@2596
   235
    ].
cg@2596
   236
    sourceCodeManager := nil.
cg@2596
   237
cg@2598
   238
    myTopDirectory := 
cg@2596
   239
        Smalltalk packagePath 
cg@2596
   240
            detect:[:aPath |
cg@2596
   241
                (aPath asFilename / 'stx' / 'include') exists
cg@2596
   242
                and: [ (aPath asFilename / 'stx' / 'rules') exists ]]
cg@2596
   243
            ifNone:nil.       
cg@2598
   244
    myTopDirectory isNil ifTrue:[
cg@2598
   245
        self error:('Cannot figure out my top directory (where stx/include and stx/rules are)')
cg@2596
   246
    ].
cg@2598
   247
    myTopDirectory := myTopDirectory asFilename.
cg@2598
   248
    mySTXTopDirectory := myTopDirectory / 'stx'.
cg@2613
   249
cg@2596
   250
    self setupBuildDirectory.
cg@2628
   251
    self activityNotification:'Generating stc directory...'.
cg@2599
   252
    self copySTCDirectoryForBuild.
cg@2628
   253
    self activityNotification:'Generating source files...'.
cg@2596
   254
    self generateSourceFiles.
cg@2672
   255
    self activityNotification:'Copying dlls for linkage...'.
cg@2600
   256
    self copyDLLsForLinkage.
cg@2912
   257
    self activityNotification:'Copying support files for compilation and linkage...'.
cg@2912
   258
    self copySupportFilesForCompilation.
cg@2600
   259
    self copySupportFilesForLinkage.
cg@2600
   260
    self copyStartupFilesFromSmalltalk.
cg@2596
   261
cg@2628
   262
    self activityNotification:'Executing make...'.
cg@2611
   263
    self makeWithOutputTo:stdOut errorTo:stdErr.
cg@2912
   264
cg@2912
   265
    "Modified: / 04-09-2012 / 00:49:52 / cg"
cg@2898
   266
! !
cg@2898
   267
cg@2898
   268
!ProjectBuilder methodsFor:'building/private'!
cg@2596
   269
cg@2644
   270
copyDLLsForLinkage
cg@2911
   271
    |targetBuildDir preRequisites dllRelativeSourcePathes dllRelativeDestPathes|
sv@2723
   272
cg@2644
   273
    targetBuildDir := buildDirectory / package module / package directory.
cg@2644
   274
sv@2723
   275
    preRequisites := projectDefinitionClass allPreRequisites.
sv@2723
   276
    OperatingSystem isUNIXlike ifTrue:[
sv@2723
   277
        "For now: unix Makefiles require some libs implicitely..."
sv@2723
   278
        preRequisites := preRequisites union:#(
sv@2723
   279
                               'stx:goodies/refactoryBrowser/parser'
sv@2723
   280
                               'stx:libtool'
sv@2723
   281
                            ).
sv@2723
   282
    ].
sv@2723
   283
sv@2723
   284
    preRequisites do:[:eachPackageToFileout |
cg@2644
   285
        |packageId packageDef packageModule packageDirectory packageTargetDir
cg@2911
   286
         dllSource dllSourceDir libraryName dllRelativePathSource 
cg@2916
   287
         dllRelativePathDest objDirSource objDirDest alternativeObjDirSource|
cg@2644
   288
cg@2644
   289
        packageId := eachPackageToFileout asPackageId.
cg@2644
   290
        packageModule := packageId module.
cg@2644
   291
        packageDirectory := packageId directory.
cg@2644
   292
        packageTargetDir := (buildDirectory / packageModule / packageDirectory) recursiveMakeDirectory.
cg@2644
   293
cg@2644
   294
        packageDef := packageId projectDefinitionClass.
cg@2644
   295
        libraryName := packageDef libraryName.
cg@2644
   296
cg@2644
   297
        "/ mhmh - take them from my tree or from the projects/smalltalk execution directory ??
cg@2644
   298
        dllSourceDir := myTopDirectory / packageModule / packageDirectory.
cg@2909
   299
cg@2644
   300
        OperatingSystem isMSWINDOWSlike ifTrue:[
cg@2911
   301
            objDirDest := self objDirForUsedCompiler:usedCompiler.
cg@2916
   302
            objDirSource := objDirDest.
cg@2916
   303
"/            "/ use visual-c files for tcc linkage
cg@2916
   304
"/            usedCompiler = 'tcc' ifTrue:[
cg@2916
   305
"/                objDirSource := self objDirForUsedCompiler:'vc'.
cg@2916
   306
"/            ] ifFalse:[
cg@2916
   307
"/                objDirSource := objDirDest
cg@2916
   308
"/            ].
cg@2916
   309
            (dllSourceDir / objDirSource / (libraryName, '.dll')) exists ifFalse:[
cg@2916
   310
                alternativeObjDirSource := self objDirForUsedCompiler:'vc'.
cg@2916
   311
                (dllSourceDir / alternativeObjDirSource / (libraryName, '.dll')) exists ifTrue:[
cg@2916
   312
                    objDirSource := alternativeObjDirSource
cg@2916
   313
                ]
cg@2911
   314
            ].
cg@2916
   315
cg@2905
   316
"/            dllRelativePath := objDir,'/',(libraryName,'.dll').
cg@2644
   317
"/            (dllSourceDir / dllRelativePath) exists 
cg@2911
   318
            dllRelativeSourcePathes := Array with:(objDirSource,'\', libraryName, '.dll').
cg@2911
   319
            dllRelativeDestPathes := Array with:(objDirDest,'\', libraryName, '.dll').
cg@2644
   320
        ] ifFalse:[
cg@2911
   321
            dllRelativeSourcePathes := Array with:(libraryName,'.so').
sv@2723
   322
            (packageModule = 'stx' and:[packageDirectory = 'libview']) ifTrue:[
cg@2911
   323
                dllRelativeSourcePathes := dllRelativeSourcePathes, #('XWorkstation.so' 'GLXWorkstation.so').
sv@2723
   324
            ].
cg@2644
   325
        ].
cg@2911
   326
        dllRelativeSourcePathes with:dllRelativeDestPathes do:[:dllRelativeSourcePath :dllRelativeDestPath|
cg@2896
   327
            |source dest|
cg@2896
   328
cg@2911
   329
            source := dllSourceDir / dllRelativeSourcePath.
cg@2911
   330
            dest := packageTargetDir / dllRelativeDestPath.
cg@2896
   331
            (dest exists not
cg@2896
   332
             or:[source fileSize ~= dest fileSize
cg@2896
   333
             or:[source modificationTime >= dest modificationTime
sv@2723
   334
             "/ or:[ ((dllSourceDir / dllRelativePath) sameContentsAs:(packageTargetDir / dllRelativePath)) not ]
sv@2723
   335
            ]]) ifTrue:[
cg@2911
   336
                Transcript showCR:'updating ',dllRelativeDestPath.
cg@2896
   337
                dest directory recursiveMakeDirectory.
cg@2896
   338
                source copyTo:dest.    
sv@2723
   339
            ].
sv@2723
   340
        ].
cg@2614
   341
    ].
cg@2896
   342
cg@2916
   343
    "Modified: / 05-09-2012 / 08:27:07 / cg"
cg@2600
   344
!
cg@2600
   345
cg@2644
   346
copyDirectory:relativepath
cg@2644
   347
    "/ need rules in stx
cg@2644
   348
    ((Smalltalk projectDirectoryForPackage:'stx') asFilename construct:relativepath)
cg@2644
   349
        recursiveCopyTo:(buildDirectory construct:'stx').
cg@2596
   350
!
cg@2596
   351
cg@2644
   352
copyDirectoryForBuild:subdir
cg@2644
   353
    |targetDir targetFile|
cg@2644
   354
cg@2644
   355
    targetDir := buildDirectory / 'stx' / subdir.
cg@2644
   356
    targetDir exists ifFalse:[
cg@2644
   357
        targetDir makeDirectory.
cg@2644
   358
    ].
cg@2644
   359
    (mySTXTopDirectory / subdir) directoryContentsAsFilenamesDo:[:eachFile |
cg@2644
   360
        eachFile isDirectory ifFalse:[
cg@2644
   361
            targetFile := targetDir / eachFile baseName.
cg@2644
   362
            (targetFile exists not
cg@2644
   363
            or:[ targetFile modificationTime < eachFile modificationTime ]) ifTrue:[
cg@2644
   364
                self activityNotification:'copying ',eachFile pathName,'...'.
cg@2644
   365
                eachFile copyTo:(targetDir construct:eachFile baseName)
cg@2644
   366
            ]
cg@2644
   367
        ].
cg@2644
   368
    ].
cg@2644
   369
    self activityNotification:nil
cg@2598
   370
!
cg@2598
   371
cg@2644
   372
copyResourcesForPackage:aPackage
cg@2644
   373
    |module directory|
cg@2644
   374
cg@2644
   375
    module := aPackage asPackageId module.
cg@2644
   376
    directory := aPackage asPackageId directory.
cg@2644
   377
cg@2644
   378
    (myTopDirectory / module / directory / 'resources' ) exists ifTrue:[
cg@2644
   379
        (myTopDirectory / module / directory / 'resources' )
cg@2644
   380
            recursiveCopyTo:(buildDirectory / module / directory)
cg@2644
   381
    ].
cg@2644
   382
    (myTopDirectory / module / directory / 'styles' ) exists ifTrue:[
cg@2644
   383
        (myTopDirectory / module / directory / 'styles' )
cg@2644
   384
            recursiveCopyTo:(buildDirectory / module / directory)
cg@2644
   385
    ].
cg@2600
   386
!
cg@2600
   387
cg@2644
   388
copySTCDirectoryForBuild
cg@2912
   389
    "copy stc files to the build directory"
cg@2912
   390
cg@2644
   391
    |targetDir stc files|
cg@2644
   392
cg@2644
   393
    targetDir := buildDirectory / 'stx' / 'stc'.
cg@2644
   394
    targetDir exists ifFalse:[ targetDir makeDirectory ].
cg@2644
   395
cg@2644
   396
    stc := OperatingSystem isMSWINDOWSlike 
cg@2644
   397
                ifTrue:[ 'stc.exe' ]
cg@2644
   398
                ifFalse:[ 'stc' ].
cg@2644
   399
cg@2644
   400
    files := #( ) copyWith:stc.
cg@2644
   401
cg@2644
   402
    files do:[:eachFile |
cg@2644
   403
        |sourceFile targetFile|
cg@2644
   404
cg@2644
   405
        sourceFile := mySTXTopDirectory / 'stc' / eachFile.
cg@2644
   406
        targetFile := targetDir / eachFile.
cg@2644
   407
        (targetFile exists not
cg@2644
   408
        or:[ targetFile modificationTime < sourceFile modificationTime ]) ifTrue:[
cg@2644
   409
            self activityNotification:'copying ',sourceFile pathName,'...'.
cg@2644
   410
            sourceFile copyTo:targetFile
cg@2644
   411
        ].
cg@2644
   412
    ].
sr@2683
   413
sr@2683
   414
    OperatingSystem isUNIXlike ifTrue:[
sr@2683
   415
        (targetDir / 'stc') makeExecutableForAll    
sr@2683
   416
    ].
sr@2683
   417
cg@2644
   418
    self activityNotification:nil
cg@2912
   419
cg@2912
   420
    "Modified (comment): / 04-09-2012 / 00:49:19 / cg"
cg@2599
   421
!
cg@2599
   422
cg@2644
   423
copyStartupFilesFromSmalltalk
cg@2912
   424
    "copy additional smalltalk startup files to the build directory"
cg@2912
   425
cg@2644
   426
    (buildDirectory / 'stx' / 'projects/smalltalk' ) exists ifFalse:[
cg@2644
   427
        (buildDirectory / 'stx' / 'projects/smalltalk' ) recursiveMakeDirectory.
cg@2644
   428
    ].
cg@2644
   429
cg@2678
   430
    #( 
cg@2678
   431
        'keyboard.rc' 
cg@2678
   432
        'keyboardMacros.rc' 
cg@2678
   433
        'display.rc' 
cg@2678
   434
        'd_win32.rc'
cg@2678
   435
        'host.rc' 
cg@2678
   436
        'h_win32.rc'  
cg@2678
   437
        'smalltalk.rc'  
cg@2678
   438
        'private.rc'  
cg@2644
   439
    ) do:[:fn |
cg@2644
   440
        (myTopDirectory / 'stx' / 'projects/smalltalk' / fn)
cg@2644
   441
            copyTo: (buildDirectory / 'stx' / 'projects/smalltalk' / fn)
cg@2678
   442
    ].
cg@2678
   443
cg@2678
   444
    (myTopDirectory / 'stx' / 'doc/online/english/LICENCE_STX.html')
cg@2678
   445
            copyTo: (buildDirectory / 'stx' / 'projects/smalltalk' / 'LICENCE_STX.html').
cg@2912
   446
cg@2912
   447
    "Modified (comment): / 04-09-2012 / 00:48:47 / cg"
cg@2912
   448
!
cg@2912
   449
cg@2912
   450
copySupportFilesForCompilation
cg@2912
   451
    "copy the tcc compiler to the build directory"
cg@2912
   452
cg@2912
   453
    |files|
cg@2912
   454
cg@2912
   455
    files := #().
cg@2912
   456
cg@2912
   457
    OperatingSystem isMSWINDOWSlike ifTrue:[
cg@2912
   458
        usedCompiler = 'tcc' ifTrue:[
cg@2912
   459
            files := files , #( 
cg@2912
   460
                        'support/tcc'
cg@2912
   461
                    ).
cg@2912
   462
        ].
cg@2912
   463
    ] ifFalse:[
cg@2912
   464
        files := files , #(
cg@2912
   465
                )
cg@2912
   466
    ].
cg@2912
   467
    files := files asOrderedCollection.
cg@2912
   468
cg@2912
   469
    files do:[:relativePath |
cg@2912
   470
        (mySTXTopDirectory / relativePath) exists ifTrue:[
cg@2912
   471
            ((buildDirectory / 'stx' / relativePath) exists
cg@2912
   472
            and:[ (mySTXTopDirectory / relativePath) fileSize = (buildDirectory / 'stx' / relativePath) fileSize
cg@2912
   473
            and:[ (mySTXTopDirectory / relativePath) modificationTime < (buildDirectory / 'stx' / relativePath) modificationTime
cg@2912
   474
            "/ and:[ (mySTXTopDirectory / dllRelativePath) sameContentsAs:(targetBuildDir / dllRelativePath) ]
cg@2912
   475
            ]]) ifFalse:[
cg@2912
   476
                (mySTXTopDirectory / relativePath) recursiveCopyTo:(buildDirectory / 'stx' / relativePath).    
cg@2912
   477
            ]
cg@2912
   478
        ] ifFalse:[
cg@2912
   479
            self error:'Missing directory: ',relativePath printString mayProceed:true.
cg@2912
   480
        ].
cg@2912
   481
    ].
cg@2912
   482
cg@2912
   483
    "Created: / 04-09-2012 / 00:47:49 / cg"
cg@2600
   484
!
cg@2600
   485
cg@2644
   486
copySupportFilesForLinkage
cg@2912
   487
    "copy additional files which are req'd for linkage to the build directory"
cg@2912
   488
cg@2644
   489
    |files|
cg@2644
   490
cg@2644
   491
    OperatingSystem isMSWINDOWSlike ifTrue:[
cg@2644
   492
        files := #( 
cg@2644
   493
                    'librun/genDate.exe'
cg@2644
   494
                    'librun/main.c'
cg@2673
   495
                    'projects/smalltalk/stx_16x16.ico'
cg@2673
   496
                    'projects/smalltalk/stx_32x32.ico'
cg@2673
   497
                    'projects/smalltalk/stx_splash.bmp'
cg@2644
   498
                 ).
cg@2905
   499
cg@2905
   500
        usedCompiler = 'bcc' ifTrue:[
cg@2905
   501
            files := files , #( 
cg@2905
   502
                        'librun/objbc/librun.dll'
cg@2905
   503
                        'support/win32/borland/cs3245.dll' 
cg@2905
   504
                        'support/win32/X11.dll'
cg@2905
   505
                        'support/win32/Xext.dll'
cg@2916
   506
                        'lib/bc/librun.lib'
cg@2916
   507
                        'lib/bc/cs32i.lib'
cg@2905
   508
                    ).
cg@2905
   509
        ].
cg@2905
   510
        usedCompiler = 'vc' ifTrue:[
cg@2905
   511
            files := files , #( 
cg@2905
   512
                        'librun/objvc/librun.dll'
cg@2916
   513
                        'lib/vc/librun.lib'
cg@2905
   514
                    ).
cg@2905
   515
        ].
cg@2911
   516
        usedCompiler = 'tcc' ifTrue:[
cg@2911
   517
            files := files , #( 
cg@2916
   518
                        'librun/objvc/librun.dll'   "/ linkage is against vc version!!
cg@2916
   519
                        'lib/vc/librun.lib'
cg@2916
   520
                    ).
cg@2916
   521
        ].
cg@2916
   522
        usedCompiler = 'lcc' ifTrue:[
cg@2916
   523
            files := files , #( 
cg@2916
   524
                        'librun/objvc/librun.dll'   "/ linkage is against vc version!!
cg@2916
   525
                        'lib/vc/librun.lib'
cg@2911
   526
                    ).
cg@2911
   527
        ].
cg@2918
   528
        usedCompiler = 'mingw' ifTrue:[
cg@2918
   529
            files := files , #( 
cg@2918
   530
                        'librun/objvc/librun.dll'   "/ linkage is against vc version!!
cg@2918
   531
                        'lib/vc/librun.lib'
cg@2918
   532
                    ).
cg@2918
   533
        ].
cg@2644
   534
    ] ifFalse:[
cg@2644
   535
        files := #(
cg@2644
   536
                    'librun/main.c'
cg@2644
   537
                    'librun/librun.so'
cg@2644
   538
                )
cg@2644
   539
    ].
cg@2677
   540
    files := files asOrderedCollection.
cg@2677
   541
cg@2677
   542
    OperatingSystem isMSWINDOWSlike ifTrue:[
cg@2677
   543
        projectDefinitionClass applicationIconFileName notNil ifTrue:[
cg@2678
   544
            files add:('projects/smalltalk/',projectDefinitionClass applicationIconFileName,'.ico')
cg@2678
   545
        ].
cg@2678
   546
        projectDefinitionClass splashFileName notNil ifTrue:[
cg@2678
   547
            files add:('projects/smalltalk/',projectDefinitionClass splashFileName,'.bmp')
cg@2678
   548
        ].
cg@2677
   549
    ].
cg@2644
   550
cg@2914
   551
    files do:[:relativePath |
cg@2914
   552
        (mySTXTopDirectory / relativePath) exists ifTrue:[
cg@2914
   553
            ((buildDirectory / 'stx' / relativePath) exists
cg@2914
   554
            and:[ (mySTXTopDirectory / relativePath) fileSize = (buildDirectory / 'stx' / relativePath) fileSize
cg@2914
   555
            and:[ (mySTXTopDirectory / relativePath) modificationTime < (buildDirectory / 'stx' / relativePath) modificationTime
sr@2684
   556
            "/ and:[ (mySTXTopDirectory / dllRelativePath) sameContentsAs:(targetBuildDir / dllRelativePath) ]
sr@2684
   557
            ]]) ifFalse:[
cg@2914
   558
                (buildDirectory / 'stx' / relativePath) directory recursiveMakeDirectory.
cg@2914
   559
                (mySTXTopDirectory / relativePath) copyTo:(buildDirectory / 'stx' / relativePath).    
sr@2684
   560
            ]
sr@2684
   561
        ] ifFalse:[
cg@2914
   562
            self error:'Missing file: ',relativePath printString mayProceed:true.
sr@2684
   563
        ].
cg@2644
   564
    ].
cg@2873
   565
cg@2918
   566
    "Modified: / 05-09-2012 / 16:26:25 / cg"
cg@2600
   567
!
cg@2600
   568
cg@2644
   569
createHeaderFileFor:aClass in:packageTargetDir
cg@2644
   570
    |instVarList classInstVarList classVarList bindings superclassFilename
cg@2644
   571
     template file newContents oldContents|
cg@2644
   572
cg@2644
   573
    instVarList := StringCollection new.
cg@2644
   574
    aClass instVarNames do:[:v |
cg@2644
   575
        instVarList add:('OBJ %1;' bindWith:v)
cg@2644
   576
    ].
cg@2644
   577
    classInstVarList := StringCollection new.
cg@2644
   578
    aClass class instVarNames do:[:v |
cg@2644
   579
(v includes:$_) ifTrue:[self halt].
cg@2644
   580
        classInstVarList add:('OBJ %1;' bindWith:v)
cg@2644
   581
    ].
cg@2644
   582
    classVarList := StringCollection new.
cg@2644
   583
    aClass classVarNames do:[:v |
cg@2644
   584
        classVarList add:('extern OBJ %1_%2;' bindWith:aClass name with:v)
cg@2644
   585
    ].
cg@2644
   586
cg@2644
   587
    bindings := Dictionary new.
cg@2644
   588
    bindings at:'ClassName' put:aClass name. 
cg@2644
   589
    aClass superclass isNil ifTrue:[
cg@2644
   590
        bindings at:'SuperclassName' put:'-'. 
cg@2852
   591
        bindings at:'SuperclassFileInclude' put:''.
cg@2644
   592
    ] ifFalse:[
cg@2644
   593
        bindings at:'SuperclassName' put:aClass superclass name. 
cg@2644
   594
        bindings at:'SuperclassFileName' put:(superclassFilename := Smalltalk fileNameForClass:aClass superclass).
cg@2644
   595
        bindings at:'SuperclassFileInclude' put:('#include "%1.STH"' bindWith:superclassFilename).
cg@2644
   596
    ].
cg@2644
   597
    bindings at:'InstVarList' put:instVarList asString. 
cg@2644
   598
    bindings at:'ClassVarList' put:classVarList asString. 
cg@2644
   599
    bindings at:'ClassInstVarList' put:classInstVarList asString. 
cg@2644
   600
cg@2644
   601
    template := 
cg@2644
   602
'/* This file was generated by ProjectBuilder. */
cg@2644
   603
/* !!!!!!!! Do not change by hand !!!!!!!! */
cg@2644
   604
cg@2644
   605
/* Class: %(ClassName) */
cg@2644
   606
/* Superclass: %(SuperclassName) */
cg@2644
   607
cg@2644
   608
%(SuperclassFileInclude)
cg@2644
   609
cg@2644
   610
/* INDIRECTGLOBALS */
cg@2644
   611
#ifdef _HEADER_INST_
cg@2644
   612
%(InstVarList)
cg@2644
   613
#endif /* _HEADER_INST_ */
cg@2644
   614
cg@2644
   615
#ifdef _HEADER_CLASS_
cg@2644
   616
%(ClassVarList)
cg@2644
   617
#endif /* _HEADER_CLASS_ */
cg@2644
   618
cg@2644
   619
#ifdef _HEADER_CLASSINST_
cg@2644
   620
%(ClassInstVarList)
cg@2644
   621
#endif /* _HEADER_CLASSINST_ */
cg@2644
   622
'.
cg@2644
   623
    newContents := template bindWithArguments:bindings.
sr@2683
   624
    file := packageTargetDir asFilename / ((Smalltalk fileNameForClass:aClass),(self suffixForHeaderFiles)).
cg@2644
   625
    (file exists not
cg@2644
   626
    or:[ (oldContents := file contents) ~= newContents ]) ifTrue:[
cg@2644
   627
        file contents: newContents.
cg@2644
   628
    ].
cg@2852
   629
cg@2852
   630
    "Modified: / 15-08-2011 / 14:58:46 / cg"
cg@2596
   631
!
cg@2596
   632
cg@2644
   633
generateSourceFiles
cg@2644
   634
    sourceCodeManager notNil ifTrue:[
cg@2644
   635
        "/ check out / generate files there
cg@2644
   636
        self generateSourceFilesByCheckingOutUsing:sourceCodeManager
cg@2644
   637
    ] ifFalse:[
cg@2644
   638
        "/ local build
cg@2644
   639
        "/ fileout the project
cg@2644
   640
        self generateSourceFilesByFilingOut
cg@2644
   641
    ]
cg@2596
   642
!
cg@2596
   643
cg@2644
   644
generateSourceFilesByCheckingOutUsing:aSourceCodeManager
cg@2644
   645
    "/ will no longer be needed/supported
cg@2644
   646
cg@2644
   647
    |repository stxRepository module directory|
cg@2644
   648
cg@2868
   649
    self breakPoint:#cg.
cg@2868
   650
cg@2644
   651
    "/ check out / generate files there
cg@2644
   652
    repository := (aSourceCodeManager repositoryNameForModule:module) ifNil:[aSourceCodeManager repositoryName].
cg@2644
   653
    stxRepository := aSourceCodeManager repositoryName.
cg@2644
   654
cg@2644
   655
    (buildDirectory construct:'stx') exists ifFalse:[
cg@2644
   656
        (module ~= 'stx') ifTrue:[
cg@2644
   657
            OperatingSystem
cg@2644
   658
                executeCommand:('cvs -d ',stxRepository,' co stx')
cg@2644
   659
                inputFrom:nil
cg@2644
   660
                outputTo:Transcript
cg@2644
   661
                errorTo:Transcript
cg@2644
   662
                inDirectory:buildDirectory
cg@2644
   663
                onError:[:status| self error:'cvs update stx failed'].
cg@2644
   664
        ].
cg@2644
   665
    ].
cg@2644
   666
cg@2644
   667
    ((buildDirectory construct:module) construct:'CVS') exists ifFalse:[
cg@2644
   668
        OperatingSystem
cg@2644
   669
            executeCommand:('cvs -d ',repository,' co -l ',directory)
cg@2644
   670
            inputFrom:nil
cg@2644
   671
            outputTo:Transcript
cg@2644
   672
            errorTo:Transcript
cg@2644
   673
            inDirectory:buildDirectory
cg@2644
   674
            onError:[:status| self error:'cvs update failed'].
cg@2644
   675
    ].
cg@2644
   676
    OperatingSystem
cg@2644
   677
        executeCommand:'cvs upd -d'
cg@2644
   678
        inputFrom:nil
cg@2644
   679
        outputTo:Transcript
cg@2644
   680
        errorTo:Transcript
cg@2644
   681
        inDirectory:(buildDirectory construct:module)
cg@2644
   682
        onError:[:status| self error:'cvs update failed'].
cg@2644
   683
self halt.
cg@2868
   684
cg@2868
   685
    "Modified: / 29-12-2011 / 14:02:56 / cg"
cg@2596
   686
!
cg@2596
   687
cg@2644
   688
generateSourceFilesByFilingOut
cg@2644
   689
    "/ local build
cg@2644
   690
    "/ fileout the project
cg@2644
   691
sv@2844
   692
    |fullPathName|
sv@2844
   693
cg@2644
   694
    (package module ~= 'stx') ifTrue:[
cg@2644
   695
        (buildDirectory / package module) makeDirectory.
cg@2644
   696
    ].
cg@2644
   697
cg@2644
   698
    "/ file out the package(s) which are to be built
cg@2644
   699
    ((Array with:package))
cg@2644
   700
    do:[:eachPackageToFileout |
cg@2644
   701
        |packageId packageModule packageDirectory packageTargetDir packageDef|
cg@2644
   702
cg@2644
   703
        packageId := eachPackageToFileout asPackageId.
cg@2644
   704
        packageModule := packageId module.
cg@2644
   705
        packageDirectory := packageId directory.
cg@2644
   706
        packageTargetDir := (buildDirectory / packageModule / packageDirectory) recursiveMakeDirectory.
cg@2644
   707
cg@2644
   708
        packageDef := packageId projectDefinitionClass.
cg@2644
   709
        (packageDef compiled_classNames_common ,
cg@2644
   710
        packageDef compiled_classNamesForPlatform) do:[:eachClassName |
cg@2644
   711
            |cls fileName newSource|
cg@2644
   712
cg@2644
   713
            cls := Smalltalk classNamed:eachClassName.
cg@2644
   714
            self assert:cls isLoaded.
cg@2644
   715
            fileName := (Smalltalk fileNameForClass:cls),'.st'.
cg@2644
   716
            fileName := packageTargetDir asFilename construct:fileName.
cg@2644
   717
            fileName exists ifTrue:[
cg@2644
   718
                newSource := String streamContents:[:s | cls fileOutOn:s withTimeStamp:false].
cg@2644
   719
                newSource = fileName contentsAsString ifFalse:[
cg@2644
   720
                    fileName contents:newSource
cg@2644
   721
                ].
cg@2644
   722
            ] ifFalse:[
cg@2644
   723
                cls fileOutIn:packageTargetDir withTimeStamp:false
cg@2644
   724
            ].
cg@2644
   725
        ].
cg@2644
   726
cg@2644
   727
"/        (Smalltalk allClassesInPackage:eachPackageToFileout) do:[:cls |
cg@2644
   728
"/            cls isPrivate ifFalse:[
cg@2644
   729
"/                cls isLoaded ifFalse:[
cg@2644
   730
"/                    self halt.
cg@2644
   731
"/                    cls autoload.
cg@2644
   732
"/                ].
cg@2644
   733
"/                cls fileOutIn:packageTargetDir
cg@2644
   734
"/            ]
cg@2644
   735
"/        ].
cg@2644
   736
cg@2644
   737
        projectDefinitionClass forEachFileNameAndGeneratedContentsDo:[:fileName :fileContents |
sv@2844
   738
            fullPathName := packageTargetDir construct:fileName.
sv@2844
   739
            fullPathName directory exists ifFalse:[
sv@2844
   740
                "take care for files like 'autopackage/default.apspec'"
sv@2844
   741
                fullPathName directory makeDirectory.
sv@2844
   742
            ].
sv@2844
   743
            (fullPathName exists
sv@2844
   744
             and:[ fullPathName contents = fileContents ]) ifFalse:[
sv@2844
   745
                fullPathName contents:fileContents.
cg@2644
   746
            ].
cg@2644
   747
        ].    
cg@2644
   748
    ].
cg@2644
   749
cg@2644
   750
    "/ generate header files in prerequisite packages...
cg@2644
   751
    (projectDefinitionClass allPreRequisites)
cg@2644
   752
    do:[:eachPackageToFileout |
cg@2644
   753
        |packageId packageDef packageModule packageDirectory packageTargetDir|
cg@2644
   754
cg@2644
   755
        packageId := eachPackageToFileout asPackageId.
cg@2644
   756
        packageModule := packageId module.
cg@2644
   757
        packageDirectory := packageId directory.
cg@2644
   758
        packageTargetDir := (buildDirectory / packageModule / packageDirectory) recursiveMakeDirectory.
cg@2644
   759
cg@2644
   760
        packageDef := packageId projectDefinitionClass.
cg@2644
   761
        (packageDef compiled_classNames_common ,
cg@2644
   762
        packageDef compiled_classNamesForPlatform) do:[:eachClassName |
cg@2644
   763
            |cls|
cg@2644
   764
cg@2644
   765
            cls := Smalltalk classNamed:eachClassName.
cg@2644
   766
            "/ self assert:cls isLoaded.
cg@2644
   767
            cls isLoaded ifTrue:[    
cg@2644
   768
                self createHeaderFileFor:cls in:packageTargetDir
cg@2644
   769
            ].
cg@2644
   770
        ].
cg@2644
   771
        self copyResourcesForPackage:eachPackageToFileout.
cg@2644
   772
    ].
cg@2644
   773
cg@2644
   774
"/    stx_libbasic2 preRequisitesForBuilding#(#'stx:libbasic')
cg@2596
   775
!
cg@2596
   776
cg@2909
   777
makeCommandOfCompiler:usedCompiler
cg@2909
   778
    usedCompiler = 'bcc' ifTrue:[ 
cg@2909
   779
        ^ 'bmake'.
cg@2909
   780
    ].
cg@2909
   781
    usedCompiler = 'vc' ifTrue:[ 
cg@2909
   782
        ^ 'vcmake'. "/ compilerFlag := '-DUSEVC' 
cg@2909
   783
    ].
cg@2909
   784
    usedCompiler = 'lcc' ifTrue:[ 
cg@2909
   785
        ^ 'lccmake'. "/ compilerFlag := '-DUSELCC' 
cg@2909
   786
    ].
cg@2909
   787
    usedCompiler = 'tcc' ifTrue:[ 
cg@2909
   788
        ^ 'tccmake'. "/ compilerFlag := '-DUSELCC' 
cg@2909
   789
    ].
cg@2909
   790
    usedCompiler = 'gcc' ifTrue:[ 
cg@2909
   791
        ^ 'make'. 
cg@2909
   792
    ].
cg@2918
   793
    usedCompiler = 'mingw' ifTrue:[ 
cg@2918
   794
        ^ 'mingwmake'. 
cg@2909
   795
    ].
cg@2909
   796
    self error:'unknown compiler specified'.
cg@2909
   797
cg@2909
   798
    "Created: / 03-09-2012 / 19:46:07 / cg"
cg@2909
   799
!
cg@2909
   800
cg@2644
   801
makeWithOutputTo:stdOut errorTo:stdErr
cg@2909
   802
    |module directory makeCommand|
cg@2644
   803
cg@2644
   804
    module := package module.
cg@2644
   805
    directory := package directory.
cg@2644
   806
cg@2680
   807
    makeCommand := ParserFlags makeCommand.
cg@2895
   808
    usedCompiler isNil ifTrue:[
cg@2895
   809
        usedCompiler := ParserFlags usedCompiler.
cg@2895
   810
    ].
cg@2909
   811
    makeCommand := self makeCommandOfCompiler:usedCompiler.
cg@2873
   812
cg@2852
   813
    "/ makeCommand := makeCommand, ' TOP=', mySTXTopDirectory pathName.
cg@2680
   814
sr@2683
   815
    OperatingSystem isUNIXlike ifTrue:[
sr@2683
   816
        OperatingSystem
sv@2845
   817
            executeCommand:('sh %1/rules/stmkmf' bindWith:mySTXTopDirectory pathName)
sr@2683
   818
            inputFrom:nil
sr@2683
   819
            outputTo:stdOut
sr@2683
   820
            errorTo:stdErr
sr@2683
   821
            inDirectory:(buildDirectory / module / directory)
sr@2683
   822
            onError:[:status| self error:'make failed'].
sr@2683
   823
    ].
sr@2683
   824
cg@2644
   825
    projectDefinitionClass isLibraryDefinition ifTrue:[
cg@2644
   826
        OperatingSystem
cg@2680
   827
            executeCommand:(makeCommand,' classLibRule')
cg@2644
   828
            inputFrom:nil
cg@2644
   829
            outputTo:stdOut
cg@2644
   830
            errorTo:stdErr
cg@2644
   831
            inDirectory:(buildDirectory / module / directory)
cg@2644
   832
            onError:[:status| self error:'make failed'].
cg@2644
   833
    ] ifFalse:[
cg@2644
   834
        OperatingSystem
cg@2680
   835
            executeCommand:(makeCommand,' exe')
cg@2644
   836
            inputFrom:nil
cg@2644
   837
            outputTo:stdOut
cg@2644
   838
            errorTo:stdErr
cg@2644
   839
            inDirectory:(buildDirectory / module / directory)
cg@2644
   840
            onError:[:status| self error:'make failed'].
cg@2644
   841
cg@2673
   842
        (makeExeOnly ? false) ifFalse:[
cg@2673
   843
            OperatingSystem
cg@2680
   844
                executeCommand:(makeCommand,' setup')
cg@2673
   845
                inputFrom:nil
cg@2673
   846
                outputTo:stdOut
cg@2673
   847
                errorTo:stdErr
cg@2673
   848
                inDirectory:(buildDirectory / module / directory)
cg@2673
   849
                onError:[:status| self error:'make failed'].
cg@2673
   850
        ]
cg@2644
   851
    ]
cg@2793
   852
cg@2909
   853
    "Modified: / 03-09-2012 / 19:47:15 / cg"
cg@2611
   854
!
cg@2611
   855
cg@2905
   856
objDirForUsedCompiler
cg@2909
   857
    ^ self objDirForUsedCompiler:usedCompiler
cg@2909
   858
cg@2909
   859
    "Created: / 20-08-2012 / 17:01:13 / cg"
cg@2909
   860
!
cg@2909
   861
cg@2909
   862
objDirForUsedCompiler:usedCompiler
cg@2918
   863
    usedCompiler = 'gcc' ifTrue:[^ 'obj'].      "/ unix case
cg@2918
   864
cg@2905
   865
    usedCompiler = 'bcc' ifTrue:[^ 'objbc'].
cg@2905
   866
    usedCompiler = 'vc' ifTrue:[^ 'objvc'].
cg@2909
   867
    usedCompiler = 'tcc' ifTrue:[^ 'objtcc'].
cg@2909
   868
    usedCompiler = 'lcc' ifTrue:[^ 'objlcc'].
cg@2918
   869
    usedCompiler = 'mingw' ifTrue:[^ 'objmingw'].
cg@2905
   870
    self halt:'please fill in here'.
cg@2905
   871
    ^ 'objbc'
cg@2905
   872
cg@2909
   873
    "Created: / 03-09-2012 / 19:55:34 / cg"
cg@2905
   874
!
cg@2905
   875
sr@2683
   876
recursiveCopyDirectoryForBuild:subdir
sr@2683
   877
    |targetDir|
sr@2683
   878
sr@2683
   879
    targetDir := buildDirectory / 'stx' / subdir.
sr@2683
   880
    targetDir exists ifFalse:[
sr@2683
   881
        targetDir makeDirectory.
sr@2683
   882
    ].
sr@2683
   883
    (mySTXTopDirectory / subdir) directoryContentsAsFilenamesDo:[:eachFile |
sr@2683
   884
        eachFile recursiveCopyTo:(targetDir construct:eachFile baseName)
sr@2683
   885
    ].
sr@2683
   886
    self activityNotification:nil
sr@2683
   887
!
sr@2683
   888
cg@2644
   889
setupBuildDirectory
cg@2644
   890
    buildDirectory exists ifFalse:[
cg@2644
   891
        buildDirectory recursiveMakeDirectory.
cg@2644
   892
    ].
cg@2644
   893
    (buildDirectory / 'stx') exists ifFalse:[
cg@2644
   894
        (buildDirectory / 'stx') makeDirectory.
cg@2644
   895
    ].
cg@2644
   896
cg@2644
   897
    self copyDirectoryForBuild:'include'.
cg@2644
   898
    self copyDirectoryForBuild:'rules'.
sr@2683
   899
    OperatingSystem isUNIXlike ifTrue:[
sr@2683
   900
        self recursiveCopyDirectoryForBuild:'configurations'.
sr@2683
   901
    ]
cg@2635
   902
!
cg@2596
   903
cg@2644
   904
validateBuildDirectoryIsPresent
cg@2644
   905
cg@2644
   906
    ^ self.
cg@2644
   907
cg@2644
   908
"/    [
cg@2644
   909
"/        |default directoryIsOKForMe stc |
cg@2644
   910
"/
cg@2644
   911
"/        default := (buildDirectory ?
cg@2644
   912
"/                          PreviousBuildDirectory)
cg@2644
   913
"/                          ifNil:[ UserPreferences current buildDirectory].
cg@2644
   914
"/
cg@2644
   915
"/        buildDirectory := Dialog requestDirectoryName:'Temporary Work-ROOT for build:'
cg@2644
   916
"/                                 default:default.
cg@2644
   917
"/
cg@2644
   918
"/        buildDirectory isEmptyOrNil ifTrue:[^ self].
cg@2644
   919
"/        buildDirectory := buildDirectory asFilename.
cg@2644
   920
"/        directoryIsOKForMe := true.
cg@2644
   921
"/
cg@2644
   922
"/        buildDirectory exists ifFalse:[
cg@2644
   923
"/            Dialog warn:(self classResources string:'Work directory %1 does not exist.' with:buildDirectory).
cg@2644
   924
"/            directoryIsOKForMe := false.
cg@2644
   925
"/        ] ifTrue:[
cg@2644
   926
"/            (buildDirectory construct:'stx') exists ifFalse:[
cg@2644
   927
"/                Dialog warn:(self classResources stringWithCRs:'Work directory must contain an stx subDirectory,\which contains (at least) the stc and include subdirectories.').
cg@2644
   928
"/                directoryIsOKForMe := false.
cg@2644
   929
"/            ] ifTrue:[
cg@2644
   930
"/                stc := (OperatingSystem isMSDOSlike) ifTrue:['stc.exe'] ifFalse:['stc'].
cg@2644
   931
"/                (((buildDirectory construct:'stx')construct:'stc')construct:stc) exists ifFalse:[
cg@2644
   932
"/                    Dialog warn:(self classResources stringWithCRs:'Work directory must contain an stc compiler in the stx/stc subDirectory.').
cg@2644
   933
"/                    directoryIsOKForMe := false.
cg@2644
   934
"/                ].
cg@2644
   935
"/                ((buildDirectory construct:'stx')construct:'include') exists ifFalse:[
cg@2644
   936
"/                    Dialog warn:(self classResources stringWithCRs:'Work directory must have had a make run before (for include files to exists).').
cg@2644
   937
"/                    directoryIsOKForMe := false.
cg@2644
   938
"/                ].
cg@2644
   939
"/            ]
cg@2644
   940
"/        ].
cg@2644
   941
"/        directoryIsOKForMe
cg@2644
   942
"/    ] whileFalse
cg@2596
   943
! !
cg@2596
   944
cg@2596
   945
!ProjectBuilder class methodsFor:'documentation'!
cg@2596
   946
cg@2896
   947
version
cg@2896
   948
    ^ '$Header$'
cg@2896
   949
!
cg@2896
   950
cg@2596
   951
version_CVS
cg@2596
   952
    ^ '$Header$'
cg@2596
   953
! !