author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Mon, 23 Jul 2012 19:21:39 +0200 | |
changeset 1112 | 98ffcd3ba7fe |
parent 1103 | 0159e5837bd1 |
child 1136 | f9b7c94dbb9f |
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 |
||
1103 | 131 |
!FileoutLikeTask methodsFor:'executing'! |
132 |
||
133 |
doFileOut |
|
134 |
"Fileouts everything to the working copy" |
|
135 |
||
136 |
self |
|
1112 | 137 |
doUpdateBuildSupportFiles; |
1103 | 138 |
doRenameContainers; |
139 |
doFileOutPackageClasses; |
|
140 |
doFileOutPackageExtensions; |
|
141 |
doAddNewContainers; |
|
1112 | 142 |
doRemoveOldContainers. |
1103 | 143 |
|
144 |
"Created: / 10-05-2012 / 17:05:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
145 |
! |
|
146 |
||
147 |
doFileOutAll |
|
148 |
||
149 |
self |
|
150 |
doUpdateCode; |
|
151 |
doFileOut. |
|
152 |
||
153 |
"Created: / 17-08-2009 / 18:28:18 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
154 |
"Modified: / 10-05-2012 / 17:06:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
155 |
! |
|
156 |
||
157 |
doUpdateCode |
|
158 |
"Updates project definitions and compiles version/copyright methods" |
|
159 |
||
160 |
self |
|
161 |
doInitStateVariables; |
|
162 |
doCompileVersionMethods; |
|
163 |
doCompileCopyrightMethods; |
|
164 |
doCompileSvnRepositoryUrlStringMethod; |
|
165 |
doCompileSvnRevisionNrMethod:false; |
|
166 |
doUpdateProjectDefinition. |
|
167 |
||
168 |
"Created: / 10-05-2012 / 17:04:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
169 |
! ! |
|
170 |
||
55 | 171 |
!FileoutLikeTask methodsFor:'executing - private'! |
172 |
||
173 |
doAddNewContainers |
|
757 | 174 |
|filesAndDirsToAdd filesToAdd containers| |
55 | 175 |
|
757 | 176 |
ActivityNotification notify:'Adding new containers'. |
177 |
containers := self isSelectiveFileoutTask ifTrue:[ |
|
178 |
#() |
|
179 |
] ifFalse:[ |
|
180 |
self containersToFileOut |
|
181 |
]. |
|
182 |
filesAndDirsToAdd := ((StatusCommand new) |
|
183 |
workingCopy:self workingCopy; |
|
184 |
paths:containers; |
|
185 |
execute) |
|
186 |
select:[:wcEntry | wcEntry status isUnversioned ] |
|
187 |
thenCollect:[:wcEntry | wcEntry path ]. |
|
188 |
filesToAdd := filesAndDirsToAdd select: |
|
189 |
[:fname|(workingCopy path / fname) isDirectory not]. |
|
190 |
filesAndDirsToAdd isEmpty ifFalse:[ |
|
191 |
packageClassesChanged := true. |
|
192 |
(AddCommand new) |
|
193 |
workingCopy:self workingCopy; |
|
194 |
paths:filesAndDirsToAdd; |
|
195 |
execute. |
|
196 |
]. |
|
197 |
filesToAdd isEmpty ifFalse:[ |
|
198 |
(PropsetCommand new) |
|
199 |
workingCopy:self workingCopy; |
|
200 |
name:'svn:keywords'; |
|
201 |
value:'Id HeadURL'; |
|
864
a3f4f2493928
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
757
diff
changeset
|
202 |
paths:containers; |
757 | 203 |
execute. |
204 |
(PropsetCommand new) |
|
205 |
workingCopy:self workingCopy; |
|
206 |
name:'svn:eol-style'; |
|
207 |
value:'LF'; |
|
864
a3f4f2493928
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
757
diff
changeset
|
208 |
paths:containers; |
757 | 209 |
execute |
210 |
] |
|
55 | 211 |
|
212 |
"Created: / 11-04-2008 / 10:58:53 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
213 |
"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
|
214 |
"Modified: / 29-09-2011 / 11:47:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
757 | 215 |
! |
216 |
||
217 |
doCompileCopyrightMethods |
|
218 |
| klasses source | |
|
219 |
||
220 |
(self packageDefinition class includesSelector: #copyright) ifFalse:[^self]. |
|
221 |
ActivityNotification notify:'Compiling #copyright methods...'. |
|
222 |
klasses := self classesToFileOut asArray. |
|
223 |
source := (self packageDefinition class compiledMethodAt: #copyright) source. |
|
224 |
||
225 |
klasses |
|
226 |
withIndexDo:[:cls :index | |
|
227 |
|metaCls| |
|
228 |
metaCls := cls theMetaclass. |
|
229 |
(((metaCls includesSelector:#copyright) not) and:[metaCls programmingLanguage isSmalltalk]) |
|
230 |
ifTrue:[ |
|
231 |
metaCls compile:source classified:'documentation'. |
|
232 |
(metaCls compiledMethodAt:#copyright) |
|
233 |
setPackage:self package asSymbol |
|
234 |
]. |
|
235 |
ProgressNotification |
|
236 |
notify:('Compiling %1 (%2)' bindWith:#copyright |
|
237 |
with:cls nameWithoutPrefix) |
|
1051
ce27ce3ab6c1
Fixes in progress notifications
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
958
diff
changeset
|
238 |
progress:(100 / klasses size) * index. |
757 | 239 |
] |
240 |
||
241 |
"Modified: / 16-08-2009 / 12:59:50 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
242 |
"Created: / 08-04-2010 / 14:31:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
55 | 243 |
! |
244 |
||
245 |
doCompileVersionMethods |
|
757 | 246 |
|klasses versionMethodName| |
55 | 247 |
|
248 |
versionMethodName := SVNSourceCodeManager nameOfVersionMethodInClasses. |
|
757 | 249 |
ActivityNotification notify:'Compiling #version methods...'. |
55 | 250 |
klasses := self classesToFileOut asArray. |
757 | 251 |
klasses |
252 |
withIndexDo:[:cls :index | |
|
253 |
|metaCls| |
|
55 | 254 |
|
757 | 255 |
metaCls := cls theMetaclass. |
256 |
((metaCls includesSelector:versionMethodName) not |
|
257 |
or:[ ((cls perform:versionMethodName asSymbol) startsWith:'$Id') not ]) |
|
258 |
ifTrue:[ |
|
259 |
metaCls compile:(metaCls |
|
260 |
versionMethodTemplateForSourceCodeManager:SVNSourceCodeManager) |
|
261 |
classified:'documentation'. |
|
262 |
(metaCls compiledMethodAt:versionMethodName) |
|
263 |
setPackage:self package asSymbol |
|
264 |
]. |
|
958 | 265 |
SVNSourceCodeManager utilities ensureCorrectVersionMethodsInClass: cls usingManager: SVNSourceCodeManager. |
757 | 266 |
ProgressNotification |
267 |
notify:('Compiling %1 (%2)' bindWith:versionMethodName |
|
268 |
with:cls nameWithoutPrefix) |
|
1051
ce27ce3ab6c1
Fixes in progress notifications
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
958
diff
changeset
|
269 |
progress:(100 / klasses size) * index. |
958 | 270 |
]. |
271 |
||
272 |
self extensionMethodsToFileOut notEmpty ifTrue:[ |
|
273 |
| def | |
|
274 |
||
275 |
"TODO: Not programming language aware..." |
|
276 |
((def := self packageDefinition) class includesSelector: SVNSourceCodeManager nameOfVersionMethodForExtensions) ifFalse:[ |
|
277 |
def class |
|
278 |
compile: |
|
279 |
(SVNSourceCodeManager versionMethodTemplateForSmalltalkFor:SVNSourceCodeManager nameOfVersionMethodForExtensions) |
|
1078
bdae84e9a790
fix doCompileVersionMethods
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1051
diff
changeset
|
280 |
classified: #documentation. |
bdae84e9a790
fix doCompileVersionMethods
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1051
diff
changeset
|
281 |
(def class compiledMethodAt:SVNSourceCodeManager nameOfVersionMethodForExtensions) |
bdae84e9a790
fix doCompileVersionMethods
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1051
diff
changeset
|
282 |
setPackage:self package asSymbol |
bdae84e9a790
fix doCompileVersionMethods
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1051
diff
changeset
|
283 |
|
757 | 284 |
] |
958 | 285 |
] |
55 | 286 |
|
287 |
"Created: / 28-05-2008 / 07:43:43 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
288 |
"Modified: / 16-08-2009 / 12:59:50 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
757 | 289 |
"Modified: / 07-07-2011 / 20:15:21 / jv" |
1078
bdae84e9a790
fix doCompileVersionMethods
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1051
diff
changeset
|
290 |
"Modified: / 28-03-2012 / 18:34:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
55 | 291 |
! |
292 |
||
293 |
doFileOutPackageClasses |
|
757 | 294 |
|klasses| |
55 | 295 |
|
958 | 296 |
suppressClasses == true ifTrue:[^self]. |
297 |
||
757 | 298 |
ActivityNotification notify:'Filing out package classes'. |
299 |
klasses := self classesToFileOut asArray. |
|
300 |
klasses |
|
301 |
withIndexDo:[:cls :index | |
|
302 |
|clsStream| |
|
303 |
||
304 |
ProgressNotification notify:'Filing out ' , cls nameWithoutPrefix |
|
305 |
progress:(100 / klasses size) * index. |
|
306 |
(self shouldFileOutClass:cls) ifTrue:[self workingCopy fileOutClass: cls]] |
|
55 | 307 |
|
308 |
"Created: / 11-04-2008 / 10:58:16 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
309 |
"Modified: / 19-08-2009 / 13:44:00 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
958 | 310 |
"Modified: / 15-10-2011 / 20:14:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
55 | 311 |
! |
312 |
||
313 |
doFileOutPackageExtensions |
|
314 |
||
958 | 315 |
suppressExtensions == true ifTrue:[^self]. |
316 |
||
757 | 317 |
self extensionMethodsToFileOut isEmpty ifTrue:[^self]. |
318 |
self workingCopy fileOutExtensions: self extensionMethodsToFileOut |
|
55 | 319 |
|
320 |
"Modified: / 07-04-2008 / 08:37:25 / janfrog" |
|
321 |
"Created: / 11-04-2008 / 10:58:36 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
322 |
"Modified: / 14-05-2009 / 13:37:40 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
958 | 323 |
"Modified: / 15-10-2011 / 20:14:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
55 | 324 |
! |
325 |
||
326 |
doInitStateVariables |
|
327 |
packageClassesChanged := self workingCopy packageClassesChanged. |
|
328 |
packageExtensionsChanged := self workingCopy packageExtensionsChanged. |
|
329 |
||
330 |
"Created: / 17-06-2009 / 10:17:04 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
331 |
"Modified: / 13-08-2009 / 10:18:37 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
332 |
! |
|
333 |
||
334 |
doRemoveOldContainers |
|
757 | 335 |
|containers containersToKeep containersToDelete| |
55 | 336 |
|
757 | 337 |
self isSelectiveFileoutTask ifTrue:[ |
338 |
^ self |
|
339 |
]. |
|
340 |
ActivityNotification notify:'Removing old containers'. |
|
55 | 341 |
containers := self workingCopy containers. |
342 |
containersToKeep := self workingCopy containersToKeep. |
|
343 |
containersToDelete := containers \ containersToKeep. |
|
757 | 344 |
containersToDelete isEmpty ifFalse:[ |
345 |
packageClassesChanged := true. |
|
346 |
(DeleteCommand new) |
|
347 |
workingCopy:self workingCopy; |
|
348 |
paths:containersToDelete; |
|
349 |
execute |
|
350 |
]. |
|
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>" |
|
354 |
"Modified: / 08-08-2011 / 14:33:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
355 |
! |
|
356 |
||
357 |
doRenameContainerForClassNamed: new using: renames language: lang |
|
358 |
||
359 |
| old oldC newC | |
|
360 |
old := renames at: new. |
|
361 |
(renames includesKey: old) ifTrue:[ |
|
362 |
self doRenameContainerForClassNamed: old using: renames language: lang. |
|
363 |
]. |
|
364 |
oldC := (SVN::Repository containerNameWithoutSuffixForClassNamed: old) , '.' , lang sourceFileSuffix. |
|
365 |
newC := (SVN::Repository containerNameWithoutSuffixForClassNamed: new) , '.' , lang sourceFileSuffix. |
|
366 |
(workingCopy containerFilenameFor: oldC) exists ifTrue:[ |
|
367 |
packageClassesChanged := true. |
|
368 |
MoveCommand new |
|
369 |
workingCopy: workingCopy; |
|
370 |
src: oldC; |
|
371 |
dst: newC; |
|
372 |
execute. |
|
373 |
]. |
|
55 | 374 |
|
375 |
"Created: / 11-04-2008 / 11:00:27 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
376 |
"Modified: / 19-08-2009 / 15:03:51 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
757 | 377 |
"Created: / 06-08-2011 / 21:33:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
378 |
! |
|
379 |
||
380 |
doRenameContainers |
|
381 |
||
382 |
| renames | |
|
383 |
renames := Dictionary new. |
|
384 |
ChangeSet current do: |
|
385 |
[:chg| |
|
386 |
chg isClassRenameChange ifTrue:[ |
|
387 |
renames at: chg className put: chg oldName. |
|
388 |
]]. |
|
389 |
self classesToFileOut do:[:cls| |
|
390 |
(renames includesKey: cls name) ifTrue:[ |
|
391 |
self doRenameContainerForClassNamed: cls name using: renames language: cls programmingLanguage. |
|
392 |
] |
|
393 |
] |
|
394 |
||
395 |
"Created: / 11-04-2008 / 11:00:27 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
396 |
"Modified: / 19-08-2009 / 15:03:51 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
397 |
"Created: / 06-08-2011 / 21:13:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
55 | 398 |
! |
399 |
||
400 |
doUpdateBuildSupportFiles |
|
757 | 401 |
|pkgDef| |
55 | 402 |
|
958 | 403 |
suppresBuildSupportFiles == true ifTrue:[ |
404 |
^self. |
|
405 |
]. |
|
406 |
||
1084
4b5fb750d9fe
changed: #doUpdateBuildSupportFiles
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1078
diff
changeset
|
407 |
pkgDef := self workingCopy packageDefinition. |
4b5fb750d9fe
changed: #doUpdateBuildSupportFiles
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1078
diff
changeset
|
408 |
|
4b5fb750d9fe
changed: #doUpdateBuildSupportFiles
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1078
diff
changeset
|
409 |
(self isSelectiveFileoutTask and:[packageClassesChanged not and:[(classes includes: pkgDef) not]]) ifTrue:[ |
864
a3f4f2493928
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
757
diff
changeset
|
410 |
^self. |
a3f4f2493928
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
757
diff
changeset
|
411 |
]. |
1084
4b5fb750d9fe
changed: #doUpdateBuildSupportFiles
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1078
diff
changeset
|
412 |
|
757 | 413 |
ActivityNotification notify:'Updating build files'. |
1084
4b5fb750d9fe
changed: #doUpdateBuildSupportFiles
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1078
diff
changeset
|
414 |
"First, generate files into a temporary files - so originals |
4b5fb750d9fe
changed: #doUpdateBuildSupportFiles
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1078
diff
changeset
|
415 |
are not destroyed when something goes wrong." |
757 | 416 |
self filesToGenerate do:[:supportFileName | |
1084
4b5fb750d9fe
changed: #doUpdateBuildSupportFiles
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1078
diff
changeset
|
417 |
| supportFile | |
4b5fb750d9fe
changed: #doUpdateBuildSupportFiles
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1078
diff
changeset
|
418 |
|
4b5fb750d9fe
changed: #doUpdateBuildSupportFiles
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1078
diff
changeset
|
419 |
supportFile := workingCopy path / (supportFileName , '.tmp'). |
4b5fb750d9fe
changed: #doUpdateBuildSupportFiles
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1078
diff
changeset
|
420 |
(packageClassesChanged or:[ supportFile exists not ]) ifTrue:[ |
4b5fb750d9fe
changed: #doUpdateBuildSupportFiles
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1078
diff
changeset
|
421 |
ActivityNotification notify:'Updating ' , supportFileName. |
4b5fb750d9fe
changed: #doUpdateBuildSupportFiles
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1078
diff
changeset
|
422 |
supportFile directory exists ifFalse: [supportFile directory makeDirectory]. |
4b5fb750d9fe
changed: #doUpdateBuildSupportFiles
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1078
diff
changeset
|
423 |
supportFile writingFileDo:[:s| |
4b5fb750d9fe
changed: #doUpdateBuildSupportFiles
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1078
diff
changeset
|
424 |
s nextPutAll:(self for: pkgDef generateFile:supportFileName) |
4b5fb750d9fe
changed: #doUpdateBuildSupportFiles
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1078
diff
changeset
|
425 |
] |
4b5fb750d9fe
changed: #doUpdateBuildSupportFiles
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1078
diff
changeset
|
426 |
] |
4b5fb750d9fe
changed: #doUpdateBuildSupportFiles
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1078
diff
changeset
|
427 |
]. |
4b5fb750d9fe
changed: #doUpdateBuildSupportFiles
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1078
diff
changeset
|
428 |
"Now, copy them over the old files" |
4b5fb750d9fe
changed: #doUpdateBuildSupportFiles
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1078
diff
changeset
|
429 |
self filesToGenerate do:[:supportFileName | |
4b5fb750d9fe
changed: #doUpdateBuildSupportFiles
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1078
diff
changeset
|
430 |
| supportFile supportFileTmp | |
757 | 431 |
|
432 |
supportFile := workingCopy path / supportFileName. |
|
1084
4b5fb750d9fe
changed: #doUpdateBuildSupportFiles
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1078
diff
changeset
|
433 |
supportFileTmp := workingCopy path / (supportFileName , '.tmp'). |
4b5fb750d9fe
changed: #doUpdateBuildSupportFiles
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1078
diff
changeset
|
434 |
|
4b5fb750d9fe
changed: #doUpdateBuildSupportFiles
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1078
diff
changeset
|
435 |
supportFileTmp moveTo: supportFile |
757 | 436 |
]. |
55 | 437 |
|
438 |
"Created: / 20-06-2009 / 16:01:16 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
439 |
"Modified: / 21-06-2009 / 15:18:17 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
1084
4b5fb750d9fe
changed: #doUpdateBuildSupportFiles
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1078
diff
changeset
|
440 |
"Modified: / 29-03-2012 / 18:34:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
55 | 441 |
! |
442 |
||
443 |
doUpdateProjectDefinition |
|
444 |
|prjClass| |
|
445 |
||
757 | 446 |
(packageClassesChanged | packageExtensionsChanged) ifFalse:[ |
447 |
^ self |
|
448 |
]. |
|
449 |
ActivityNotification notify:'Updating project definition'. |
|
450 |
prjClass := Smalltalk |
|
451 |
at:(ProjectDefinition initialClassNameForDefinitionOf:self package) |
|
452 |
asSymbol. |
|
453 |
prjClass |
|
454 |
ifNotNil:[ |
|
455 |
Class packageQuerySignal answer:prjClass package |
|
456 |
do:[ |
|
457 |
prjClass theNonMetaclass |
|
458 |
forEachContentsMethodsCodeToCompileDo:[:code :category | |
|
459 |
(code startsWith: 'excludedFromPreRequisites') |
|
460 |
ifFalse:[prjClass theMetaclass compile:code classified:category] |
|
461 |
] |
|
864
a3f4f2493928
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
757
diff
changeset
|
462 |
ignoreOldEntries: false |
757 | 463 |
ignoreOldDefinition: false |
464 |
] |
|
465 |
] |
|
55 | 466 |
|
467 |
"Created: / 11-04-2008 / 11:01:06 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
468 |
"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
|
469 |
"Modified: / 28-09-2011 / 17:38:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
55 | 470 |
! ! |
471 |
||
472 |
!FileoutLikeTask methodsFor:'private'! |
|
473 |
||
474 |
classesToFileOut |
|
958 | 475 |
|
476 |
suppressClasses == true ifTrue:[^#()]. |
|
477 |
||
492 | 478 |
^ self workingCopy packageClassesFiltered: |
958 | 479 |
[:class | |
480 |
class isLoaded and: [ classes isNil or: [ classes includes: class ] ] ] |
|
55 | 481 |
|
482 |
"Created: / 23-03-2009 / 12:08:24 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
483 |
"Modified: / 11-06-2009 / 18:17:38 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
958 | 484 |
"Modified: / 15-10-2011 / 20:15:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
55 | 485 |
! |
486 |
||
487 |
containersToFileOut |
|
757 | 488 |
| containers extensions | |
55 | 489 |
|
492 | 490 |
containers := self classesToFileOut |
757 | 491 |
collect: [:class | self repository containerNameForClass: class ]. |
492 |
(extensions := self extensionMethodsToFileOut) notEmpty ifTrue: |
|
493 |
[| languages | |
|
494 |
languages := (extensions collect:[:each|each programmingLanguage]) asSet. |
|
495 |
languages do: |
|
496 |
[:lang|containers add: (Repository containerNameForExtensions: lang)]]. |
|
55 | 497 |
^ containers |
498 |
||
499 |
"Created: / 14-05-2009 / 11:35:05 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
757 | 500 |
"Modified: / 30-12-2009 / 22:05:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
55 | 501 |
! |
502 |
||
503 |
extensionMethodsToFileOut |
|
492 | 504 |
^ self workingCopy packageExtensionsFiltered: |
505 |
[:mth | |
|
506 |
extensionMethods isNil or: [ extensionMethods includes: mth ] ] |
|
55 | 507 |
|
508 |
"Created: / 14-05-2009 / 11:32:01 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
509 |
! |
|
510 |
||
757 | 511 |
for: def generateFile: file |
512 |
||
513 |
| contents savedClassFilenames | |
|
514 |
||
515 |
||
516 |
file ~= 'abbrev.stc' ifTrue:[^def generateFile: file]. |
|
517 |
||
518 |
"Yet another kludge to trick Smalltalk>>fileNameForClass:, sigh" |
|
519 |
||
520 |
savedClassFilenames := Dictionary new. |
|
521 |
(def searchForClasses reject:[:e|e owningClass notNil]) do: |
|
522 |
[:cls| |
|
523 |
savedClassFilenames |
|
524 |
at: cls |
|
525 |
put: cls getClassFilename. |
|
526 |
cls setClassFilename: (SVN::Repository containerNameForClass: cls)]. |
|
527 |
contents := def generateFile: file. |
|
528 |
savedClassFilenames keysAndValuesDo: |
|
529 |
[:cls :classFileName| |
|
530 |
cls setClassFilename: classFileName]. |
|
531 |
^contents |
|
532 |
! |
|
533 |
||
55 | 534 |
shouldFileOutClass: class |
535 |
||
492 | 536 |
"Do not fileout autoloaded classes, |
55 | 537 |
they are untouched" |
538 |
class isLoaded ifFalse:[^false]. |
|
539 |
||
492 | 540 |
class theNonMetaclass |
757 | 541 |
methodsDo:[:mth|(self shouldFileOutMethod: mth) ifTrue:[^true]]. |
492 | 542 |
class theMetaclass |
757 | 543 |
methodsDo:[:mth|(self shouldFileOutMethod: mth) ifTrue:[^true]]. |
544 |
class privateClasses |
|
545 |
do:[:cls|(self shouldFileOutClass: cls) ifTrue:[^true]]. |
|
55 | 546 |
^false |
547 |
||
548 |
" |
|
757 | 549 |
CommitTask basicNew |
550 |
package: #'stx:libsvn'; |
|
551 |
shouldFileOutClass: CommitTask |
|
55 | 552 |
|
757 | 553 |
CommitTask basicNew |
554 |
package: #'stx:libbasic'; |
|
555 |
shouldFileOutClass: Object |
|
55 | 556 |
" |
557 |
||
558 |
"Created: / 24-06-2009 / 19:04:48 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
559 |
"Modified: / 19-08-2009 / 13:54:39 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
757 | 560 |
"Modified: / 10-12-2010 / 00:22:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
55 | 561 |
! |
562 |
||
563 |
shouldFileOutMethod: mth |
|
564 |
||
565 |
^mth package = package and: |
|
492 | 566 |
[mth getSourcePosition isNil] |
55 | 567 |
|
568 |
" |
|
492 | 569 |
CommitTask basicNew |
757 | 570 |
package: #'stx:libsvn'; |
492 | 571 |
shouldFileOutMethod: (CommitTask >> #shouldFileOutMethod:) |
55 | 572 |
|
492 | 573 |
CommitTask basicNew |
574 |
package: #'stx:libbasic'; |
|
575 |
shouldFileOutMethod: (Object >> #yourself) |
|
55 | 576 |
" |
577 |
||
578 |
"Created: / 24-06-2009 / 19:07:27 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
579 |
! ! |
|
580 |
||
581 |
!FileoutLikeTask methodsFor:'queries'! |
|
582 |
||
583 |
isSelectiveFileoutTask |
|
584 |
^ classes notNil or: [ extensionMethods notNil ] |
|
585 |
||
586 |
"Created: / 14-05-2009 / 13:24:52 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
587 |
! ! |
|
588 |
||
589 |
!FileoutLikeTask class methodsFor:'documentation'! |
|
590 |
||
591 |
version |
|
592 |
^ '$Header$' |
|
226 | 593 |
! |
594 |
||
595 |
version_SVN |
|
757 | 596 |
|
864
a3f4f2493928
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
757
diff
changeset
|
597 |
^ '§Id: SVN__FileoutLikeTask.st 372 2011-09-29 10:47:58Z vranyj1 §' |
757 | 598 |
|
55 | 599 |
! ! |