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