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