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