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