author | Claus Gittinger <cg@exept.de> |
Tue, 14 Nov 1995 20:02:34 +0100 | |
changeset 544 | d78012b20769 |
parent 530 | 07d0bce293c9 |
child 617 | 427245e28240 |
permissions | -rw-r--r-- |
89 | 1 |
" |
236 | 2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
203 | 3 |
All Rights Reserved |
89 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
1 | 12 |
|
236 | 13 |
'From Smalltalk/X, Version:2.10.4 on 5-feb-1995 at 11:58:37 pm'! |
14 |
||
1 | 15 |
Object subclass:#Project |
315 | 16 |
instanceVariableNames:'name changeSet views directoryName properties packageName' |
17 |
classVariableNames:'CurrentProject SystemProject NextSequential' |
|
203 | 18 |
poolDictionaries:'' |
19 |
category:'System-Support' |
|
1 | 20 |
! |
21 |
||
89 | 22 |
!Project class methodsFor:'documentation'! |
23 |
||
24 |
copyright |
|
25 |
" |
|
26 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
203 | 27 |
All Rights Reserved |
89 | 28 |
|
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
! |
|
37 |
||
38 |
version |
|
530
07d0bce293c9
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
39 |
^ '$Header: /cvs/stx/stx/libbasic/Project.st,v 1.28 1995-11-11 15:26:10 cg Exp $' |
89 | 40 |
! |
41 |
||
42 |
documentation |
|
43 |
" |
|
338 | 44 |
this class is still under construction (especially the build features are unfinished). |
235 | 45 |
Currently, all it does is keep track of per-project views |
46 |
(to hide or show them), define the directory when filing-out, |
|
47 |
and define packageName for new classes and methods. |
|
48 |
||
49 |
Future: |
|
50 |
- keep track of per-project changes |
|
51 |
- allow speficiation of the type of the project (application, library, etc) |
|
52 |
- allow building of whatever the target (as defined by the type) is |
|
53 |
(this will allow build of class libs and apps by clicking a button) |
|
54 |
- allow removal of project specific classes, methods etc. |
|
89 | 55 |
" |
56 |
! ! |
|
57 |
||
236 | 58 |
!Project class methodsFor:'initialization'! |
59 |
||
60 |
initialize |
|
338 | 61 |
SystemProject isNil ifTrue:[ |
315 | 62 |
NextSequential := 1. |
338 | 63 |
SystemProject := self new name:'default'. |
64 |
SystemProject packageName:'private'. |
|
236 | 65 |
" |
66 |
the SystemProject does not keep a record if changes, |
|
67 |
but instead depends on the changes file - recording anything there. |
|
68 |
" |
|
69 |
SystemProject changeSet:nil. |
|
338 | 70 |
]. |
71 |
||
72 |
CurrentProject := SystemProject. |
|
236 | 73 |
|
315 | 74 |
" |
75 |
Project initialize |
|
76 |
" |
|
236 | 77 |
! ! |
78 |
||
79 |
!Project class methodsFor:'instance creation'! |
|
80 |
||
81 |
new |
|
82 |
^ self basicNew initialize |
|
83 |
! ! |
|
84 |
||
1 | 85 |
!Project class methodsFor:'accessing'! |
86 |
||
87 |
current |
|
10 | 88 |
"return the currently active project" |
89 |
||
1 | 90 |
^ CurrentProject |
91 |
||
362 | 92 |
" |
93 |
Project current |
|
94 |
" |
|
1 | 95 |
! |
96 |
||
97 |
current:aProject |
|
10 | 98 |
"set the currently active project" |
99 |
||
315 | 100 |
CurrentProject := aProject. |
101 |
self changed:#currentProject |
|
334 | 102 |
! |
103 |
||
336 | 104 |
defaultProject |
105 |
"return the SystemDefault project" |
|
106 |
||
107 |
^ SystemProject. |
|
108 |
! |
|
109 |
||
334 | 110 |
setDefaultProject |
111 |
"set the currently active project to be the SystemDEfault project" |
|
112 |
||
113 |
self current:SystemProject. |
|
362 | 114 |
! |
115 |
||
116 |
currentPackageName |
|
369 | 117 |
CurrentProject notNil ifTrue:[ |
118 |
^ CurrentProject packageName |
|
119 |
]. |
|
120 |
^ 'no package' |
|
362 | 121 |
|
122 |
" |
|
123 |
Project currentPackageName |
|
124 |
" |
|
1 | 125 |
! ! |
126 |
||
149 | 127 |
!Project class methodsFor:'changes management'! |
128 |
||
129 |
addMethodChange:aMethod in:aClass |
|
130 |
"add a change for a method to the current project" |
|
131 |
||
235 | 132 |
|p c| |
149 | 133 |
|
134 |
p := CurrentProject. |
|
135 |
(p notNil |
|
235 | 136 |
and:[(c := p changeSet) notNil]) ifTrue:[ |
137 |
c addMethodChange:aMethod in:aClass |
|
203 | 138 |
] |
139 |
! |
|
140 |
||
149 | 141 |
currentProjectDirectory |
142 |
"return the name of the directory to use for fileOut. |
|
235 | 143 |
The returned name already includes a file-separator at the end, |
144 |
so the filename can be concatenated to it." |
|
149 | 145 |
|
146 |
|p dirName| |
|
147 |
||
148 |
p := CurrentProject. |
|
149 |
p notNil ifTrue:[ |
|
203 | 150 |
dirName := p directory |
149 | 151 |
] ifFalse:[ |
203 | 152 |
dirName := '.' |
149 | 153 |
]. |
154 |
^ dirName , Filename separator asString |
|
236 | 155 |
! |
149 | 156 |
|
236 | 157 |
addMethodCategoryChange:aMethod category:newCategory in:aClass |
158 |
|p c| |
|
13 | 159 |
|
236 | 160 |
p := CurrentProject. |
161 |
(p notNil |
|
162 |
and:[(c := p changeSet) notNil]) ifTrue:[ |
|
163 |
c addMethodCategoryChange:aMethod category:newCategory in:aClass |
|
164 |
] |
|
414 | 165 |
! |
166 |
||
167 |
addMethodPrivacyChange:aMethod in:aClass |
|
168 |
|p c| |
|
169 |
||
170 |
p := CurrentProject. |
|
171 |
(p notNil |
|
172 |
and:[(c := p changeSet) notNil]) ifTrue:[ |
|
173 |
c addMethodPrivacyChange:aMethod in:aClass |
|
174 |
] |
|
175 |
||
176 |
"Modified: 27.8.1995 / 22:48:17 / claus" |
|
13 | 177 |
! ! |
178 |
||
1 | 179 |
!Project methodsFor:'accessing'! |
180 |
||
236 | 181 |
packageName |
182 |
^ packageName |
|
1 | 183 |
! |
184 |
||
185 |
changeSet |
|
186 |
^ changeSet |
|
187 |
! |
|
188 |
||
189 |
name |
|
190 |
^ name |
|
191 |
! |
|
192 |
||
236 | 193 |
views |
330 | 194 |
^ views asArray |
235 | 195 |
! |
196 |
||
236 | 197 |
name:aString |
315 | 198 |
name := aString. |
199 |
self == CurrentProject ifTrue:[ |
|
200 |
Project changed:#name |
|
201 |
] |
|
2 | 202 |
! |
203 |
||
236 | 204 |
views:aSetOfViews |
330 | 205 |
views := WeakIdentitySet withAll:aSetOfViews |
73 | 206 |
! |
207 |
||
236 | 208 |
changeSet:aChangeSet |
209 |
changeSet := aChangeSet |
|
73 | 210 |
! |
211 |
||
236 | 212 |
packageName:aStringOrSymbol |
315 | 213 |
packageName := aStringOrSymbol asSymbol. |
214 |
self == CurrentProject ifTrue:[ |
|
215 |
Project changed:#package |
|
216 |
] |
|
217 |
! |
|
218 |
||
219 |
directory |
|
220 |
directoryName isNil ifTrue:[^ '.']. |
|
221 |
^ directoryName |
|
222 |
! |
|
223 |
||
224 |
directory:aDirectoryName |
|
225 |
directoryName := aDirectoryName. |
|
226 |
self == CurrentProject ifTrue:[ |
|
227 |
Project changed:#directory |
|
228 |
] |
|
1 | 229 |
! ! |
230 |
||
356 | 231 |
!Project methodsFor:'queries'! |
232 |
||
233 |
classes |
|
234 |
"return a collection of classes belonging to that project" |
|
235 |
||
236 |
|classes| |
|
237 |
||
238 |
properties notNil ifTrue:[classes := properties at:#classes ifAbsent:nil]. |
|
239 |
classes isNil ifTrue:[ |
|
240 |
classes := OrderedCollection new. |
|
241 |
Smalltalk allClassesDo:[:aClass | aClass package = packageName ifTrue:[classes add:aClass]]. |
|
242 |
classes isEmpty ifTrue:[^ nil]. |
|
243 |
]. |
|
244 |
^ classes |
|
245 |
||
246 |
! |
|
247 |
||
248 |
individualMethods |
|
249 |
"return a collection of individual methods belonging to that project, |
|
250 |
only methods are returned which are not contained in the |
|
251 |
projects class set." |
|
252 |
||
253 |
|classes methods| |
|
254 |
||
375 | 255 |
classes := self classes. |
256 |
classes notNil ifTrue:[ |
|
257 |
classes := classes asIdentitySet. |
|
258 |
] ifFalse:[ |
|
259 |
classes := #() |
|
260 |
]. |
|
356 | 261 |
|
262 |
methods := IdentitySet new. |
|
263 |
Smalltalk allBehaviorsDo:[:cls | |
|
264 |
(classes isNil or:[(classes includes:cls) not]) ifTrue:[ |
|
265 |
cls methodArray do:[:m | |
|
266 |
m package = packageName ifTrue:[ |
|
267 |
methods add:m |
|
268 |
] |
|
269 |
]. |
|
270 |
cls class methodArray do:[:m | |
|
271 |
m package = packageName ifTrue:[ |
|
272 |
methods add:m |
|
273 |
] |
|
274 |
]. |
|
275 |
] |
|
276 |
]. |
|
277 |
^ methods asArray |
|
278 |
||
279 |
" |
|
280 |
Project current classes |
|
281 |
Project current individualMethods |
|
282 |
" |
|
283 |
! ! |
|
284 |
||
10 | 285 |
!Project methodsFor:'views'! |
286 |
||
287 |
addView:aView |
|
235 | 288 |
views notNil ifTrue:[views add:aView] |
10 | 289 |
! |
290 |
||
291 |
removeView:aView |
|
235 | 292 |
views notNil ifTrue:[views remove:aView ifAbsent:[]] |
10 | 293 |
! |
294 |
||
295 |
showViews |
|
235 | 296 |
views notNil ifTrue:[ |
297 |
views do:[:aView | |
|
298 |
aView notNil ifTrue:[aView rerealize] |
|
203 | 299 |
] |
10 | 300 |
]. |
301 |
! |
|
302 |
||
303 |
hideViews |
|
235 | 304 |
"hide all views of this project" |
305 |
||
306 |
views notNil ifTrue:[ |
|
307 |
views do:[:aView | |
|
308 |
aView notNil ifTrue:[aView unrealize] |
|
203 | 309 |
] |
10 | 310 |
]. |
338 | 311 |
! |
312 |
||
313 |
destroyViews |
|
314 |
"destroy all views of this project" |
|
315 |
||
316 |
views notNil ifTrue:[ |
|
317 |
views do:[:aView | |
|
318 |
aView notNil ifTrue:[aView destroy] |
|
319 |
] |
|
320 |
]. |
|
10 | 321 |
! ! |
322 |
||
236 | 323 |
!Project methodsFor:'initialization'! |
324 |
||
325 |
initialize |
|
338 | 326 |
|numString| |
327 |
||
330 | 328 |
views := WeakIdentitySet new. |
338 | 329 |
numString := NextSequential printString. |
315 | 330 |
NextSequential := NextSequential + 1. |
338 | 331 |
|
332 |
name := 'new Project-' , numString. |
|
333 |
packageName := 'private-' , numString. |
|
356 | 334 |
"/ changeSet := ChangeSet new. |
236 | 335 |
self directory:'.' |
336 |
! ! |
|
337 |
||
338 |
!Project methodsFor:'properties'! |
|
339 |
||
340 |
properties |
|
341 |
^ properties |
|
342 |
! |
|
343 |
||
344 |
properties:p |
|
345 |
properties := p |
|
346 |
! |
|
347 |
||
348 |
type |
|
349 |
"return the type of project" |
|
350 |
||
351 |
^ properties at:#type ifAbsent:[#application] |
|
352 |
! |
|
353 |
||
354 |
type:aSymbol |
|
355 |
"set the projects type" |
|
356 |
||
357 |
(#(application library smalltalk) includes:aSymbol) ifFalse:[ |
|
358 |
self warn:'invalid project type'. |
|
359 |
^ self |
|
360 |
]. |
|
361 |
properties at:#type put:aSymbol |
|
362 |
! ! |
|
363 |
||
2 | 364 |
!Project methodsFor:'maintenance'! |
365 |
||
13 | 366 |
buildProject |
367 |
OperatingSystem executeCommand:('cd ' , self directory , ' ; make') |
|
368 |
! |
|
369 |
||
2 | 370 |
createProjectFiles |
371 |
"actually, creates all files to do a make in the project directory" |
|
372 |
||
356 | 373 |
directoryName asFilename exists ifFalse:[ |
374 |
(self confirm:'create new projectDirectory: ' , directoryName) |
|
375 |
ifFalse:[^ self]. |
|
376 |
OperatingSystem recursiveCreateDirectory:directoryName. |
|
13 | 377 |
]. |
2 | 378 |
self createMakefile. |
379 |
self createSourcefiles. |
|
13 | 380 |
self createProtoMakefile. |
2 | 381 |
! |
382 |
||
362 | 383 |
findTopFrom:directoryName |
384 |
"returns the relative path from directoryName to the TOP |
|
385 |
directory." |
|
386 |
||
387 |
|topName relParent foundTop| |
|
388 |
||
389 |
"/ find TOP |
|
390 |
relParent := '..'. |
|
391 |
foundTop := false. |
|
392 |
[foundTop] whileFalse:[ |
|
393 |
topName := directoryName , '/' , relParent. |
|
394 |
topName asFilename pathName = '/' ifTrue:[ |
|
395 |
self warn:'could not find TOP; assume absoulte path to TOP'. |
|
396 |
topName := '/usr/local/lib/smalltalk'. |
|
397 |
foundTop := true. |
|
398 |
] ifFalse:[ |
|
399 |
(topName , '/configurations') asFilename exists ifTrue:[ |
|
400 |
(topName , '/include') asFilename exists ifTrue:[ |
|
401 |
foundTop := true. |
|
402 |
topName := relParent. |
|
403 |
] |
|
404 |
]. |
|
405 |
foundTop ifFalse:[ |
|
406 |
relParent := relParent , '/..'. |
|
407 |
] |
|
408 |
] |
|
409 |
]. |
|
410 |
^ topName |
|
411 |
! |
|
412 |
||
2 | 413 |
createSourcefiles |
235 | 414 |
"creates all Smalltalk-source files in the project directory" |
2 | 415 |
|
356 | 416 |
|classes methods methodClasses dir stream| |
2 | 417 |
|
236 | 418 |
dir := FileDirectory directoryNamed:self directory. |
419 |
Transcript showCr:'creating sources in ' , dir pathName , ' ...'; endEntry. |
|
13 | 420 |
|
235 | 421 |
classes := self classes. |
362 | 422 |
classes isNil ifTrue:[ |
423 |
self warn:'no classes in current project' |
|
424 |
]. |
|
425 |
||
235 | 426 |
classes notNil ifTrue:[ |
315 | 427 |
classes do:[:aClass | |
428 |
aClass isLoaded ifFalse:[ |
|
429 |
aClass autoload. |
|
430 |
]. |
|
362 | 431 |
]. |
432 |
classes := classes topologicalSort:[:a :b | a isSubclassOf:b]. |
|
433 |
||
434 |
classes do:[:aClass | |
|
435 |
Transcript show:' ... '; showCr:aClass name, '.st'; endEntry. |
|
315 | 436 |
aClass fileOutIn:dir |
437 |
] |
|
2 | 438 |
]. |
356 | 439 |
|
440 |
methods := self individualMethods. |
|
441 |
methods notNil ifTrue:[ |
|
442 |
methods := methods asIdentitySet. |
|
443 |
" |
|
444 |
get classes ... |
|
445 |
" |
|
446 |
methodClasses := IdentitySet new. |
|
447 |
methods do:[:m | |
|
448 |
|mCls| |
|
449 |
||
450 |
mCls := m who at:1. |
|
451 |
mCls isMeta ifTrue:[ |
|
452 |
mCls := mCls soleInstance. |
|
453 |
]. |
|
454 |
methodClasses add:mCls]. |
|
455 |
" |
|
456 |
fileOut by class |
|
457 |
" |
|
458 |
methodClasses do:[:cls | |
|
362 | 459 |
stream := (self directory asFilename construct:(cls name , '.chg')) writeStream. |
356 | 460 |
|
362 | 461 |
Transcript show:' ... '; showCr:cls name, '.chg'; endEntry. |
356 | 462 |
methods do:[:m | |
463 |
|mCls| |
|
464 |
||
465 |
mCls := m who at:1. |
|
466 |
(mCls == cls or:[mCls == cls class]) ifTrue:[ |
|
362 | 467 |
mCls fileOutMethod:m on:stream. |
468 |
]. |
|
469 |
stream cr. |
|
356 | 470 |
]. |
471 |
stream close. |
|
472 |
]. |
|
473 |
]. |
|
2 | 474 |
! |
475 |
||
476 |
createMakefile |
|
477 |
"creates an initial makefile, which will recreate a correct |
|
478 |
Makefile, then compile all" |
|
479 |
||
362 | 480 |
|d f out in topName| |
2 | 481 |
|
13 | 482 |
Transcript showCr:'creating Makefile'. |
483 |
||
356 | 484 |
d := directoryName asFilename. |
2 | 485 |
f := d construct:'Makefile'. |
13 | 486 |
f exists ifTrue:[ |
203 | 487 |
f renameTo:(d construct:'Makefile.bak') |
13 | 488 |
]. |
2 | 489 |
out := f writeStream. |
13 | 490 |
out isNil ifTrue:[ |
203 | 491 |
self warn:'cannot create Makefile'. |
492 |
^ self |
|
13 | 493 |
]. |
494 |
in := Smalltalk systemFileStreamFor:'rules/stdHeader'. |
|
2 | 495 |
out nextPutAll:in contents asString. |
496 |
in close. |
|
362 | 497 |
|
498 |
topName := self findTopFrom:directoryName. |
|
499 |
||
13 | 500 |
out nextPutAll:'#TOP=/usr/local/lib/smalltalk'; cr. |
362 | 501 |
out nextPutAll:'TOP=' , topName; cr. |
2 | 502 |
out nextPutAll:'target:'; cr. |
503 |
out tab; nextPutAll:'touch Make.proto'; cr. |
|
504 |
out tab; nextPutAll:'$(MAKE) Makefile'; cr. |
|
505 |
out tab; nextPutAll:'make'; cr; cr. |
|
506 |
||
362 | 507 |
in := Smalltalk systemFileStreamFor:'configurations/COMMON/defines'. |
508 |
out nextPutAll:in contents asString. |
|
509 |
in close. |
|
510 |
||
511 |
in := Smalltalk systemFileStreamFor:'configurations/vendorConf'. |
|
512 |
out nextPutAll:in contents asString. |
|
513 |
in close. |
|
514 |
||
13 | 515 |
in := Smalltalk systemFileStreamFor:'configurations/myConf'. |
2 | 516 |
out nextPutAll:in contents asString. |
517 |
in close. |
|
362 | 518 |
|
13 | 519 |
in := Smalltalk systemFileStreamFor:'rules/stdRules'. |
2 | 520 |
out nextPutAll:in contents asString. |
521 |
in close. |
|
522 |
out close |
|
523 |
! |
|
524 |
||
525 |
createProtoMakefile |
|
526 |
"creates a Make.proto file" |
|
527 |
||
362 | 528 |
|d f s type appName libName startUpClass startUpSelector |
529 |
topName classes| |
|
2 | 530 |
|
362 | 531 |
topName := self findTopFrom:directoryName. |
2 | 532 |
|
13 | 533 |
Transcript showCr:'creating Make.proto'. |
534 |
||
356 | 535 |
d := directoryName asFilename. |
2 | 536 |
f := d construct:'Make.proto'. |
537 |
f exists ifTrue:[ |
|
203 | 538 |
f renameTo:(d construct:'Make.proto.bak') |
2 | 539 |
]. |
540 |
s := f writeStream. |
|
13 | 541 |
s isNil ifTrue:[ |
203 | 542 |
self warn:'cannot create prototype Makefile'. |
543 |
^ self |
|
13 | 544 |
]. |
2 | 545 |
s nextPutAll:'# |
362 | 546 |
# ' , Smalltalk timeStamp , ' |
547 |
# |
|
235 | 548 |
# created by Smalltalks Project support |
2 | 549 |
# |
362 | 550 |
|
551 |
||
552 |
# the next line defines the path to the TOP directory, |
|
553 |
# (where the directories "configurations" and "include" are found) |
|
554 |
# |
|
555 |
#TOP=/usr/local/lib/smalltalk |
|
556 |
TOP=' , topName ,' |
|
557 |
||
558 |
# |
|
559 |
# add any subdirectories that have to be visited by make |
|
560 |
# |
|
561 |
SUBDIRS= |
|
562 |
||
563 |
# |
|
564 |
# do not change |
|
565 |
# |
|
2 | 566 |
SHELL=/bin/sh |
567 |
||
362 | 568 |
'. |
569 |
||
570 |
s nextPutAll:'# |
|
571 |
# set the stc options |
|
572 |
# |
|
573 |
STCOPT=$(DEFAULT_STCOPT) |
|
574 |
# STCOPT=+optspace2 |
|
575 |
# STCOPT=+optspace2 -warnNonStandard |
|
576 |
||
577 |
# |
|
578 |
# and packageName option |
|
579 |
# |
|
580 |
STCLOCALOPT=''-Pprivate-classes-(libapp)'' |
|
2 | 581 |
|
582 |
'. |
|
583 |
||
356 | 584 |
type := #library. |
585 |
appName := 'app'. |
|
586 |
libName := 'lib'. |
|
587 |
startUpClass := 'Smalltalk'. |
|
588 |
startUpSelector := 'start'. |
|
13 | 589 |
|
356 | 590 |
properties notNil ifTrue:[ |
591 |
type := properties at:#projectType ifAbsent:type. |
|
592 |
appName := properties at:#applicationName ifAbsent:appName. |
|
593 |
startUpClass := properties at:#startupClass ifAbsent:startUpClass. |
|
594 |
startUpSelector := properties at:#startupSelector ifAbsent:startUpSelector. |
|
595 |
]. |
|
596 |
||
362 | 597 |
s nextPutAll:'# |
598 |
# define the name of the library to create |
|
599 |
# |
|
600 |
'. |
|
601 |
s nextPutAll:'LIBNAME=lib' , appName; cr; cr. |
|
602 |
||
603 |
s nextPutAll:'# |
|
604 |
# the target rule: |
|
605 |
# |
|
606 |
all:: abbrev.stc objs genClassList $(OBJTARGET) |
|
607 |
||
608 |
'. |
|
2 | 609 |
|
610 |
type == #executable ifTrue:[ |
|
362 | 611 |
s nextPutAll:'PROGS = ' , appName; cr. |
612 |
s nextPutAll:('STARTUP_CLASS=' , startUpClass); cr. |
|
613 |
s nextPutAll:'STARTUP_SELECTOR="' , startUpSelector; nextPutAll:'"'; cr. |
|
2 | 614 |
]. |
615 |
||
362 | 616 |
s nextPutAll:'# |
617 |
# define the object files that are to be created |
|
618 |
# |
|
619 |
'. |
|
2 | 620 |
s nextPutAll:'OBJS='. |
621 |
||
362 | 622 |
(classes := self classes) notNil ifTrue:[ |
623 |
classes do:[:aClass | |
|
624 |
|abbrev| |
|
625 |
||
626 |
s nextPutAll:' \'. s cr. |
|
627 |
abbrev := Smalltalk fileNameForClass:aClass name. |
|
628 |
s nextPutAll:' '; nextPutAll:abbrev; nextPutAll:'.o'. |
|
629 |
]. |
|
2 | 630 |
]. |
631 |
s cr; cr. |
|
632 |
||
362 | 633 |
s nextPutAll:'# |
634 |
# dependencies: |
|
635 |
# |
|
636 |
I=$(TOP)/include |
|
637 |
RT_STUFF=$(I)/Object.H $(I)/stc.h $(I)/stcIntern.h |
|
638 |
||
639 |
'. |
|
640 |
classes notNil ifTrue:[ |
|
641 |
classes do:[:aClass | |
|
642 |
|abbrev| |
|
643 |
||
644 |
abbrev := Smalltalk fileNameForClass:aClass name. |
|
645 |
s nextPutAll:abbrev; nextPutAll:'.o: '. |
|
646 |
s nextPutAll:abbrev; nextPutAll:'.st '. |
|
647 |
aClass allSuperclassesDo:[:superClass| |
|
648 |
s nextPutAll:'$(I)/'. |
|
649 |
s nextPutAll:(Smalltalk fileNameForClass:superClass name) , '.H '. |
|
650 |
]. |
|
651 |
s nextPutAll:'$(RT_STUFF)'; cr. |
|
652 |
]. |
|
653 |
]. |
|
654 |
s cr; cr. |
|
2 | 655 |
|
656 |
type == #executable ifTrue:[ |
|
203 | 657 |
s nextPutAll:'all:: $(PROGS)'; cr. |
2 | 658 |
|
203 | 659 |
s nextPutAll:appName. |
660 |
s nextPutAll:':: main.o classList.o $(OBJS)'; cr. |
|
661 |
s tab; nextPutAll:'$(LD) $(ST_LDFLAG) $(LDFLAGS) -o '; |
|
662 |
nextPutAll:appName; |
|
663 |
nextPutAll:' \'; cr. |
|
664 |
s tab; tab; nextPutAll:'$(CRT0) main.$(O) classList.$(O) $(OBJS) $(EXTRA_OBJ) $(LIBOBJS) \'; cr. |
|
665 |
s tab; tab; nextPutAll:'$(LIBRUNDIR)/hidata.o $(LIBRUN) \'; cr. |
|
666 |
s tab; tab; nextPutAll:'$(MATHLIB) $(EXTRALIBS) -lXext $(SYSLIBS) $(OTHERLIBS) $(CRTN)'; cr. |
|
2 | 667 |
]. |
668 |
||
669 |
s close |
|
670 |
! ! |
|
671 |
||
672 |
!Project methodsFor:'specifications'! |
|
673 |
||
674 |
readSpec |
|
675 |
|s chunk fileName| |
|
676 |
||
677 |
fileName := (properties at:#directoryName) asFilename construct:'.project'. |
|
678 |
s := fileName readStream. |
|
679 |
s isNil ifTrue:[^ self]. |
|
680 |
[s atEnd] whileFalse:[ |
|
203 | 681 |
chunk := s nextChunk. |
682 |
Compiler evaluate:chunk receiver:properties notifying:nil |
|
2 | 683 |
]. |
684 |
s close. |
|
685 |
||
686 |
"(Project new directory:'../projects/Clock') readSpec" |
|
687 |
! |
|
688 |
||
689 |
saveSpec |
|
690 |
|f d s| |
|
691 |
||
692 |
d := (properties at:#directoryName) asFilename. |
|
693 |
d exists ifFalse:[ |
|
203 | 694 |
self error:'directory does not exist'. |
695 |
^ self |
|
2 | 696 |
]. |
697 |
f := d construct:'.project'. |
|
698 |
s := f writeStream. |
|
699 |
s isNil ifTrue:[^ self]. |
|
700 |
properties associationsDo:[:aProp | |
|
203 | 701 |
(aProp == #directoryName) ifFalse:[ |
702 |
s nextChunkPut:('self at:' , aProp key storeString, |
|
703 |
' put:' , aProp value storeString). |
|
704 |
s cr |
|
705 |
] |
|
2 | 706 |
]. |
707 |
s close |
|
708 |
||
709 |
"((Project new directory:'../projects/Clock') readSpec |
|
203 | 710 |
directory:'../projects/xxx') saveSpec" |
2 | 711 |
! ! |
712 |
||
1 | 713 |
Project initialize! |