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