author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Tue, 28 Feb 2012 15:21:27 +0100 | |
changeset 1051 | ce27ce3ab6c1 |
parent 958 | de63d3808db8 |
child 1078 | bdae84e9a790 |
permissions | -rw-r--r-- |
757 | 1 |
" |
2 |
Copyright (c) 2007-2010 Jan Vrany |
|
3 |
Copyright (c) 2009-2010 eXept Software AG |
|
4 |
||
5 |
Permission is hereby granted, free of charge, to any person |
|
6 |
obtaining a copy of this software and associated documentation |
|
7 |
files (the 'Software'), to deal in the Software without |
|
8 |
restriction, including without limitation the rights to use, |
|
9 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
10 |
copies of the Software, and to permit persons to whom the |
|
11 |
Software is furnished to do so, subject to the following |
|
12 |
conditions: |
|
13 |
||
14 |
The above copyright notice and this permission notice shall be |
|
15 |
included in all copies or substantial portions of the Software. |
|
16 |
||
17 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
18 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
19 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
20 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
21 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
22 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
23 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
24 |
OTHER DEALINGS IN THE SOFTWARE. |
|
25 |
" |
|
409 | 26 |
"{ Package: 'stx:libsvn' }" |
55 | 27 |
|
28 |
"{ NameSpace: SVN }" |
|
29 |
||
492 | 30 |
Task subclass:#FileoutLikeTask |
958 | 31 |
instanceVariableNames:'suppressClasses suppressExtensions suppresBuildSupportFiles |
32 |
packageClassesChanged packageExtensionsChanged extensionMethods' |
|
55 | 33 |
classVariableNames:'' |
34 |
poolDictionaries:'' |
|
35 |
category:'SVN-Tasks' |
|
36 |
! |
|
37 |
||
757 | 38 |
!FileoutLikeTask class methodsFor:'documentation'! |
39 |
||
40 |
copyright |
|
41 |
" |
|
42 |
Copyright (c) 2007-2010 Jan Vrany |
|
43 |
Copyright (c) 2009-2010 eXept Software AG |
|
44 |
||
45 |
Permission is hereby granted, free of charge, to any person |
|
46 |
obtaining a copy of this software and associated documentation |
|
47 |
files (the 'Software'), to deal in the Software without |
|
48 |
restriction, including without limitation the rights to use, |
|
49 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
50 |
copies of the Software, and to permit persons to whom the |
|
51 |
Software is furnished to do so, subject to the following |
|
52 |
conditions: |
|
53 |
||
54 |
The above copyright notice and this permission notice shall be |
|
55 |
included in all copies or substantial portions of the Software. |
|
56 |
||
57 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
58 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
59 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
60 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
61 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
62 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
63 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
64 |
OTHER DEALINGS IN THE SOFTWARE. |
|
65 |
||
66 |
" |
|
67 |
! ! |
|
55 | 68 |
|
864
a3f4f2493928
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
757
diff
changeset
|
69 |
!FileoutLikeTask class methodsFor:'others'! |
a3f4f2493928
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
757
diff
changeset
|
70 |
|
a3f4f2493928
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
757
diff
changeset
|
71 |
version_CVS |
a3f4f2493928
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
757
diff
changeset
|
72 |
^ '$Header$' |
a3f4f2493928
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
757
diff
changeset
|
73 |
! ! |
a3f4f2493928
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
757
diff
changeset
|
74 |
|
250 | 75 |
!FileoutLikeTask methodsFor:'accessing'! |
76 |
||
77 |
extensionMethods |
|
78 |
^ extensionMethods |
|
79 |
! |
|
80 |
||
81 |
extensionMethods:aCollection"of Methods" |
|
82 |
||
83 |
extensionMethods := aCollection. |
|
84 |
||
85 |
"Modified: / 14-05-2009 / 13:38:15 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
757 | 86 |
! |
87 |
||
88 |
filesToGenerate |
|
89 |
^ self packageDefinition fileNamesToGenerate keys |
|
90 |
||
91 |
" |
|
92 |
SVN::CommitTask new |
|
93 |
package: #stx:libsvn; |
|
94 |
buildSupportFiles" |
|
95 |
||
96 |
"Created: / 27-11-2009 / 11:29:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
97 |
"Modified: / 17-11-2010 / 14:08:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
98 |
! |
|
99 |
||
100 |
packageDefinition |
|
101 |
||
102 |
^self workingCopy packageDefinition |
|
103 |
||
104 |
"Created: / 27-11-2009 / 11:27:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
958 | 105 |
! |
106 |
||
107 |
suppresBuildSupportFiles |
|
108 |
^ suppresBuildSupportFiles |
|
109 |
! |
|
110 |
||
111 |
suppresBuildSupportFiles:something |
|
112 |
suppresBuildSupportFiles := something. |
|
113 |
! |
|
114 |
||
115 |
suppressClasses |
|
116 |
^ suppressClasses |
|
117 |
! |
|
118 |
||
119 |
suppressClasses:aBoolean |
|
120 |
suppressClasses := aBoolean. |
|
121 |
! |
|
122 |
||
123 |
suppressExtensions |
|
124 |
^ suppressExtensions |
|
125 |
! |
|
126 |
||
127 |
suppressExtensions:aBoolean |
|
128 |
suppressExtensions := aBoolean. |
|
250 | 129 |
! ! |
130 |
||
55 | 131 |
!FileoutLikeTask methodsFor:'executing - private'! |
132 |
||
133 |
doAddNewContainers |
|
757 | 134 |
|filesAndDirsToAdd filesToAdd containers| |
55 | 135 |
|
757 | 136 |
ActivityNotification notify:'Adding new containers'. |
137 |
containers := self isSelectiveFileoutTask ifTrue:[ |
|
138 |
#() |
|
139 |
] ifFalse:[ |
|
140 |
self containersToFileOut |
|
141 |
]. |
|
142 |
filesAndDirsToAdd := ((StatusCommand new) |
|
143 |
workingCopy:self workingCopy; |
|
144 |
paths:containers; |
|
145 |
execute) |
|
146 |
select:[:wcEntry | wcEntry status isUnversioned ] |
|
147 |
thenCollect:[:wcEntry | wcEntry path ]. |
|
148 |
filesToAdd := filesAndDirsToAdd select: |
|
149 |
[:fname|(workingCopy path / fname) isDirectory not]. |
|
150 |
filesAndDirsToAdd isEmpty ifFalse:[ |
|
151 |
packageClassesChanged := true. |
|
152 |
(AddCommand new) |
|
153 |
workingCopy:self workingCopy; |
|
154 |
paths:filesAndDirsToAdd; |
|
155 |
execute. |
|
156 |
]. |
|
157 |
filesToAdd isEmpty ifFalse:[ |
|
158 |
(PropsetCommand new) |
|
159 |
workingCopy:self workingCopy; |
|
160 |
name:'svn:keywords'; |
|
161 |
value:'Id HeadURL'; |
|
864
a3f4f2493928
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
757
diff
changeset
|
162 |
paths:containers; |
757 | 163 |
execute. |
164 |
(PropsetCommand new) |
|
165 |
workingCopy:self workingCopy; |
|
166 |
name:'svn:eol-style'; |
|
167 |
value:'LF'; |
|
864
a3f4f2493928
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
757
diff
changeset
|
168 |
paths:containers; |
757 | 169 |
execute |
170 |
] |
|
55 | 171 |
|
172 |
"Created: / 11-04-2008 / 10:58:53 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
173 |
"Modified: / 19-08-2009 / 14:00:26 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
864
a3f4f2493928
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
757
diff
changeset
|
174 |
"Modified: / 29-09-2011 / 11:47:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
757 | 175 |
! |
176 |
||
177 |
doCompileCopyrightMethods |
|
178 |
| klasses source | |
|
179 |
||
180 |
(self packageDefinition class includesSelector: #copyright) ifFalse:[^self]. |
|
181 |
ActivityNotification notify:'Compiling #copyright methods...'. |
|
182 |
klasses := self classesToFileOut asArray. |
|
183 |
source := (self packageDefinition class compiledMethodAt: #copyright) source. |
|
184 |
||
185 |
klasses |
|
186 |
withIndexDo:[:cls :index | |
|
187 |
|metaCls| |
|
188 |
metaCls := cls theMetaclass. |
|
189 |
(((metaCls includesSelector:#copyright) not) and:[metaCls programmingLanguage isSmalltalk]) |
|
190 |
ifTrue:[ |
|
191 |
metaCls compile:source classified:'documentation'. |
|
192 |
(metaCls compiledMethodAt:#copyright) |
|
193 |
setPackage:self package asSymbol |
|
194 |
]. |
|
195 |
ProgressNotification |
|
196 |
notify:('Compiling %1 (%2)' bindWith:#copyright |
|
197 |
with:cls nameWithoutPrefix) |
|
1051
ce27ce3ab6c1
Fixes in progress notifications
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
958
diff
changeset
|
198 |
progress:(100 / klasses size) * index. |
757 | 199 |
] |
200 |
||
201 |
"Modified: / 16-08-2009 / 12:59:50 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
202 |
"Created: / 08-04-2010 / 14:31:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
55 | 203 |
! |
204 |
||
205 |
doCompileVersionMethods |
|
757 | 206 |
|klasses versionMethodName| |
55 | 207 |
|
208 |
versionMethodName := SVNSourceCodeManager nameOfVersionMethodInClasses. |
|
757 | 209 |
ActivityNotification notify:'Compiling #version methods...'. |
55 | 210 |
klasses := self classesToFileOut asArray. |
757 | 211 |
klasses |
212 |
withIndexDo:[:cls :index | |
|
213 |
|metaCls| |
|
55 | 214 |
|
757 | 215 |
metaCls := cls theMetaclass. |
216 |
((metaCls includesSelector:versionMethodName) not |
|
217 |
or:[ ((cls perform:versionMethodName asSymbol) startsWith:'$Id') not ]) |
|
218 |
ifTrue:[ |
|
219 |
metaCls compile:(metaCls |
|
220 |
versionMethodTemplateForSourceCodeManager:SVNSourceCodeManager) |
|
221 |
classified:'documentation'. |
|
222 |
(metaCls compiledMethodAt:versionMethodName) |
|
223 |
setPackage:self package asSymbol |
|
224 |
]. |
|
958 | 225 |
SVNSourceCodeManager utilities ensureCorrectVersionMethodsInClass: cls usingManager: SVNSourceCodeManager. |
757 | 226 |
ProgressNotification |
227 |
notify:('Compiling %1 (%2)' bindWith:versionMethodName |
|
228 |
with:cls nameWithoutPrefix) |
|
1051
ce27ce3ab6c1
Fixes in progress notifications
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
958
diff
changeset
|
229 |
progress:(100 / klasses size) * index. |
958 | 230 |
]. |
231 |
||
232 |
self extensionMethodsToFileOut notEmpty ifTrue:[ |
|
233 |
| def | |
|
234 |
||
235 |
"TODO: Not programming language aware..." |
|
236 |
((def := self packageDefinition) class includesSelector: SVNSourceCodeManager nameOfVersionMethodForExtensions) ifFalse:[ |
|
237 |
def class |
|
238 |
compile: |
|
239 |
(SVNSourceCodeManager versionMethodTemplateForSmalltalkFor:SVNSourceCodeManager nameOfVersionMethodForExtensions) |
|
240 |
classified: #documentation |
|
757 | 241 |
] |
958 | 242 |
] |
55 | 243 |
|
244 |
"Created: / 28-05-2008 / 07:43:43 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
245 |
"Modified: / 16-08-2009 / 12:59:50 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
757 | 246 |
"Modified: / 07-07-2011 / 20:15:21 / jv" |
1051
ce27ce3ab6c1
Fixes in progress notifications
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
958
diff
changeset
|
247 |
"Modified: / 24-02-2012 / 11:47:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
55 | 248 |
! |
249 |
||
250 |
doFileOutAll |
|
251 |
||
252 |
self |
|
757 | 253 |
doInitStateVariables; |
254 |
doCompileVersionMethods; |
|
255 |
doCompileCopyrightMethods; |
|
256 |
doCompileSvnRevisionNrMethod:false; |
|
257 |
doCompileSvnRepositoryUrlStringMethod; |
|
258 |
doRenameContainers; |
|
259 |
doFileOutPackageClasses; |
|
260 |
doFileOutPackageExtensions; |
|
261 |
doAddNewContainers; |
|
864
a3f4f2493928
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
757
diff
changeset
|
262 |
doRemoveOldContainers; |
a3f4f2493928
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
757
diff
changeset
|
263 |
doUpdateProjectDefinition; |
a3f4f2493928
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
757
diff
changeset
|
264 |
doUpdateBuildSupportFiles. |
55 | 265 |
|
266 |
"Created: / 17-08-2009 / 18:28:18 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
864
a3f4f2493928
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
757
diff
changeset
|
267 |
"Modified: / 09-08-2011 / 09:28:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
55 | 268 |
! |
269 |
||
270 |
doFileOutPackageClasses |
|
757 | 271 |
|klasses| |
55 | 272 |
|
958 | 273 |
suppressClasses == true ifTrue:[^self]. |
274 |
||
757 | 275 |
ActivityNotification notify:'Filing out package classes'. |
276 |
klasses := self classesToFileOut asArray. |
|
277 |
klasses |
|
278 |
withIndexDo:[:cls :index | |
|
279 |
|clsStream| |
|
280 |
||
281 |
ProgressNotification notify:'Filing out ' , cls nameWithoutPrefix |
|
282 |
progress:(100 / klasses size) * index. |
|
283 |
(self shouldFileOutClass:cls) ifTrue:[self workingCopy fileOutClass: cls]] |
|
55 | 284 |
|
285 |
"Created: / 11-04-2008 / 10:58:16 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
286 |
"Modified: / 19-08-2009 / 13:44:00 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
958 | 287 |
"Modified: / 15-10-2011 / 20:14:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
55 | 288 |
! |
289 |
||
290 |
doFileOutPackageExtensions |
|
291 |
||
958 | 292 |
suppressExtensions == true ifTrue:[^self]. |
293 |
||
757 | 294 |
self extensionMethodsToFileOut isEmpty ifTrue:[^self]. |
295 |
self workingCopy fileOutExtensions: self extensionMethodsToFileOut |
|
55 | 296 |
|
297 |
"Modified: / 07-04-2008 / 08:37:25 / janfrog" |
|
298 |
"Created: / 11-04-2008 / 10:58:36 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
299 |
"Modified: / 14-05-2009 / 13:37:40 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
958 | 300 |
"Modified: / 15-10-2011 / 20:14:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
55 | 301 |
! |
302 |
||
303 |
doInitStateVariables |
|
304 |
packageClassesChanged := self workingCopy packageClassesChanged. |
|
305 |
packageExtensionsChanged := self workingCopy packageExtensionsChanged. |
|
306 |
||
307 |
"Created: / 17-06-2009 / 10:17:04 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
308 |
"Modified: / 13-08-2009 / 10:18:37 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
309 |
! |
|
310 |
||
311 |
doRemoveOldContainers |
|
757 | 312 |
|containers containersToKeep containersToDelete| |
55 | 313 |
|
757 | 314 |
self isSelectiveFileoutTask ifTrue:[ |
315 |
^ self |
|
316 |
]. |
|
317 |
ActivityNotification notify:'Removing old containers'. |
|
55 | 318 |
containers := self workingCopy containers. |
319 |
containersToKeep := self workingCopy containersToKeep. |
|
320 |
containersToDelete := containers \ containersToKeep. |
|
757 | 321 |
containersToDelete isEmpty ifFalse:[ |
322 |
packageClassesChanged := true. |
|
323 |
(DeleteCommand new) |
|
324 |
workingCopy:self workingCopy; |
|
325 |
paths:containersToDelete; |
|
326 |
execute |
|
327 |
]. |
|
328 |
||
329 |
"Created: / 11-04-2008 / 11:00:27 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
330 |
"Modified: / 19-08-2009 / 15:03:51 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
331 |
"Modified: / 08-08-2011 / 14:33:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
332 |
! |
|
333 |
||
334 |
doRenameContainerForClassNamed: new using: renames language: lang |
|
335 |
||
336 |
| old oldC newC | |
|
337 |
old := renames at: new. |
|
338 |
(renames includesKey: old) ifTrue:[ |
|
339 |
self doRenameContainerForClassNamed: old using: renames language: lang. |
|
340 |
]. |
|
341 |
oldC := (SVN::Repository containerNameWithoutSuffixForClassNamed: old) , '.' , lang sourceFileSuffix. |
|
342 |
newC := (SVN::Repository containerNameWithoutSuffixForClassNamed: new) , '.' , lang sourceFileSuffix. |
|
343 |
(workingCopy containerFilenameFor: oldC) exists ifTrue:[ |
|
344 |
packageClassesChanged := true. |
|
345 |
MoveCommand new |
|
346 |
workingCopy: workingCopy; |
|
347 |
src: oldC; |
|
348 |
dst: newC; |
|
349 |
execute. |
|
350 |
]. |
|
55 | 351 |
|
352 |
"Created: / 11-04-2008 / 11:00:27 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
353 |
"Modified: / 19-08-2009 / 15:03:51 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
757 | 354 |
"Created: / 06-08-2011 / 21:33:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
355 |
! |
|
356 |
||
357 |
doRenameContainers |
|
358 |
||
359 |
| renames | |
|
360 |
renames := Dictionary new. |
|
361 |
ChangeSet current do: |
|
362 |
[:chg| |
|
363 |
chg isClassRenameChange ifTrue:[ |
|
364 |
renames at: chg className put: chg oldName. |
|
365 |
]]. |
|
366 |
self classesToFileOut do:[:cls| |
|
367 |
(renames includesKey: cls name) ifTrue:[ |
|
368 |
self doRenameContainerForClassNamed: cls name using: renames language: cls programmingLanguage. |
|
369 |
] |
|
370 |
] |
|
371 |
||
372 |
"Created: / 11-04-2008 / 11:00:27 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
373 |
"Modified: / 19-08-2009 / 15:03:51 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
374 |
"Created: / 06-08-2011 / 21:13:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
55 | 375 |
! |
376 |
||
377 |
doUpdateBuildSupportFiles |
|
757 | 378 |
|pkgDef| |
55 | 379 |
|
958 | 380 |
suppresBuildSupportFiles == true ifTrue:[ |
381 |
^self. |
|
382 |
]. |
|
383 |
||
864
a3f4f2493928
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
757
diff
changeset
|
384 |
(self isSelectiveFileoutTask and:[packageClassesChanged not]) ifTrue:[ |
a3f4f2493928
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
757
diff
changeset
|
385 |
^self. |
a3f4f2493928
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
757
diff
changeset
|
386 |
]. |
757 | 387 |
ActivityNotification notify:'Updating build files'. |
55 | 388 |
pkgDef := self workingCopy packageDefinition. |
757 | 389 |
self filesToGenerate do:[:supportFileName | |
390 |
|supportFile stream| |
|
391 |
||
392 |
supportFile := workingCopy path / supportFileName. |
|
393 |
(packageClassesChanged or:[ supportFile exists not ]) ifTrue:[ |
|
394 |
ActivityNotification notify:'Updating ' , supportFileName. |
|
395 |
[ |
|
396 |
supportFile directory exists ifFalse: |
|
397 |
[supportFile directory makeDirectory]. |
|
398 |
stream := supportFile writeStream. |
|
399 |
stream nextPutAll:(self for: pkgDef generateFile:supportFileName) |
|
400 |
] ensure:[ stream ifNotNil:[ stream close ] ] |
|
401 |
] |
|
402 |
]. |
|
55 | 403 |
|
404 |
"Created: / 20-06-2009 / 16:01:16 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
405 |
"Modified: / 21-06-2009 / 15:18:17 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
958 | 406 |
"Modified: / 15-10-2011 / 22:27:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
55 | 407 |
! |
408 |
||
409 |
doUpdateProjectDefinition |
|
410 |
|prjClass| |
|
411 |
||
757 | 412 |
(packageClassesChanged | packageExtensionsChanged) ifFalse:[ |
413 |
^ self |
|
414 |
]. |
|
415 |
ActivityNotification notify:'Updating project definition'. |
|
416 |
prjClass := Smalltalk |
|
417 |
at:(ProjectDefinition initialClassNameForDefinitionOf:self package) |
|
418 |
asSymbol. |
|
419 |
prjClass |
|
420 |
ifNotNil:[ |
|
421 |
Class packageQuerySignal answer:prjClass package |
|
422 |
do:[ |
|
423 |
prjClass theNonMetaclass |
|
424 |
forEachContentsMethodsCodeToCompileDo:[:code :category | |
|
425 |
(code startsWith: 'excludedFromPreRequisites') |
|
426 |
ifFalse:[prjClass theMetaclass compile:code classified:category] |
|
427 |
] |
|
864
a3f4f2493928
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
757
diff
changeset
|
428 |
ignoreOldEntries: false |
757 | 429 |
ignoreOldDefinition: false |
430 |
] |
|
431 |
] |
|
55 | 432 |
|
433 |
"Created: / 11-04-2008 / 11:01:06 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
434 |
"Modified: / 13-08-2009 / 09:13:14 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
864
a3f4f2493928
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
757
diff
changeset
|
435 |
"Modified: / 28-09-2011 / 17:38:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
55 | 436 |
! ! |
437 |
||
438 |
!FileoutLikeTask methodsFor:'private'! |
|
439 |
||
440 |
classesToFileOut |
|
958 | 441 |
|
442 |
suppressClasses == true ifTrue:[^#()]. |
|
443 |
||
492 | 444 |
^ self workingCopy packageClassesFiltered: |
958 | 445 |
[:class | |
446 |
class isLoaded and: [ classes isNil or: [ classes includes: class ] ] ] |
|
55 | 447 |
|
448 |
"Created: / 23-03-2009 / 12:08:24 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
449 |
"Modified: / 11-06-2009 / 18:17:38 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
958 | 450 |
"Modified: / 15-10-2011 / 20:15:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
55 | 451 |
! |
452 |
||
453 |
containersToFileOut |
|
757 | 454 |
| containers extensions | |
55 | 455 |
|
492 | 456 |
containers := self classesToFileOut |
757 | 457 |
collect: [:class | self repository containerNameForClass: class ]. |
458 |
(extensions := self extensionMethodsToFileOut) notEmpty ifTrue: |
|
459 |
[| languages | |
|
460 |
languages := (extensions collect:[:each|each programmingLanguage]) asSet. |
|
461 |
languages do: |
|
462 |
[:lang|containers add: (Repository containerNameForExtensions: lang)]]. |
|
55 | 463 |
^ containers |
464 |
||
465 |
"Created: / 14-05-2009 / 11:35:05 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
757 | 466 |
"Modified: / 30-12-2009 / 22:05:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
55 | 467 |
! |
468 |
||
469 |
extensionMethodsToFileOut |
|
492 | 470 |
^ self workingCopy packageExtensionsFiltered: |
471 |
[:mth | |
|
472 |
extensionMethods isNil or: [ extensionMethods includes: mth ] ] |
|
55 | 473 |
|
474 |
"Created: / 14-05-2009 / 11:32:01 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
475 |
! |
|
476 |
||
757 | 477 |
for: def generateFile: file |
478 |
||
479 |
| contents savedClassFilenames | |
|
480 |
||
481 |
||
482 |
file ~= 'abbrev.stc' ifTrue:[^def generateFile: file]. |
|
483 |
||
484 |
"Yet another kludge to trick Smalltalk>>fileNameForClass:, sigh" |
|
485 |
||
486 |
savedClassFilenames := Dictionary new. |
|
487 |
(def searchForClasses reject:[:e|e owningClass notNil]) do: |
|
488 |
[:cls| |
|
489 |
savedClassFilenames |
|
490 |
at: cls |
|
491 |
put: cls getClassFilename. |
|
492 |
cls setClassFilename: (SVN::Repository containerNameForClass: cls)]. |
|
493 |
contents := def generateFile: file. |
|
494 |
savedClassFilenames keysAndValuesDo: |
|
495 |
[:cls :classFileName| |
|
496 |
cls setClassFilename: classFileName]. |
|
497 |
^contents |
|
498 |
! |
|
499 |
||
55 | 500 |
shouldFileOutClass: class |
501 |
||
492 | 502 |
"Do not fileout autoloaded classes, |
55 | 503 |
they are untouched" |
504 |
class isLoaded ifFalse:[^false]. |
|
505 |
||
492 | 506 |
class theNonMetaclass |
757 | 507 |
methodsDo:[:mth|(self shouldFileOutMethod: mth) ifTrue:[^true]]. |
492 | 508 |
class theMetaclass |
757 | 509 |
methodsDo:[:mth|(self shouldFileOutMethod: mth) ifTrue:[^true]]. |
510 |
class privateClasses |
|
511 |
do:[:cls|(self shouldFileOutClass: cls) ifTrue:[^true]]. |
|
55 | 512 |
^false |
513 |
||
514 |
" |
|
757 | 515 |
CommitTask basicNew |
516 |
package: #'stx:libsvn'; |
|
517 |
shouldFileOutClass: CommitTask |
|
55 | 518 |
|
757 | 519 |
CommitTask basicNew |
520 |
package: #'stx:libbasic'; |
|
521 |
shouldFileOutClass: Object |
|
55 | 522 |
" |
523 |
||
524 |
"Created: / 24-06-2009 / 19:04:48 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
525 |
"Modified: / 19-08-2009 / 13:54:39 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
757 | 526 |
"Modified: / 10-12-2010 / 00:22:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
55 | 527 |
! |
528 |
||
529 |
shouldFileOutMethod: mth |
|
530 |
||
531 |
^mth package = package and: |
|
492 | 532 |
[mth getSourcePosition isNil] |
55 | 533 |
|
534 |
" |
|
492 | 535 |
CommitTask basicNew |
757 | 536 |
package: #'stx:libsvn'; |
492 | 537 |
shouldFileOutMethod: (CommitTask >> #shouldFileOutMethod:) |
55 | 538 |
|
492 | 539 |
CommitTask basicNew |
540 |
package: #'stx:libbasic'; |
|
541 |
shouldFileOutMethod: (Object >> #yourself) |
|
55 | 542 |
" |
543 |
||
544 |
"Created: / 24-06-2009 / 19:07:27 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
545 |
! ! |
|
546 |
||
547 |
!FileoutLikeTask methodsFor:'queries'! |
|
548 |
||
549 |
isSelectiveFileoutTask |
|
550 |
^ classes notNil or: [ extensionMethods notNil ] |
|
551 |
||
552 |
"Created: / 14-05-2009 / 13:24:52 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
553 |
! ! |
|
554 |
||
555 |
!FileoutLikeTask class methodsFor:'documentation'! |
|
556 |
||
557 |
version |
|
558 |
^ '$Header$' |
|
226 | 559 |
! |
560 |
||
561 |
version_SVN |
|
757 | 562 |
|
864
a3f4f2493928
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
757
diff
changeset
|
563 |
^ '§Id: SVN__FileoutLikeTask.st 372 2011-09-29 10:47:58Z vranyj1 §' |
757 | 564 |
|
55 | 565 |
! ! |