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