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