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