ProjectBuilder.st
author Claus Gittinger <cg@exept.de>
Tue, 20 Oct 2009 22:36:54 +0200
changeset 2635 8b62bd023558
parent 2634 3f14301cec84
child 2644 428bb83dd360
permissions -rw-r--r--
namespace change
cg@2596
     1
"{ Package: 'stx:libtool2' }"
cg@2596
     2
cg@2635
     3
"{ NameSpace: Tools }"
cg@2635
     4
cg@2596
     5
Object subclass:#ProjectBuilder
cg@2596
     6
	instanceVariableNames:'package projectDefinitionClass sourceCodeManager buildDirectory
cg@2598
     7
		myWorkingDirectory mySTXTopDirectory myTopDirectory'
cg@2596
     8
	classVariableNames:'PreviousBuildDirectory'
cg@2596
     9
	poolDictionaries:''
cg@2596
    10
	category:'System-Support-Projects'
cg@2596
    11
!
cg@2596
    12
cg@2596
    13
cg@2633
    14
!ProjectBuilder class methodsFor:'accessing'!
cg@2633
    15
cg@2633
    16
previousBuildDirectory
cg@2633
    17
    ^ PreviousBuildDirectory
cg@2633
    18
!
cg@2633
    19
cg@2633
    20
previousBuildDirectory:something
cg@2633
    21
    PreviousBuildDirectory := something.
cg@2633
    22
! !
cg@2633
    23
cg@2596
    24
!ProjectBuilder class methodsFor:'examples'!
cg@2596
    25
cg@2622
    26
!
cg@2622
    27
cg@2634
    28
methodsFor:'examples'
cg@2596
    29
! !
cg@2596
    30
cg@2596
    31
!ProjectBuilder methodsFor:'accessing'!
cg@2596
    32
cg@2635
    33
ileBrowserClass openOnDirectory:builder packageBuildDirectory.
cg@2622
    34
!
cg@2622
    35
cg@2634
    36
buildDirectory:something
cg@2634
    37
    buildDirectory := something.
cg@2634
    38
!
cg@2634
    39
cg@2634
    40
kageBuildDirectory.
cg@2596
    41
!
cg@2596
    42
cg@2635
    43
he directoray, where the deployable binary is created (xxxSetup.exe)"
cg@2622
    44
cg@2622
    45
    ^ buildDirectory / (package asPackageId module) / (package asPackageId directory)
cg@2635
    46
!
cg@2635
    47
cg@2635
    48
'building'
cg@2596
    49
! !
cg@2596
    50
cg@2596
    51
!ProjectBuilder methodsFor:'building'!
cg@2596
    52
cg@2635
    53
"/ intermediate - this will move into a commonly used utility class
cg@2635
    54
    "/ (where all the project code support will be collected).
cg@2635
    55
cg@2635
    56
    |module directory|
cg@2635
    57
cg@2635
    58
    projectDefinitionClass := ProjectDefinition definitionClassForPackage:package.
cg@2635
    59
    projectDefinitionClass isNil ifTrue:[
cg@2635
    60
        self error:('Missing ProjectDefinition class for "',package asString,'"')
cg@2635
    61
    ].
cg@2635
    62
cg@2635
    63
    "/ ensure that everything is loaded...
cg@2635
    64
    projectDefinitionClass loadAsAutoloaded:false.
cg@2635
    65
    projectDefinitionClass loadExtensions.
cg@2635
    66
    projectDefinitionClass loadAllClassesAsAutoloaded:false.
cg@2635
    67
cg@2635
    68
    module := package module.
cg@2635
    69
    directory := package directory.
cg@2635
    70
cg@2635
    71
    buildDirectory isNil ifTrue:[
cg@2635
    72
        buildDirectory := PreviousBuildDirectory ifNil:[ UserPreferences current buildDirectory ].
cg@2635
    73
        buildDirectory isNil ifTrue:[
cg@2635
    74
            buildDirectory := Filename tempDirectory construct:'stx_build'.
cg@2635
    75
        ].
cg@2635
    76
    ].
cg@2635
    77
    buildDirectory := buildDirectory asFilename.
cg@2635
    78
cg@2635
    79
    "/ self validateBuildDirectoryIsPresent.
cg@2635
    80
cg@2635
    81
    PreviousBuildDirectory := buildDirectory.
cg@2635
    82
cg@2635
    83
    "/ UserPreferences current localBuild:true
cg@2635
    84
    UserPreferences current localBuild ifFalse:[
cg@2635
    85
        SourceCodeManager notNil ifTrue:[
cg@2635
    86
            sourceCodeManager := SourceCodeManagerUtilities sourceCodeManagerFor:projectDefinitionClass.
cg@2635
    87
        ]
cg@2635
    88
    ].
cg@2635
    89
    sourceCodeManager := nil.
cg@2635
    90
cg@2635
    91
    myTopDirectory := 
cg@2635
    92
        Smalltalk packagePath 
cg@2635
    93
            detect:[:aPath |
cg@2635
    94
                (aPath asFilename / 'stx' / 'include') exists
cg@2635
    95
                and: [ (aPath asFilename / 'stx' / 'rules') exists ]]
cg@2635
    96
            ifNone:nil.       
cg@2635
    97
    myTopDirectory isNil ifTrue:[
cg@2635
    98
        self error:('Cannot figure out my top directory (where stx/include and stx/rules are)')
cg@2635
    99
    ].
cg@2635
   100
    myTopDirectory := myTopDirectory asFilename.
cg@2635
   101
    mySTXTopDirectory := myTopDirectory / 'stx'.
cg@2635
   102
cg@2635
   103
    self setupBuildDirectory.
cg@2635
   104
    self activityNotification:'Generating stc directory...'.
cg@2635
   105
    self copySTCDirectoryForBuild.
cg@2635
   106
    self activityNotification:'Generating source files...'.
cg@2635
   107
    self generateSourceFiles.
cg@2635
   108
    self activityNotification:'Generating dlls for linkage...'.
cg@2635
   109
    self copyDLLsForLinkage.
cg@2635
   110
    self activityNotification:'Generating support files for linkage...'.
cg@2635
   111
    self copySupportFilesForLinkage.
cg@2635
   112
    self copyStartupFilesFromSmalltalk.
cg@2635
   113
cg@2635
   114
    self activityNotification:'Executing make...'.
cg@2635
   115
    self makeWithOutputTo:stdOut errorTo:stdErr.
cg@2611
   116
!
cg@2611
   117
cg@2611
   118
buildWithOutputTo:stdOut errorTo:stdErr
cg@2611
   119
    "/ intermediate - this will move into a commonly used utility class
cg@2611
   120
    "/ (where all the project code support will be collected).
cg@2611
   121
cg@2596
   122
    |module directory|
cg@2596
   123
cg@2596
   124
    projectDefinitionClass := ProjectDefinition definitionClassForPackage:package.
cg@2596
   125
    projectDefinitionClass isNil ifTrue:[
cg@2596
   126
        self error:('Missing ProjectDefinition class for "',package asString,'"')
cg@2596
   127
    ].
cg@2596
   128
cg@2596
   129
    "/ ensure that everything is loaded...
cg@2596
   130
    projectDefinitionClass loadAsAutoloaded:false.
cg@2596
   131
    projectDefinitionClass loadExtensions.
cg@2596
   132
    projectDefinitionClass loadAllClassesAsAutoloaded:false.
cg@2596
   133
cg@2596
   134
    module := package module.
cg@2596
   135
    directory := package directory.
cg@2596
   136
cg@2596
   137
    buildDirectory isNil ifTrue:[
cg@2634
   138
        buildDirectory := PreviousBuildDirectory ifNil:[ UserPreferences current buildDirectory ].
cg@2634
   139
        buildDirectory isNil ifTrue:[
cg@2634
   140
            buildDirectory := Filename tempDirectory construct:'stx_build'.
cg@2634
   141
        ].
cg@2596
   142
    ].
cg@2596
   143
    buildDirectory := buildDirectory asFilename.
cg@2596
   144
cg@2596
   145
    "/ self validateBuildDirectoryIsPresent.
cg@2596
   146
cg@2596
   147
    PreviousBuildDirectory := buildDirectory.
cg@2596
   148
cg@2596
   149
    "/ UserPreferences current localBuild:true
cg@2596
   150
    UserPreferences current localBuild ifFalse:[
cg@2596
   151
        SourceCodeManager notNil ifTrue:[
cg@2596
   152
            sourceCodeManager := SourceCodeManagerUtilities sourceCodeManagerFor:projectDefinitionClass.
cg@2596
   153
        ]
cg@2596
   154
    ].
cg@2596
   155
    sourceCodeManager := nil.
cg@2596
   156
cg@2598
   157
    myTopDirectory := 
cg@2596
   158
        Smalltalk packagePath 
cg@2596
   159
            detect:[:aPath |
cg@2596
   160
                (aPath asFilename / 'stx' / 'include') exists
cg@2596
   161
                and: [ (aPath asFilename / 'stx' / 'rules') exists ]]
cg@2596
   162
            ifNone:nil.       
cg@2598
   163
    myTopDirectory isNil ifTrue:[
cg@2598
   164
        self error:('Cannot figure out my top directory (where stx/include and stx/rules are)')
cg@2596
   165
    ].
cg@2598
   166
    myTopDirectory := myTopDirectory asFilename.
cg@2598
   167
    mySTXTopDirectory := myTopDirectory / 'stx'.
cg@2613
   168
cg@2596
   169
    self setupBuildDirectory.
cg@2628
   170
    self activityNotification:'Generating stc directory...'.
cg@2599
   171
    self copySTCDirectoryForBuild.
cg@2628
   172
    self activityNotification:'Generating source files...'.
cg@2596
   173
    self generateSourceFiles.
cg@2628
   174
    self activityNotification:'Generating dlls for linkage...'.
cg@2600
   175
    self copyDLLsForLinkage.
cg@2628
   176
    self activityNotification:'Generating support files for linkage...'.
cg@2600
   177
    self copySupportFilesForLinkage.
cg@2600
   178
    self copyStartupFilesFromSmalltalk.
cg@2596
   179
cg@2628
   180
    self activityNotification:'Executing make...'.
cg@2611
   181
    self makeWithOutputTo:stdOut errorTo:stdErr.
cg@2596
   182
!
cg@2596
   183
cg@2635
   184
lRelativePath).    
cg@2614
   185
        ]
cg@2614
   186
    ].
cg@2600
   187
!
cg@2600
   188
cg@2596
   189
!
cg@2596
   190
cg@2598
   191
!
cg@2598
   192
cg@2600
   193
!
cg@2600
   194
cg@2599
   195
!
cg@2599
   196
cg@2600
   197
!
cg@2600
   198
cg@2600
   199
!
cg@2600
   200
cg@2596
   201
!
cg@2596
   202
cg@2596
   203
!
cg@2596
   204
cg@2596
   205
!
cg@2596
   206
cg@2596
   207
!
cg@2596
   208
cg@2611
   209
!
cg@2611
   210
cg@2635
   211
!
cg@2596
   212
cg@2596
   213
! !
cg@2596
   214
cg@2596
   215
!ProjectBuilder class methodsFor:'documentation'!
cg@2596
   216
cg@2596
   217
version_CVS
cg@2596
   218
    ^ '$Header$'
cg@2596
   219
! !