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