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