author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Tue, 22 Jan 2013 09:58:36 +0000 | |
changeset 184 | e31e5bc69918 |
parent 171 | 771ae4f01925 |
child 268 | ceb9b128eeba |
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 - private'! |
|
124 |
||
125 |
doAddNewContainers |
|
53
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
126 |
| wcroot containers | |
44 | 127 |
|
128 |
ActivityNotification notify:'Adding new containers'. |
|
53
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
129 |
containers := |
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
130 |
self isSelectiveFileoutTask |
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
131 |
ifTrue:[#()] |
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
132 |
ifFalse:[self containersToFileOut]. |
117
3014c22e2eab
Refactoring (part 1): SCMPackageModel>>workingCopy renamed to temporaryWorkingCopy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
114
diff
changeset
|
133 |
wcroot := self temporaryWorkingCopyRoot. |
53
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
134 |
|
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
135 |
containers do:[:nm| |
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
136 |
| entry | |
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
137 |
|
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
138 |
entry := wcroot / nm. |
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
139 |
entry track. |
44 | 140 |
] |
141 |
||
142 |
"Created: / 11-04-2008 / 10:58:53 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
143 |
"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
|
144 |
"Modified: / 15-11-2012 / 00:14:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
44 | 145 |
! |
146 |
||
147 |
doCompileCopyrightMethods |
|
148 |
| klasses source | |
|
149 |
||
150 |
(self packageDefinition class includesSelector: #copyright) ifFalse:[^self]. |
|
151 |
ActivityNotification notify:'Compiling #copyright methods...'. |
|
152 |
klasses := self classesToFileOut asArray. |
|
153 |
source := (self packageDefinition class compiledMethodAt: #copyright) source. |
|
154 |
||
155 |
klasses |
|
156 |
withIndexDo:[:cls :index | |
|
157 |
|metaCls| |
|
158 |
metaCls := cls theMetaclass. |
|
159 |
(((metaCls includesSelector:#copyright) not) and:[metaCls programmingLanguage isSmalltalk]) |
|
160 |
ifTrue:[ |
|
161 |
metaCls compile:source classified:'documentation'. |
|
162 |
(metaCls compiledMethodAt:#copyright) |
|
131
8986734fe8e2
Bugfix in SCMAbstractFileoutLikeTask>>doCompileCopyrightMethods
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
122
diff
changeset
|
163 |
setPackage:self package name asSymbol |
44 | 164 |
]. |
165 |
ProgressNotification |
|
166 |
notify:('Compiling %1 (%2)' bindWith:#copyright |
|
167 |
with:cls nameWithoutPrefix) |
|
168 |
progress:(100 / klasses size) * index. |
|
169 |
] |
|
170 |
||
171 |
"Modified: / 16-08-2009 / 12:59:50 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
172 |
"Created: / 08-04-2010 / 14:31:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
131
8986734fe8e2
Bugfix in SCMAbstractFileoutLikeTask>>doCompileCopyrightMethods
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
122
diff
changeset
|
173 |
"Modified: / 05-12-2012 / 12:02:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
44 | 174 |
! |
175 |
||
176 |
doCompileVersionMethods |
|
177 |
|klasses versionMethodName| |
|
178 |
||
179 |
versionMethodName := self package manager nameOfVersionMethodInClasses. |
|
180 |
ActivityNotification notify:'Compiling #version methods...'. |
|
181 |
klasses := self classesToFileOut asArray. |
|
182 |
klasses |
|
183 |
withIndexDo:[:cls :index | |
|
184 |
|metaCls| |
|
185 |
||
186 |
metaCls := cls theMetaclass. |
|
187 |
((metaCls includesSelector:versionMethodName) not |
|
53
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
188 |
"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
|
189 |
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
|
190 |
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
|
191 |
"or:[ ((cls perform:versionMethodName asSymbol) startsWith:'$Id') not ]") |
44 | 192 |
ifTrue:[ |
193 |
metaCls compile:(metaCls |
|
194 |
versionMethodTemplateForSourceCodeManager:self package manager) |
|
195 |
classified:'documentation'. |
|
196 |
(metaCls compiledMethodAt:versionMethodName) |
|
197 |
setPackage:self package name asSymbol |
|
198 |
]. |
|
199 |
self package manager utilities ensureCorrectVersionMethodsInClass: cls usingManager: self package manager. |
|
200 |
ProgressNotification |
|
201 |
notify:('Compiling %1 (%2)' bindWith:versionMethodName |
|
202 |
with:cls nameWithoutPrefix) |
|
203 |
progress:(100 / klasses size) * index. |
|
204 |
]. |
|
205 |
||
206 |
self extensionMethodsToFileOut notEmpty ifTrue:[ |
|
207 |
| def | |
|
208 |
||
209 |
"TODO: Not programming language aware..." |
|
210 |
((def := self packageDefinition) class includesSelector: self package manager nameOfVersionMethodForExtensions) ifFalse:[ |
|
211 |
def class |
|
212 |
compile: |
|
213 |
(self package manager versionMethodTemplateForSmalltalkFor:self package manager nameOfVersionMethodForExtensions) |
|
214 |
classified: #documentation. |
|
215 |
(def class compiledMethodAt:self package manager nameOfVersionMethodForExtensions) |
|
70
3faeae24a513
fix in SCMAbstractFileoutLikeTask>>doCompileVersionMethods
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
53
diff
changeset
|
216 |
setPackage:self package name asSymbol |
44 | 217 |
|
218 |
] |
|
219 |
] |
|
220 |
||
221 |
"Created: / 28-05-2008 / 07:43:43 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
222 |
"Modified: / 16-08-2009 / 12:59:50 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
223 |
"Modified: / 07-07-2011 / 20:15:21 / jv" |
|
70
3faeae24a513
fix in SCMAbstractFileoutLikeTask>>doCompileVersionMethods
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
53
diff
changeset
|
224 |
"Modified: / 16-11-2012 / 23:17:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
44 | 225 |
! |
226 |
||
122
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
227 |
doFileOut |
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
228 |
"Fileouts everything to the working copy" |
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
229 |
|
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
230 |
self |
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
231 |
doUpdateBuildSupportFiles; |
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
232 |
doRenameContainers; |
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
233 |
doFileOutPackageClasses; |
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
234 |
doFileOutPackageExtensions; |
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
235 |
doAddNewContainers; |
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
236 |
doRemoveOldContainers. |
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
237 |
|
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
238 |
"Created: / 10-05-2012 / 17:05:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
239 |
"Modified: / 21-11-2012 / 00:43:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
240 |
! |
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
241 |
|
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
242 |
doFileOutAll |
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
243 |
|
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
244 |
self |
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
245 |
doUpdateCode; |
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
246 |
doFileOut. |
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
247 |
|
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
248 |
"Created: / 17-08-2009 / 18:28:18 / Jan Vrany <vranyj1@fel.cvut.cz>" |
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
249 |
"Modified: / 10-05-2012 / 17:06:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
250 |
! |
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
251 |
|
44 | 252 |
doFileOutPackageClasses |
253 |
|klasses| |
|
254 |
||
255 |
suppressClasses == true ifTrue:[^self]. |
|
256 |
||
257 |
ActivityNotification notify:'Filing out package classes'. |
|
258 |
klasses := self classesToFileOut asArray. |
|
259 |
klasses |
|
260 |
withIndexDo:[:cls :index | |
|
261 |
|clsStream| |
|
262 |
||
263 |
ProgressNotification notify:'Filing out ' , cls nameWithoutPrefix |
|
264 |
progress:(100 / klasses size) * index. |
|
53
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
265 |
(self shouldFileOutClass:cls) ifTrue:[self package fileOutClass: cls]] |
44 | 266 |
|
267 |
"Created: / 11-04-2008 / 10:58:16 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
268 |
"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
|
269 |
"Modified: / 15-11-2012 / 00:26:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
44 | 270 |
! |
271 |
||
272 |
doFileOutPackageExtensions |
|
273 |
||
274 |
suppressExtensions == true ifTrue:[^self]. |
|
275 |
||
276 |
self extensionMethodsToFileOut isEmpty ifTrue:[^self]. |
|
277 |
self package fileOutExtensions: self extensionMethodsToFileOut |
|
278 |
||
279 |
"Modified: / 07-04-2008 / 08:37:25 / janfrog" |
|
280 |
"Created: / 11-04-2008 / 10:58:36 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
281 |
"Modified: / 14-05-2009 / 13:37:40 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
282 |
"Modified: / 07-10-2012 / 10:56:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
283 |
! |
|
284 |
||
285 |
doInitStateVariables |
|
286 |
packageClassesChanged := self package classesHasChanged. |
|
287 |
packageExtensionsChanged := self package extensionsHasChanged. |
|
288 |
||
289 |
"Created: / 17-06-2009 / 10:17:04 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
290 |
"Modified: / 13-08-2009 / 10:18:37 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
291 |
"Modified: / 06-10-2012 / 23:28:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
292 |
! |
|
293 |
||
294 |
doRemoveOldContainers |
|
53
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
295 |
| wcroot containers containersToKeep containersToDelete | |
44 | 296 |
|
297 |
self isSelectiveFileoutTask ifTrue:[ |
|
298 |
^ self |
|
299 |
]. |
|
300 |
ActivityNotification notify:'Removing old containers'. |
|
117
3014c22e2eab
Refactoring (part 1): SCMPackageModel>>workingCopy renamed to temporaryWorkingCopy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
114
diff
changeset
|
301 |
wcroot := package temporaryWorkingCopyRoot. |
53
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
302 |
containers := self package containers. |
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
303 |
containersToKeep := self package containersToKeep. |
44 | 304 |
containersToDelete := containers \ containersToKeep. |
53
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
305 |
containersToDelete do:[:nm| |
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
306 |
| entry | |
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
307 |
|
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
308 |
entry := wcroot / nm. |
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
309 |
entry remove |
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
310 |
] |
44 | 311 |
|
312 |
"Created: / 11-04-2008 / 11:00:27 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
313 |
"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
|
314 |
"Modified: / 15-11-2012 / 00:54:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
44 | 315 |
! |
316 |
||
317 |
doRenameContainerForClassNamed: new using: renames language: lang |
|
318 |
||
53
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
319 |
| wcroot old oldC oldE newC newE | |
44 | 320 |
old := renames at: new. |
321 |
(renames includesKey: old) ifTrue:[ |
|
322 |
self doRenameContainerForClassNamed: old using: renames language: lang. |
|
323 |
]. |
|
117
3014c22e2eab
Refactoring (part 1): SCMPackageModel>>workingCopy renamed to temporaryWorkingCopy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
114
diff
changeset
|
324 |
wcroot := package temporaryWorkingCopyRoot. |
81
eeb86ad71bc3
Fixed all references to libsvn classes. Added SCMCompatModeQuery.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
70
diff
changeset
|
325 |
oldC := self package containerNameForClassNamed: old language: lang . |
eeb86ad71bc3
Fixed all references to libsvn classes. Added SCMCompatModeQuery.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
70
diff
changeset
|
326 |
newC := self package containerNameForClassNamed: new language: lang . |
89
874f18be0cbd
Fixed renaming of class containers.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
81
diff
changeset
|
327 |
(oldE := wcroot / oldC) exists ifTrue:[ |
44 | 328 |
packageClassesChanged := true. |
53
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
329 |
newE := wcroot / newC. |
89
874f18be0cbd
Fixed renaming of class containers.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
81
diff
changeset
|
330 |
oldE moveTo: newE. |
44 | 331 |
]. |
332 |
||
333 |
"Created: / 11-04-2008 / 11:00:27 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
334 |
"Modified: / 19-08-2009 / 15:03:51 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
335 |
"Created: / 06-08-2011 / 21:33:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
89
874f18be0cbd
Fixed renaming of class containers.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
81
diff
changeset
|
336 |
"Modified: / 21-11-2012 / 00:43:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
44 | 337 |
! |
338 |
||
339 |
doRenameContainers |
|
340 |
||
341 |
| renames | |
|
342 |
renames := Dictionary new. |
|
343 |
ChangeSet current do: |
|
344 |
[:chg| |
|
345 |
chg isClassRenameChange ifTrue:[ |
|
346 |
renames at: chg className put: chg oldName. |
|
347 |
]]. |
|
348 |
self classesToFileOut do:[:cls| |
|
349 |
(renames includesKey: cls name) ifTrue:[ |
|
350 |
self doRenameContainerForClassNamed: cls name using: renames language: cls programmingLanguage. |
|
351 |
] |
|
352 |
] |
|
353 |
||
354 |
"Created: / 11-04-2008 / 11:00:27 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
355 |
"Modified: / 19-08-2009 / 15:03:51 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
356 |
"Created: / 06-08-2011 / 21:13:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
357 |
! |
|
358 |
||
359 |
doUpdateBuildSupportFiles |
|
360 |
|pkgDef| |
|
361 |
||
362 |
suppresBuildSupportFiles == true ifTrue:[ |
|
363 |
^self. |
|
364 |
]. |
|
365 |
||
366 |
pkgDef := self package definition. |
|
367 |
||
368 |
(self isSelectiveFileoutTask and:[packageClassesChanged not and:[(classes includes: pkgDef) not]]) ifTrue:[ |
|
369 |
^self. |
|
370 |
]. |
|
371 |
||
372 |
ActivityNotification notify:'Updating build files'. |
|
373 |
"First, generate files into a temporary files - so originals |
|
374 |
are not destroyed when something goes wrong." |
|
375 |
self filesToGenerate do:[:supportFileName | |
|
376 |
| supportFile | |
|
377 |
||
117
3014c22e2eab
Refactoring (part 1): SCMPackageModel>>workingCopy renamed to temporaryWorkingCopy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
114
diff
changeset
|
378 |
supportFile := self temporaryWorkingCopyRoot / (supportFileName , '.tmp'). |
44 | 379 |
(packageClassesChanged or:[ supportFile exists not ]) ifTrue:[ |
380 |
ActivityNotification notify:'Updating ' , supportFileName. |
|
381 |
supportFile directory exists ifFalse: [supportFile directory makeDirectory]. |
|
382 |
supportFile writingFileDo:[:s| |
|
383 |
s nextPutAll:(self for: pkgDef generateFile:supportFileName) |
|
384 |
] |
|
385 |
] |
|
386 |
]. |
|
387 |
"Now, copy them over the old files" |
|
388 |
self filesToGenerate do:[:supportFileName | |
|
389 |
| supportFile supportFileTmp | |
|
390 |
||
117
3014c22e2eab
Refactoring (part 1): SCMPackageModel>>workingCopy renamed to temporaryWorkingCopy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
114
diff
changeset
|
391 |
supportFile := package temporaryWorkingCopyRoot / supportFileName. |
3014c22e2eab
Refactoring (part 1): SCMPackageModel>>workingCopy renamed to temporaryWorkingCopy
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
114
diff
changeset
|
392 |
supportFileTmp := package temporaryWorkingCopyRoot / (supportFileName , '.tmp'). |
44 | 393 |
|
53
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
394 |
supportFileTmp moveTo: supportFile. |
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
395 |
supportFile track. |
44 | 396 |
]. |
397 |
||
398 |
"Created: / 20-06-2009 / 16:01:16 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
399 |
"Modified: / 21-06-2009 / 15:18:17 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
171
771ae4f01925
Changes to support standalone commit (without package model).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
131
diff
changeset
|
400 |
"Modified: / 12-01-2013 / 13:54:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
44 | 401 |
! |
402 |
||
122
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
403 |
doUpdateCode |
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
404 |
"Updates project definitions and compiles version/copyright methods" |
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
405 |
|
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
406 |
self |
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
407 |
doInitStateVariables; |
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
408 |
doCompileVersionMethods; |
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
409 |
doCompileCopyrightMethods; |
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
410 |
doUpdateProjectDefinition. |
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
411 |
|
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
412 |
"Created: / 10-05-2012 / 17:04:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
413 |
! |
f72225c1f433
Adde parent/child relationship to SCMAbstractPackageModel
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
117
diff
changeset
|
414 |
|
44 | 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. |
|
81
eeb86ad71bc3
Fixed all references to libsvn classes. Added SCMCompatModeQuery.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
70
diff
changeset
|
499 |
cls setClassFilename: (self package containerNameForClass: cls)]. |
44 | 500 |
contents := def generateFile: file. |
501 |
savedClassFilenames keysAndValuesDo: |
|
502 |
[:cls :classFileName| |
|
503 |
cls setClassFilename: classFileName]. |
|
504 |
^contents |
|
81
eeb86ad71bc3
Fixed all references to libsvn classes. Added SCMCompatModeQuery.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
70
diff
changeset
|
505 |
|
eeb86ad71bc3
Fixed all references to libsvn classes. Added SCMCompatModeQuery.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
70
diff
changeset
|
506 |
"Modified: / 19-11-2012 / 23:01:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
44 | 507 |
! |
508 |
||
509 |
shouldFileOutClass: class |
|
510 |
||
511 |
"Do not fileout autoloaded classes, |
|
512 |
they are untouched" |
|
513 |
class isLoaded ifFalse:[^false]. |
|
514 |
||
515 |
class theNonMetaclass |
|
516 |
methodsDo:[:mth|(self shouldFileOutMethod: mth) ifTrue:[^true]]. |
|
184
e31e5bc69918
Bugfix in SCMAbstractFileoutLikeTask>>#shouldFileOutClass: care about removed methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
171
diff
changeset
|
517 |
|
44 | 518 |
class theMetaclass |
519 |
methodsDo:[:mth|(self shouldFileOutMethod: mth) ifTrue:[^true]]. |
|
184
e31e5bc69918
Bugfix in SCMAbstractFileoutLikeTask>>#shouldFileOutClass: care about removed methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
171
diff
changeset
|
520 |
|
44 | 521 |
class privateClasses |
522 |
do:[:cls|(self shouldFileOutClass: cls) ifTrue:[^true]]. |
|
184
e31e5bc69918
Bugfix in SCMAbstractFileoutLikeTask>>#shouldFileOutClass: care about removed methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
171
diff
changeset
|
523 |
|
e31e5bc69918
Bugfix in SCMAbstractFileoutLikeTask>>#shouldFileOutClass: care about removed methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
171
diff
changeset
|
524 |
(ChangeSet current includesChangeForClass:class) ifTrue:[ ^ true ]. |
e31e5bc69918
Bugfix in SCMAbstractFileoutLikeTask>>#shouldFileOutClass: care about removed methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
171
diff
changeset
|
525 |
|
44 | 526 |
^false |
527 |
||
528 |
" |
|
529 |
CommitTask basicNew |
|
530 |
package: #'stx:libsvn'; |
|
531 |
shouldFileOutClass: CommitTask |
|
532 |
||
533 |
CommitTask basicNew |
|
534 |
package: #'stx:libbasic'; |
|
535 |
shouldFileOutClass: Object |
|
536 |
" |
|
537 |
||
538 |
"Created: / 24-06-2009 / 19:04:48 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
539 |
"Modified: / 19-08-2009 / 13:54:39 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
184
e31e5bc69918
Bugfix in SCMAbstractFileoutLikeTask>>#shouldFileOutClass: care about removed methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
171
diff
changeset
|
540 |
"Modified: / 21-01-2013 / 19:35:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
44 | 541 |
! |
542 |
||
543 |
shouldFileOutMethod: mth |
|
544 |
||
53
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
545 |
^mth package = package name and: |
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
546 |
[mth getSourcePosition isNil] |
44 | 547 |
|
548 |
"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
|
549 |
"Modified (comment): / 15-11-2012 / 00:36:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
44 | 550 |
! ! |
551 |
||
552 |
!SCMAbstractFileoutLikeTask methodsFor:'queries'! |
|
553 |
||
554 |
isSelectiveFileoutTask |
|
555 |
^ classes notNil or: [ extensionMethods notNil ] |
|
556 |
||
557 |
"Created: / 14-05-2009 / 13:24:52 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
558 |
! ! |
|
559 |
||
560 |
!SCMAbstractFileoutLikeTask class methodsFor:'documentation'! |
|
561 |
||
562 |
version_GIT |
|
563 |
"Never, ever change this method. Ask JV or CG why" |
|
564 |
^thisContext method mclass theNonMetaclass instVarNamed: #revision |
|
565 |
! |
|
566 |
||
53
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
567 |
version_HG |
114
8b27cb46af9a
version_HG changed to return String.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
89
diff
changeset
|
568 |
|
8b27cb46af9a
version_HG changed to return String.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
89
diff
changeset
|
569 |
^ '$Changeset: <not expanded> $' |
53
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
570 |
! |
8043f7b6f41a
- More common code refactored
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
44
diff
changeset
|
571 |
|
44 | 572 |
version_SVN |
70
3faeae24a513
fix in SCMAbstractFileoutLikeTask>>doCompileVersionMethods
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
53
diff
changeset
|
573 |
^ '§Id:: §' |
44 | 574 |
! ! |
184
e31e5bc69918
Bugfix in SCMAbstractFileoutLikeTask>>#shouldFileOutClass: care about removed methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
171
diff
changeset
|
575 |