author | Claus Gittinger <cg@exept.de> |
Tue, 10 Feb 2015 16:00:19 +0100 | |
changeset 3776 | 078a3769d4df |
parent 3775 | 472cfbb0e695 |
child 3777 | cfc0d41d6bec |
permissions | -rw-r--r-- |
2798 | 1 |
" |
2 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
2911 | 3 |
All Rights Reserved |
2798 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
"{ Package: 'stx:libbasic3' }" |
|
13 |
||
3775 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
2798 | 16 |
Object subclass:#ProjectProblem |
3547 | 17 |
instanceVariableNames:'package fixes allProblems' |
2798 | 18 |
classVariableNames:'' |
19 |
poolDictionaries:'' |
|
20 |
category:'System-Support-Projects' |
|
21 |
! |
|
22 |
||
23 |
ProjectProblem subclass:#ClassProblem |
|
24 |
instanceVariableNames:'className' |
|
25 |
classVariableNames:'' |
|
26 |
poolDictionaries:'' |
|
27 |
privateIn:ProjectProblem |
|
28 |
! |
|
29 |
||
3160 | 30 |
ProjectProblem::ClassProblem subclass:#InconsistentProjectDefinition |
31 |
instanceVariableNames:'' |
|
2798 | 32 |
classVariableNames:'' |
33 |
poolDictionaries:'' |
|
34 |
privateIn:ProjectProblem |
|
35 |
! |
|
36 |
||
3449 | 37 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassListedBeforeItsPool |
38 |
instanceVariableNames:'poolName' |
|
39 |
classVariableNames:'' |
|
40 |
poolDictionaries:'' |
|
41 |
privateIn:ProjectProblem |
|
42 |
! |
|
43 |
||
44 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassListedBeforeItsSuperclass |
|
45 |
instanceVariableNames:'superClassName' |
|
46 |
classVariableNames:'' |
|
47 |
poolDictionaries:'' |
|
48 |
privateIn:ProjectProblem |
|
49 |
! |
|
50 |
||
3160 | 51 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassListedButDoesNotExist |
2798 | 52 |
instanceVariableNames:'' |
53 |
classVariableNames:'' |
|
54 |
poolDictionaries:'' |
|
55 |
privateIn:ProjectProblem |
|
56 |
! |
|
57 |
||
3160 | 58 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassListedMultipleTimes |
2911 | 59 |
instanceVariableNames:'' |
60 |
classVariableNames:'' |
|
61 |
poolDictionaries:'' |
|
62 |
privateIn:ProjectProblem |
|
63 |
! |
|
64 |
||
3160 | 65 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassNotListed |
2911 | 66 |
instanceVariableNames:'' |
67 |
classVariableNames:'' |
|
68 |
poolDictionaries:'' |
|
69 |
privateIn:ProjectProblem |
|
70 |
! |
|
71 |
||
3449 | 72 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassIsCompiledButSuperclassIsAutoloaded |
73 |
instanceVariableNames:'' |
|
2798 | 74 |
classVariableNames:'' |
75 |
poolDictionaries:'' |
|
76 |
privateIn:ProjectProblem |
|
77 |
! |
|
78 |
||
3588 | 79 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassShouldNotBeInPackage |
80 |
instanceVariableNames:'' |
|
81 |
classVariableNames:'' |
|
82 |
poolDictionaries:'' |
|
83 |
privateIn:ProjectProblem |
|
84 |
! |
|
85 |
||
2911 | 86 |
ProjectProblem::ClassProblem subclass:#ClassUsesPoolProblem |
2798 | 87 |
instanceVariableNames:'poolName' |
88 |
classVariableNames:'' |
|
89 |
poolDictionaries:'' |
|
90 |
privateIn:ProjectProblem |
|
91 |
! |
|
92 |
||
2911 | 93 |
ProjectProblem::ClassUsesPoolProblem subclass:#ClassUsesPoolButItIsNotASharedPool |
94 |
instanceVariableNames:'' |
|
95 |
classVariableNames:'' |
|
96 |
poolDictionaries:'' |
|
97 |
privateIn:ProjectProblem |
|
98 |
! |
|
99 |
||
100 |
ProjectProblem::ClassUsesPoolProblem subclass:#ClassUsesPoolInNamespaceButNamespaceIsNotDefined |
|
101 |
instanceVariableNames:'' |
|
102 |
classVariableNames:'' |
|
103 |
poolDictionaries:'' |
|
104 |
privateIn:ProjectProblem |
|
105 |
! |
|
106 |
||
107 |
ProjectProblem::ClassUsesPoolProblem subclass:#ClassUsesPoolButItDoesNotExist |
|
108 |
instanceVariableNames:'' |
|
109 |
classVariableNames:'' |
|
110 |
poolDictionaries:'' |
|
111 |
privateIn:ProjectProblem |
|
112 |
! |
|
113 |
||
2854 | 114 |
ProjectProblem::ClassProblem subclass:#MethodProblem |
115 |
instanceVariableNames:'selector' |
|
2798 | 116 |
classVariableNames:'' |
117 |
poolDictionaries:'' |
|
118 |
privateIn:ProjectProblem |
|
119 |
! |
|
120 |
||
3166 | 121 |
ProjectProblem::MethodProblem subclass:#ExtensionMethodListedButInDifferentPackage |
122 |
instanceVariableNames:'' |
|
123 |
classVariableNames:'' |
|
124 |
poolDictionaries:'' |
|
125 |
privateIn:ProjectProblem |
|
126 |
! |
|
127 |
||
2798 | 128 |
ProjectProblem::MethodProblem subclass:#ExtensionMethodNotListed |
129 |
instanceVariableNames:'' |
|
130 |
classVariableNames:'' |
|
131 |
poolDictionaries:'' |
|
132 |
privateIn:ProjectProblem |
|
133 |
! |
|
134 |
||
3166 | 135 |
ProjectProblem::MethodProblem subclass:#ExtensionMethodsClassDoesNotExist |
136 |
instanceVariableNames:'' |
|
137 |
classVariableNames:'' |
|
138 |
poolDictionaries:'' |
|
139 |
privateIn:ProjectProblem |
|
140 |
! |
|
141 |
||
3449 | 142 |
ProjectProblem::InconsistentProjectDefinition subclass:#ClassIsCompiledButSuperclassProjectDefinitionIsMissing |
143 |
instanceVariableNames:'' |
|
3160 | 144 |
classVariableNames:'' |
145 |
poolDictionaries:'' |
|
146 |
privateIn:ProjectProblem |
|
147 |
! |
|
148 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
149 |
ProjectProblem::MethodProblem subclass:#MethodCompilabilityIssue1 |
2854 | 150 |
instanceVariableNames:'errors warnings' |
151 |
classVariableNames:'' |
|
152 |
poolDictionaries:'' |
|
153 |
privateIn:ProjectProblem |
|
154 |
! |
|
155 |
||
156 |
Object subclass:#Error |
|
157 |
instanceVariableNames:'message startPosition endPosition' |
|
158 |
classVariableNames:'' |
|
159 |
poolDictionaries:'' |
|
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
160 |
privateIn:ProjectProblem::MethodCompilabilityIssue1 |
2854 | 161 |
! |
162 |
||
163 |
Object subclass:#Warning |
|
164 |
instanceVariableNames:'message startPosition endPosition' |
|
165 |
classVariableNames:'' |
|
166 |
poolDictionaries:'' |
|
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
167 |
privateIn:ProjectProblem::MethodCompilabilityIssue1 |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
168 |
! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
169 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
170 |
ProjectProblem::MethodProblem subclass:#MethodCompilabilityIssue2 |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
171 |
instanceVariableNames:'rules errors warnings' |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
172 |
classVariableNames:'' |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
173 |
poolDictionaries:'' |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
174 |
privateIn:ProjectProblem |
2854 | 175 |
! |
176 |
||
2798 | 177 |
ProjectProblem::MethodProblem subclass:#MethodInNoPackage |
178 |
instanceVariableNames:'' |
|
179 |
classVariableNames:'' |
|
180 |
poolDictionaries:'' |
|
181 |
privateIn:ProjectProblem |
|
182 |
! |
|
183 |
||
184 |
ProjectProblem::MethodProblem subclass:#ExtensionMethodListedButDoesNotExist |
|
185 |
instanceVariableNames:'' |
|
186 |
classVariableNames:'' |
|
187 |
poolDictionaries:'' |
|
188 |
privateIn:ProjectProblem |
|
189 |
! |
|
190 |
||
2854 | 191 |
ProjectProblem::MethodProblem subclass:#MethodSourceCorrupted |
192 |
instanceVariableNames:'' |
|
193 |
classVariableNames:'' |
|
194 |
poolDictionaries:'' |
|
195 |
privateIn:ProjectProblem |
|
196 |
! |
|
197 |
||
198 |
ProjectProblem::MethodProblem subclass:#MethodSourceNotAvailable |
|
199 |
instanceVariableNames:'' |
|
200 |
classVariableNames:'' |
|
201 |
poolDictionaries:'' |
|
202 |
privateIn:ProjectProblem |
|
203 |
! |
|
204 |
||
2798 | 205 |
ProjectProblem subclass:#ProjectDefinitionDoesNotExist |
206 |
instanceVariableNames:'' |
|
207 |
classVariableNames:'' |
|
208 |
poolDictionaries:'' |
|
209 |
privateIn:ProjectProblem |
|
210 |
! |
|
211 |
||
212 |
!ProjectProblem class methodsFor:'documentation'! |
|
213 |
||
214 |
copyright |
|
215 |
" |
|
216 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
2911 | 217 |
All Rights Reserved |
2798 | 218 |
|
219 |
This software is furnished under a license and may be used |
|
220 |
only in accordance with the terms of that license and with the |
|
221 |
inclusion of the above copyright notice. This software may not |
|
222 |
be provided or otherwise made available to, or used by, any |
|
223 |
other person. No title to or ownership of the software is |
|
224 |
hereby transferred. |
|
225 |
" |
|
3430 | 226 |
! |
227 |
||
228 |
documentation |
|
229 |
" |
|
230 |
I represent a problem as detect by the project consistency checker, |
|
231 |
which is optionally executed before committing a package to a repository. |
|
232 |
Typically, I find inconsistencies, uncompilable methods or missing prerequisites, |
|
233 |
which might lead to trouble when the package is later to be compiled to a dll via stc. |
|
3431 | 234 |
|
3547 | 235 |
[instance variables:] |
236 |
package - the package in question |
|
237 |
||
238 |
fixes - a collection of possible fixes |
|
239 |
(to be shown in the HTML view of the problem browser) |
|
240 |
||
241 |
allProblems - the collection of problems I am part of |
|
242 |
(only needed to be able to do the |
|
243 |
'fix other problems of this kind' operation, |
|
244 |
for example in the MethodOnNoPackage problem.) |
|
245 |
||
3431 | 246 |
[see also:] |
247 |
ProjectChecker ProjectDefinition |
|
3430 | 248 |
" |
2798 | 249 |
! ! |
250 |
||
251 |
!ProjectProblem class methodsFor:'instance creation'! |
|
252 |
||
3449 | 253 |
newClassIsCompiledButSuperclassIsAutoloaded |
254 |
||
255 |
^ClassIsCompiledButSuperclassIsAutoloaded new |
|
256 |
||
257 |
"Created: / 20-09-2013 / 11:18:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
258 |
! |
|
259 |
||
260 |
newClassIsCompiledButSuperclassProjectDefinitionIsMissing |
|
261 |
||
262 |
^ClassIsCompiledButSuperclassProjectDefinitionIsMissing new |
|
263 |
||
264 |
"Created: / 05-10-2013 / 12:43:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
265 |
! |
|
266 |
||
2911 | 267 |
newClassListedBeforeItsPool |
268 |
||
269 |
^ClassListedBeforeItsPool new |
|
270 |
||
271 |
"Created: / 13-09-2012 / 17:13:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
272 |
! |
|
273 |
||
274 |
newClassListedBeforeItsSuperclass |
|
275 |
||
276 |
^ClassListedBeforeItsSuperclass new |
|
277 |
||
278 |
"Created: / 13-09-2012 / 17:13:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
279 |
! |
|
280 |
||
2798 | 281 |
newClassListedButDoesNotExist |
282 |
||
283 |
^ClassListedButDoesNotExist new |
|
284 |
||
285 |
"Created: / 23-02-2012 / 13:18:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
286 |
! |
|
287 |
||
2911 | 288 |
newClassListedMultipleTimes |
289 |
||
290 |
^ClassListedMultipleTimes new |
|
291 |
||
292 |
"Created: / 13-09-2012 / 17:40:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
293 |
! |
|
294 |
||
2798 | 295 |
newClassNotListed |
296 |
||
297 |
^ClassNotListed new |
|
298 |
||
299 |
"Created: / 23-02-2012 / 13:59:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
300 |
! |
|
301 |
||
3588 | 302 |
newClassShouldNotBeInPackage |
303 |
||
304 |
^ClassShouldNotBeInPackage new |
|
305 |
! |
|
306 |
||
2798 | 307 |
newClassUsesPoolButItDoesNotExist |
308 |
||
309 |
^ClassUsesPoolButItDoesNotExist new |
|
310 |
||
311 |
"Created: / 23-02-2012 / 13:37:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
312 |
! |
|
313 |
||
314 |
newClassUsesPoolButItIsNotASharedPool |
|
315 |
||
316 |
^ClassUsesPoolButItIsNotASharedPool new |
|
317 |
||
318 |
"Created: / 23-02-2012 / 13:48:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
319 |
! |
|
320 |
||
2911 | 321 |
newClassUsesPoolInNamespaceButNamespaceIsNotDefined |
322 |
||
323 |
^ClassUsesPoolInNamespaceButNamespaceIsNotDefined new |
|
324 |
||
325 |
"Created: / 13-09-2012 / 16:40:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
326 |
! |
|
327 |
||
2798 | 328 |
newExtensionMethodListedButDoesNotExist |
329 |
||
330 |
^ExtensionMethodListedButDoesNotExist new |
|
331 |
||
332 |
"Created: / 23-02-2012 / 14:26:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
333 |
! |
|
334 |
||
3166 | 335 |
newExtensionMethodListedButInDifferentPackage |
336 |
||
337 |
^ExtensionMethodListedButInDifferentPackage new |
|
338 |
! |
|
339 |
||
2798 | 340 |
newExtensionMethodNotListed |
341 |
||
342 |
^ExtensionMethodNotListed new |
|
343 |
||
344 |
"Created: / 23-02-2012 / 14:27:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
345 |
! |
|
346 |
||
3166 | 347 |
newExtensionMethodsClassDoesNotExist |
348 |
||
349 |
^ExtensionMethodsClassDoesNotExist new |
|
350 |
! |
|
351 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
352 |
newMethodCompilabilityIssue1 |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
353 |
^ MethodCompilabilityIssue1 new |
2854 | 354 |
|
355 |
"Created: / 11-04-2012 / 15:34:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
356 |
"Modified: / 29-05-2014 / 15:35:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
357 |
! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
358 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
359 |
newMethodCompilabilityIssue2 |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
360 |
^ MethodCompilabilityIssue2 new |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
361 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
362 |
"Created: / 29-05-2014 / 15:37:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2854 | 363 |
! |
364 |
||
2798 | 365 |
newMethodInNoPackage |
366 |
||
367 |
^MethodInNoPackage new |
|
368 |
||
369 |
"Created: / 23-02-2012 / 14:27:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
370 |
! |
|
371 |
||
2854 | 372 |
newMethodSourceCorrupted |
373 |
||
374 |
^MethodSourceCorrupted new |
|
375 |
||
376 |
"Created: / 11-04-2012 / 12:35:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
377 |
! |
|
378 |
||
379 |
newMethodSourceNotAvailable |
|
380 |
||
381 |
^MethodSourceNotAvailable new |
|
382 |
||
383 |
"Created: / 11-04-2012 / 12:31:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
384 |
! |
|
385 |
||
2798 | 386 |
newProjectDefinitionDoesNotExist |
387 |
||
388 |
^ProjectDefinitionDoesNotExist new |
|
389 |
||
390 |
"Created: / 23-02-2012 / 13:08:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
391 |
! ! |
|
392 |
||
393 |
!ProjectProblem methodsFor:'accessing'! |
|
394 |
||
3547 | 395 |
allProblems:something |
396 |
allProblems := something. |
|
397 |
! |
|
398 |
||
3549 | 399 |
countOtherProblemsOfThisKind |
400 |
^ allProblems |
|
401 |
count: |
|
402 |
[:problem | |
|
403 |
problem class == self class |
|
404 |
and:[ problem ~~ self |
|
405 |
and:[ problem alreadyFixed not]] |
|
406 |
]. |
|
407 |
! |
|
408 |
||
2798 | 409 |
description |
410 |
"Return a (HTML) describing the problem." |
|
411 |
||
412 |
^self subclassResponsibility |
|
413 |
||
414 |
"Created: / 23-02-2012 / 13:04:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
415 |
! |
|
416 |
||
2854 | 417 |
descriptionAndFixes |
418 |
"Return a (HTML) describing the problem plus possible fixes." |
|
419 |
||
3169 | 420 |
|descriptionText fixes| |
421 |
||
422 |
(self alreadyFixed) ifTrue:[^ 'Already fixed.']. |
|
423 |
||
424 |
descriptionText := self description. |
|
425 |
||
426 |
"/ don't use cached fixes (after a fix, the problem may return an empty fix list) |
|
427 |
fixes := self fixes. |
|
428 |
fixes isEmpty ifTrue:[ ^ descriptionText ]. |
|
2854 | 429 |
|
430 |
^String streamContents:[:html | |
|
3169 | 431 |
html nextPutAll: descriptionText. |
2798 | 432 |
|
3169 | 433 |
html nextPutAll: '<br><br>'. |
434 |
fixes size == 1 ifTrue:[ |
|
435 |
html nextPutLine: 'Possible fix:'. |
|
436 |
] ifFalse:[ |
|
437 |
html nextPutLine: 'Possible fixes:'. |
|
438 |
]. |
|
439 |
html nextPutLine:'<ul>'. |
|
440 |
fixes withIndexDo:[:fix :index| |
|
441 |
html |
|
442 |
nextPutAll:'<li><a action="doit: self application doFix: '; |
|
443 |
nextPutAll: index printString; |
|
444 |
nextPutAll:'">'; |
|
445 |
nextPutAll: fix first; |
|
446 |
nextPutAll:'</a></li>'. |
|
447 |
]. |
|
448 |
html nextPutLine:'</ul>'. |
|
2854 | 449 |
]. |
2798 | 450 |
|
2854 | 451 |
"Created: / 26-07-2012 / 09:46:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
452 |
! |
|
453 |
||
2798 | 454 |
label |
455 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
456 |
||
457 |
^self subclassResponsibility |
|
458 |
||
459 |
"Created: / 23-02-2012 / 13:03:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
460 |
! |
|
461 |
||
462 |
package |
|
463 |
^ package |
|
464 |
! |
|
465 |
||
466 |
package:aSymbol |
|
2854 | 467 |
package := aSymbol asSymbol. |
468 |
||
469 |
"Modified: / 11-04-2012 / 16:00:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2798 | 470 |
! |
471 |
||
472 |
packageDefinitionClass |
|
473 |
^ProjectDefinition definitionClassForPackage: package |
|
474 |
||
475 |
"Created: / 23-02-2012 / 13:26:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
476 |
! |
|
477 |
||
478 |
severity |
|
479 |
"Return a severity - one of #error, #warning, #info" |
|
480 |
||
2911 | 481 |
^#warning "/by default |
2798 | 482 |
|
483 |
"Created: / 23-02-2012 / 13:09:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
484 |
! ! |
|
485 |
||
2854 | 486 |
!ProjectProblem methodsFor:'fixing'! |
487 |
||
3549 | 488 |
allUnfixedProblemsOfMyKindDo:aBlock |
489 |
allProblems do:[:p | |
|
490 |
(p class == self class and:[ p alreadyFixed not]) ifTrue:[ |
|
491 |
aBlock value:p |
|
492 |
] |
|
493 |
] |
|
494 |
! |
|
495 |
||
3169 | 496 |
alreadyFixed |
497 |
^ false |
|
498 |
! |
|
499 |
||
2854 | 500 |
doFix: index |
501 |
self initializeFixes. |
|
3169 | 502 |
^ (fixes at: index) second value |
2854 | 503 |
|
504 |
"Created: / 26-07-2012 / 10:07:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3549 | 505 |
! |
506 |
||
507 |
fixes |
|
508 |
"Return (possibly empty) list of actions that |
|
509 |
the user may take to fix/investigate the problem. |
|
510 |
Returned value should be list of pairs (label, action block). |
|
511 |
To be overriden in subclasses. |
|
512 |
||
513 |
The list should be an array of pairs ( fix label , fix block ). |
|
514 |
Fix block should return true, if the fix was successful, |
|
515 |
false otherwise" |
|
516 |
||
517 |
^#() |
|
518 |
||
519 |
"Created: / 26-07-2012 / 09:46:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2854 | 520 |
! ! |
521 |
||
522 |
!ProjectProblem methodsFor:'initialization'! |
|
523 |
||
524 |
initializeFixes |
|
525 |
||
526 |
fixes isNil ifTrue:[ |
|
2911 | 527 |
fixes := self fixes |
2854 | 528 |
]. |
529 |
||
530 |
"/ super initialize. -- commented since inherited method does nothing |
|
531 |
||
532 |
"Created: / 26-07-2012 / 09:54:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
533 |
! ! |
|
534 |
||
2798 | 535 |
!ProjectProblem methodsFor:'printing & storing'! |
536 |
||
3382
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
537 |
displayOn:aGCOrStream |
3169 | 538 |
|lbl| |
539 |
||
3382
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
540 |
"/ what a kludge - Dolphin and Squeak mean: printOn: a stream; |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
541 |
"/ ST/X (and some old ST80's) mean: draw-yourself on a GC. |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
542 |
(aGCOrStream isStream) ifFalse:[ |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
543 |
^ super displayOn:aGCOrStream |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
544 |
]. |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
545 |
|
3169 | 546 |
lbl := self label. |
3382
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
547 |
self alreadyFixed ifTrue:[ |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
548 |
aGCOrStream |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
549 |
nextPutAll:lbl string; |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
550 |
emphasis:#italic; |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
551 |
nextPutAll:' (already fixed)' |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
552 |
] ifFalse:[ |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
553 |
aGCOrStream nextPutAll:lbl. |
025420bf2e2f
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
3342
diff
changeset
|
554 |
]. |
2798 | 555 |
|
556 |
"Created: / 14-02-2012 / 17:02:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
557 |
! |
|
558 |
||
559 |
printOn:aStream |
|
560 |
"append a printed representation if the receiver to the argument, aStream" |
|
561 |
||
562 |
super printOn:aStream. |
|
563 |
aStream nextPut:$(. |
|
564 |
self severity printOn:aStream. |
|
565 |
aStream nextPut:$:; space. |
|
566 |
self label printOn:aStream. |
|
567 |
aStream nextPut:$). |
|
568 |
||
569 |
"Modified: / 23-02-2012 / 16:49:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
570 |
! ! |
|
571 |
||
572 |
!ProjectProblem methodsFor:'utilities-HTML'! |
|
573 |
||
574 |
linkToClass: classOrclassName |
|
2854 | 575 |
| className | |
2798 | 576 |
|
577 |
className := classOrclassName isBehavior |
|
2911 | 578 |
ifTrue: [classOrclassName storeString] |
579 |
ifFalse:[classOrclassName]. |
|
2798 | 580 |
|
581 |
^'<A INFO="Click to browse class" ACTION="doit: UserPreferences current systemBrowserClass openInClass:%1"><CODE>%1</CODE></A>' |
|
2911 | 582 |
bindWith: className |
2798 | 583 |
|
584 |
"Created: / 23-02-2012 / 13:44:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
585 |
! |
|
586 |
||
587 |
linkToClass: classOrclassName selector: selector |
|
2854 | 588 |
^self linkToClass: classOrclassName selector: selector omitClassName: false |
589 |
||
590 |
"Created: / 23-02-2012 / 13:45:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
591 |
! |
|
592 |
||
593 |
linkToClass: classOrclassName selector: selector omitClassName: omitClassName |
|
2798 | 594 |
|
595 |
| className | |
|
596 |
className := classOrclassName isBehavior |
|
2911 | 597 |
ifTrue: [classOrclassName name] |
598 |
ifFalse:[classOrclassName]. |
|
2854 | 599 |
^omitClassName ifTrue:[ |
2911 | 600 |
'<A INFO="Click to browse method" ACTION="doit: UserPreferences current systemBrowserClass openInClass:%1 selector: %2"><CODE>#%3</CODE></A>' |
601 |
bindWith: className |
|
602 |
with: selector storeString |
|
603 |
with: selector |
|
2854 | 604 |
] ifFalse:[ |
2911 | 605 |
'<A INFO="Click to browse method" ACTION="doit: UserPreferences current systemBrowserClass openInClass:%1 selector: %2"><CODE>%1>>%3</CODE></A>' |
606 |
bindWith: className |
|
607 |
with: selector storeString |
|
608 |
with: selector |
|
2854 | 609 |
] |
2798 | 610 |
|
2854 | 611 |
"Created: / 26-07-2012 / 10:26:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2798 | 612 |
! ! |
613 |
||
614 |
!ProjectProblem::ClassProblem methodsFor:'accessing'! |
|
615 |
||
616 |
className |
|
617 |
^ className |
|
618 |
! |
|
619 |
||
620 |
className:something |
|
621 |
className := something. |
|
2854 | 622 |
! |
623 |
||
624 |
klass |
|
625 |
"Return the class which is subject of the problem" |
|
2911 | 626 |
|
3143 | 627 |
"/ | class | |
628 |
"/ |
|
629 |
"/ (className endsWith: ' class') ifTrue:[ |
|
630 |
"/ class := Smalltalk at: (className copyTo: className size - 6) asSymbol. |
|
631 |
"/ class := class theMetaclass. |
|
632 |
"/ ] ifFalse:[ |
|
633 |
"/ class := Smalltalk at: className asSymbol |
|
634 |
"/ ]. |
|
635 |
"/ ^class |
|
2854 | 636 |
|
3143 | 637 |
"/ the above is exactly: |
3154 | 638 |
^ Smalltalk classNamed:className |
2854 | 639 |
|
640 |
"Created: / 26-07-2012 / 10:21:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2798 | 641 |
! ! |
642 |
||
3198 | 643 |
!ProjectProblem::ClassProblem methodsFor:'fixing'! |
644 |
||
645 |
doUpdateAllProjectDefinitions |
|
646 |
"full update the project definition class; |
|
647 |
will do a rescan to add all missing items" |
|
648 |
||
649 |
| def | |
|
650 |
||
651 |
def := self packageDefinitionClass. |
|
652 |
def isNil ifTrue:[ ^ false ]. |
|
653 |
||
654 |
def |
|
655 |
updateMethodsCodeUsingCompiler:Compiler |
|
656 |
ignoreOldDefinition:false. |
|
657 |
||
658 |
UserNotification notify: ('Project definitions updated. Do not forget to check in build support files!!'). |
|
659 |
^true |
|
660 |
! ! |
|
661 |
||
3549 | 662 |
!ProjectProblem::InconsistentProjectDefinition methodsFor:'fixing'! |
2911 | 663 |
|
3160 | 664 |
fixes |
2911 | 665 |
|
3160 | 666 |
^Array |
3198 | 667 |
with: (Array with: 'Full update of the project definitions (rescan)' with: [ self doUpdateAllProjectDefinitions ]) |
2911 | 668 |
! ! |
669 |
||
3449 | 670 |
!ProjectProblem::ClassListedBeforeItsPool methodsFor:'accessing'! |
671 |
||
672 |
poolName |
|
673 |
^ poolName |
|
674 |
! |
|
675 |
||
676 |
poolName:something |
|
677 |
poolName := something. |
|
678 |
! ! |
|
679 |
||
680 |
!ProjectProblem::ClassListedBeforeItsPool methodsFor:'accessing-description'! |
|
681 |
||
682 |
description |
|
683 |
"Return a (HTML) describing the problem." |
|
684 |
||
685 |
^ |
|
686 |
'Class %2 is listed in project definition (%1) before one of its pools (%3). |
|
687 |
<br>Such class will fail to compile (if the package is being stc-compiled) |
|
688 |
and load (if the package is being loaded from source). |
|
689 |
<br>Make sure class (%3) is listed before (%2). |
|
690 |
||
691 |
' |
|
692 |
bindWith: (self linkToClass: self packageDefinitionClass class selector: #classNamesAndAttributes omitClassName: true) |
|
693 |
with: (self linkToClass: className) |
|
694 |
with: (self linkToClass: poolName) |
|
695 |
||
696 |
"Modified: / 13-09-2012 / 18:29:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
697 |
! |
|
698 |
||
699 |
label |
|
700 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
701 |
||
702 |
^'Class %1 listed in project definition "%2" before one of its pools' bindWith: className allBold with:self packageDefinitionClass |
|
703 |
||
704 |
"Modified: / 13-09-2012 / 17:36:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
705 |
! ! |
|
706 |
||
707 |
!ProjectProblem::ClassListedBeforeItsSuperclass methodsFor:'accessing'! |
|
708 |
||
709 |
superClassName |
|
710 |
^ superClassName |
|
711 |
! |
|
712 |
||
713 |
superClassName:something |
|
714 |
superClassName := something. |
|
715 |
! ! |
|
716 |
||
717 |
!ProjectProblem::ClassListedBeforeItsSuperclass methodsFor:'accessing-description'! |
|
718 |
||
719 |
description |
|
720 |
"Return a (HTML) describing the problem." |
|
721 |
||
722 |
^ |
|
723 |
'Class %2 is listed in project definition (%1) before its superclass %3. |
|
724 |
<br>The package can be stc-compiled |
|
725 |
(because the generated makefile compiles in correct order) |
|
726 |
but the class may fail to load from source. |
|
727 |
<br>Make sure %3 is listed before %2. |
|
728 |
||
729 |
' |
|
730 |
bindWith: (self linkToClass: self packageDefinitionClass class selector: #classNamesAndAttributes omitClassName: true) |
|
731 |
with: (self linkToClass: className) |
|
732 |
with: (self linkToClass: superClassName) |
|
733 |
||
734 |
"Modified: / 13-09-2012 / 18:29:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
735 |
! |
|
736 |
||
737 |
label |
|
738 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
739 |
||
3691 | 740 |
^'Class %1 listed in project definition "%2" before its superclass %3' |
741 |
bindWith: className allBold |
|
742 |
with:self packageDefinitionClass |
|
743 |
with:superClassName |
|
3449 | 744 |
|
745 |
"Modified: / 13-09-2012 / 17:36:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
746 |
! ! |
|
747 |
||
2911 | 748 |
!ProjectProblem::ClassListedButDoesNotExist methodsFor:'accessing'! |
749 |
||
3160 | 750 |
severity |
751 |
"Return a severity - one of #error, #warning, #info" |
|
752 |
||
753 |
^#error |
|
754 |
||
755 |
"Created: / 11-04-2012 / 12:48:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
756 |
! ! |
|
757 |
||
758 |
!ProjectProblem::ClassListedButDoesNotExist methodsFor:'accessing-description'! |
|
759 |
||
2911 | 760 |
description |
761 |
"Return a (HTML) describing the problem." |
|
3550 | 762 |
|
763 |
|msg| |
|
2911 | 764 |
|
3550 | 765 |
self klass isNil ifTrue:[ |
766 |
msg := |
|
767 |
'Class "<code>%1</code>" is listed in the project definition but not present in the system. |
|
768 |
<br> |
|
2911 | 769 |
You should either create it or remove it from %2.' |
3550 | 770 |
] ifFalse:[ |
771 |
msg := |
|
772 |
'Class "<code>%1</code>" is listed in the project definition but is located in another package ("',self klass package,'") |
|
773 |
<br> |
|
774 |
You should either move the class to this package it or remove it from the list in %2.' |
|
775 |
]. |
|
776 |
^ msg |
|
777 |
bindWith: className |
|
778 |
with: (self linkToClass: self packageDefinitionClass class selector: #classNamesAndAttributes) |
|
2911 | 779 |
|
780 |
"Modified: / 28-02-2012 / 22:23:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
781 |
! |
|
782 |
||
783 |
label |
|
3160 | 784 |
^'Missing class: ', className allBold |
2911 | 785 |
|
786 |
"Modified: / 23-02-2012 / 13:20:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
787 |
! ! |
|
788 |
||
3550 | 789 |
!ProjectProblem::ClassListedButDoesNotExist methodsFor:'fixing'! |
790 |
||
791 |
alreadyFixed |
|
792 |
| cls def | |
|
793 |
||
794 |
def := self packageDefinitionClass. |
|
795 |
def isNil ifTrue:[ ^ false ]. "/ ouch - can this happen? |
|
796 |
||
797 |
(def compiled_classNames includes:className) ifFalse:[^ true]. |
|
798 |
||
799 |
cls := self klass. |
|
800 |
cls isNil ifTrue:[^ false]. |
|
801 |
||
802 |
^ cls package = self package |
|
803 |
! |
|
804 |
||
805 |
doMoveClassToPackage |
|
806 |
| cls | |
|
807 |
||
808 |
cls := self klass. |
|
809 |
cls isNil ifTrue:[ ^ false ]. |
|
810 |
cls package:(cls package). |
|
811 |
UserNotification notify: ('Do not forget to check in the class into the appropriate repository!!'). |
|
812 |
^true |
|
813 |
! |
|
814 |
||
815 |
doRemoveClassFromProjectDefinition |
|
816 |
| def cls | |
|
817 |
||
818 |
def := self packageDefinitionClass. |
|
819 |
def isNil ifTrue:[ ^ false ]. |
|
820 |
cls := self klass. |
|
821 |
cls isNil ifTrue:[ ^ false ]. |
|
822 |
def excludeClasses:{ cls } usingCompiler:nil. |
|
823 |
UserNotification notify: ('Class removed from project. Do not forget to check in build support files!!' bindWith: className). |
|
824 |
^true |
|
825 |
! |
|
826 |
||
827 |
fixes |
|
828 |
|allFixes| |
|
829 |
||
830 |
allFixes := OrderedCollection new. |
|
831 |
allFixes add:{ |
|
832 |
'Remove from project definition' . |
|
833 |
[ self doRemoveClassFromProjectDefinition ] |
|
834 |
}. |
|
835 |
self klass notNil ifTrue:[ |
|
836 |
allFixes add:{ |
|
837 |
'Move class to package' . |
|
838 |
[ self doMoveClassToPackage ] |
|
839 |
}. |
|
840 |
]. |
|
841 |
allFixes addAll:super fixes. |
|
842 |
^ allFixes |
|
843 |
! ! |
|
844 |
||
3160 | 845 |
!ProjectProblem::ClassListedMultipleTimes methodsFor:'accessing-description'! |
2911 | 846 |
|
847 |
description |
|
848 |
"Return a (HTML) describing the problem." |
|
849 |
||
850 |
^ |
|
851 |
'A class %1 is listed more than once in %2. |
|
852 |
||
853 |
Such package will fail to compile, as linker will complain |
|
3147 | 854 |
about multiple definitions of the same symbols. Make sure each |
2911 | 855 |
class is listed only once. |
856 |
' |
|
857 |
bindWith: (self linkToClass: className) |
|
3645
175a54263457
Fixes description in ClassListedMultipleTimes problem.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3588
diff
changeset
|
858 |
with: (self linkToClass: self packageDefinitionClass class selector: #classNamesAndAttributes) |
175a54263457
Fixes description in ClassListedMultipleTimes problem.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3588
diff
changeset
|
859 |
|
175a54263457
Fixes description in ClassListedMultipleTimes problem.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3588
diff
changeset
|
860 |
"Modified: / 26-11-2014 / 09:25:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2911 | 861 |
! |
862 |
||
863 |
label |
|
864 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
865 |
||
3160 | 866 |
^'Class %1 listed multiple times in project definition "%2"' bindWith: className allBold with:self packageDefinitionClass |
2911 | 867 |
|
868 |
"Modified: / 23-02-2012 / 13:34:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
869 |
! ! |
|
870 |
||
3160 | 871 |
!ProjectProblem::ClassNotListed methodsFor:'accessing-description'! |
2798 | 872 |
|
873 |
description |
|
874 |
"Return a (HTML) describing the problem." |
|
875 |
||
876 |
^ |
|
3147 | 877 |
'Class %1 is not listed in project definition (%2). |
878 |
<br>The class won''t be compiled and - if some other class dependents on it - the whole package will fail to compile |
|
2854 | 879 |
at all.' |
880 |
bindWith: (self linkToClass: className) |
|
881 |
with: (self linkToClass: self packageDefinitionClass class selector: #classNamesAndAttributes omitClassName: true) |
|
882 |
||
883 |
"Modified: / 26-07-2012 / 10:27:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
884 |
! |
|
885 |
||
3143 | 886 |
label |
887 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
888 |
||
3160 | 889 |
^'Class %1 not listed in project definition "%2"' bindWith: className allBold with:self packageDefinitionClass |
3143 | 890 |
|
891 |
"Modified: / 23-02-2012 / 13:55:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
892 |
! ! |
|
893 |
||
894 |
!ProjectProblem::ClassNotListed methodsFor:'fixing'! |
|
895 |
||
3549 | 896 |
alreadyFixed |
897 |
| cls def | |
|
898 |
||
899 |
def := self packageDefinitionClass. |
|
900 |
def isNil ifTrue:[ ^ false ]. "/ ouch - can this happen? |
|
901 |
||
902 |
cls := self klass. |
|
903 |
"/ One may "fix" the problem by actually removing the class. |
|
904 |
"/ In this case, consider problem as "fixed". |
|
905 |
cls isNil ifTrue:[^ true]. |
|
906 |
||
907 |
^ (def compiled_classNames includes:className) |
|
908 |
! |
|
909 |
||
910 |
doIncludeAllClassesInProject |
|
911 |
"Include all unlisted subject classes in project definition. |
|
912 |
Return false if fix fails, true otherwise" |
|
913 |
||
914 |
|any| |
|
915 |
||
916 |
any := false. |
|
917 |
self allUnfixedProblemsOfMyKindDo:[:p | |
|
918 |
any := any | (p doIncludeInProjectAsAutoloaded:false) |
|
919 |
]. |
|
920 |
^ any |
|
921 |
! |
|
922 |
||
2854 | 923 |
doIncludeInProject |
924 |
"Include subject class in project definition. Return false if |
|
925 |
fix fails, true otherwise" |
|
2798 | 926 |
|
3160 | 927 |
^ self doIncludeInProjectAsAutoloaded:false |
2854 | 928 |
! |
2798 | 929 |
|
2854 | 930 |
doIncludeInProjectAsAutoloaded |
931 |
"Include subject class in project definition. Return false if |
|
932 |
fix fails, true otherwise" |
|
3160 | 933 |
|
934 |
^ self doIncludeInProjectAsAutoloaded:true |
|
935 |
! |
|
936 |
||
937 |
doIncludeInProjectAsAutoloaded:asAutoloaded |
|
938 |
"Include subject class in project definition. Return false if |
|
939 |
fix fails, true otherwise" |
|
940 |
||
2854 | 941 |
| def cls | |
3160 | 942 |
|
2854 | 943 |
def := self packageDefinitionClass. |
944 |
def isNil ifTrue:[ ^ false ]. |
|
945 |
cls := self klass. |
|
946 |
cls isNil ifTrue:[ ^ false ]. |
|
3160 | 947 |
asAutoloaded ifTrue:[ |
948 |
def makeClassesAutoloaded:(Array with: cls) usingCompiler: nil. |
|
949 |
] ifFalse:[ |
|
950 |
def includeClasses:(Array with: cls) usingCompiler: nil. |
|
951 |
]. |
|
3144 | 952 |
UserNotification notify: ('Class added. Do not forget to check in build support files!!' bindWith: className). |
2854 | 953 |
^true |
954 |
||
955 |
"Created: / 26-07-2012 / 10:41:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
956 |
! |
|
957 |
||
958 |
fixes |
|
3549 | 959 |
|numOther fixes| |
2854 | 960 |
|
3549 | 961 |
numOther := self countOtherProblemsOfThisKind. |
962 |
fixes := OrderedCollection new. |
|
963 |
fixes add:{ 'Add class to project (as compiled)' . |
|
964 |
[ self doIncludeInProject ] |
|
965 |
}. |
|
966 |
numOther > 0 ifTrue:[ |
|
967 |
fixes add:{ 'Add all listed classes to project (as compiled)' . |
|
968 |
[ self doIncludeAllClassesInProject ] |
|
969 |
}. |
|
970 |
]. |
|
971 |
||
972 |
fixes |
|
973 |
add:{ 'Add class to project as autoloaded' . |
|
974 |
[ self doIncludeInProjectAsAutoloaded ] |
|
975 |
}; |
|
976 |
add:{ 'Full update of the project definitions (rescan)' . |
|
977 |
[ self doUpdateAllProjectDefinitions ] |
|
978 |
}. |
|
979 |
^ fixes |
|
2854 | 980 |
|
981 |
"Created: / 26-07-2012 / 10:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2798 | 982 |
! ! |
983 |
||
3449 | 984 |
!ProjectProblem::ClassIsCompiledButSuperclassIsAutoloaded methodsFor:'accessing'! |
3160 | 985 |
|
2798 | 986 |
description |
987 |
"Return a (HTML) describing the problem." |
|
988 |
||
989 |
^ |
|
3775 | 990 |
'Class %1 is compiled (i.e., not autoloaded) but its superclass %2 is |
3449 | 991 |
is autoloaded. Such class won''t compile because of missing superclass .H/.STH file. |
3776 | 992 |
To fix it, either make %1 autoloaded or make %2 compiled.' |
3449 | 993 |
bindWith: (self linkToClass: className) |
994 |
with: (self linkToClass: (Smalltalk at: className) superclass name) |
|
2798 | 995 |
|
3449 | 996 |
"Modified: / 20-09-2013 / 11:04:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2798 | 997 |
! |
998 |
||
999 |
label |
|
1000 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1001 |
||
3449 | 1002 |
^ 'Class ', className , ' is compiled but its superclass is autoloaded' |
1003 |
||
1004 |
"Modified: / 20-09-2013 / 11:00:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1005 |
! ! |
|
1006 |
||
1007 |
!ProjectProblem::ClassIsCompiledButSuperclassIsAutoloaded methodsFor:'fixing'! |
|
1008 |
||
1009 |
doIncludeInProjectAsAutoloaded |
|
1010 |
"Include subject class in project definition. Return false if |
|
1011 |
fix fails, true otherwise" |
|
1012 |
||
1013 |
^ self doIncludeInProjectAsAutoloaded:true |
|
1014 |
! |
|
1015 |
||
1016 |
doIncludeInProjectAsAutoloaded:asAutoloaded |
|
1017 |
"Include subject class in project definition. Return false if |
|
1018 |
fix fails, true otherwise" |
|
1019 |
||
1020 |
| def cls | |
|
2911 | 1021 |
|
3449 | 1022 |
def := self packageDefinitionClass. |
1023 |
def isNil ifTrue:[ ^ false ]. |
|
1024 |
cls := self klass. |
|
1025 |
cls isNil ifTrue:[ ^ false ]. |
|
1026 |
asAutoloaded ifTrue:[ |
|
1027 |
def makeClassesAutoloaded:(Array with: cls) usingCompiler: nil. |
|
1028 |
] ifFalse:[ |
|
1029 |
def includeClasses:(Array with: cls) usingCompiler: nil. |
|
1030 |
]. |
|
1031 |
UserNotification notify: ('Class added. Do not forget to check in build support files!!' bindWith: className). |
|
1032 |
^true |
|
1033 |
||
1034 |
"Created: / 26-07-2012 / 10:41:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1035 |
! |
|
1036 |
||
1037 |
fixes |
|
1038 |
||
1039 |
^Array |
|
1040 |
with: (Array with: 'Add class ', className , ' to project as autoloaded' with: [ self doIncludeInProjectAsAutoloaded ]) |
|
1041 |
||
1042 |
"Created: / 26-07-2012 / 10:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1043 |
"Modified: / 20-09-2013 / 11:06:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2911 | 1044 |
! ! |
1045 |
||
3588 | 1046 |
!ProjectProblem::ClassShouldNotBeInPackage methodsFor:'accessing-description'! |
1047 |
||
1048 |
description |
|
1049 |
"Return a (HTML) describing the problem." |
|
1050 |
||
1051 |
^ |
|
1052 |
'Class %1 should not be assigned to a Folder-only package (%2). |
|
1053 |
Folder-only packages are only meant for organization and to visit subprojects for compilation. |
|
1054 |
<br>The class won''t be compiled and - if some other class dependents on it - the whole package will fail to compile |
|
1055 |
at all.' |
|
1056 |
bindWith: (self linkToClass: className) |
|
1057 |
with: (self linkToClass: self packageDefinitionClass class selector: #classNamesAndAttributes omitClassName: true) |
|
1058 |
! |
|
1059 |
||
1060 |
label |
|
1061 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1062 |
||
1063 |
^'Class %1 not listed in project definition "%2"' bindWith: className allBold with:self packageDefinitionClass |
|
1064 |
||
1065 |
"Modified: / 23-02-2012 / 13:55:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1066 |
! ! |
|
1067 |
||
1068 |
!ProjectProblem::ClassShouldNotBeInPackage methodsFor:'fixing'! |
|
1069 |
||
1070 |
alreadyFixed |
|
1071 |
| cls def | |
|
1072 |
||
1073 |
def := self packageDefinitionClass. |
|
1074 |
def isNil ifTrue:[ ^ false ]. "/ ouch - can this happen? |
|
1075 |
||
1076 |
cls := self klass. |
|
1077 |
"/ One may "fix" the problem by actually removing the class. |
|
1078 |
"/ In this case, consider problem as "fixed". |
|
1079 |
cls isNil ifTrue:[^ true]. |
|
1080 |
||
1081 |
^ (def compiled_classNames includes:className) |
|
1082 |
! |
|
1083 |
||
1084 |
doIncludeAllClassesInProject |
|
1085 |
"Include all unlisted subject classes in project definition. |
|
1086 |
Return false if fix fails, true otherwise" |
|
1087 |
||
1088 |
|any| |
|
1089 |
||
1090 |
any := false. |
|
1091 |
self allUnfixedProblemsOfMyKindDo:[:p | |
|
1092 |
any := any | (p doIncludeInProjectAsAutoloaded:false) |
|
1093 |
]. |
|
1094 |
^ any |
|
1095 |
! |
|
1096 |
||
1097 |
doIncludeInProject |
|
1098 |
"Include subject class in project definition. Return false if |
|
1099 |
fix fails, true otherwise" |
|
1100 |
||
1101 |
^ self doIncludeInProjectAsAutoloaded:false |
|
1102 |
! |
|
1103 |
||
1104 |
doIncludeInProjectAsAutoloaded |
|
1105 |
"Include subject class in project definition. Return false if |
|
1106 |
fix fails, true otherwise" |
|
1107 |
||
1108 |
^ self doIncludeInProjectAsAutoloaded:true |
|
1109 |
! |
|
1110 |
||
1111 |
doIncludeInProjectAsAutoloaded:asAutoloaded |
|
1112 |
"Include subject class in project definition. Return false if |
|
1113 |
fix fails, true otherwise" |
|
1114 |
||
1115 |
| def cls | |
|
1116 |
||
1117 |
def := self packageDefinitionClass. |
|
1118 |
def isNil ifTrue:[ ^ false ]. |
|
1119 |
cls := self klass. |
|
1120 |
cls isNil ifTrue:[ ^ false ]. |
|
1121 |
asAutoloaded ifTrue:[ |
|
1122 |
def makeClassesAutoloaded:(Array with: cls) usingCompiler: nil. |
|
1123 |
] ifFalse:[ |
|
1124 |
def includeClasses:(Array with: cls) usingCompiler: nil. |
|
1125 |
]. |
|
1126 |
UserNotification notify: ('Class added. Do not forget to check in build support files!!' bindWith: className). |
|
1127 |
^true |
|
1128 |
||
1129 |
"Created: / 26-07-2012 / 10:41:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1130 |
! |
|
1131 |
||
1132 |
fixes |
|
1133 |
|numOther fixes| |
|
1134 |
||
1135 |
numOther := self countOtherProblemsOfThisKind. |
|
1136 |
fixes := OrderedCollection new. |
|
1137 |
fixes add:{ 'Add class to project (as compiled)' . |
|
1138 |
[ self doIncludeInProject ] |
|
1139 |
}. |
|
1140 |
numOther > 0 ifTrue:[ |
|
1141 |
fixes add:{ 'Add all listed classes to project (as compiled)' . |
|
1142 |
[ self doIncludeAllClassesInProject ] |
|
1143 |
}. |
|
1144 |
]. |
|
1145 |
||
1146 |
fixes |
|
1147 |
add:{ 'Add class to project as autoloaded' . |
|
1148 |
[ self doIncludeInProjectAsAutoloaded ] |
|
1149 |
}; |
|
1150 |
add:{ 'Full update of the project definitions (rescan)' . |
|
1151 |
[ self doUpdateAllProjectDefinitions ] |
|
1152 |
}. |
|
1153 |
^ fixes |
|
1154 |
||
1155 |
"Created: / 26-07-2012 / 10:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1156 |
! ! |
|
1157 |
||
2911 | 1158 |
!ProjectProblem::ClassUsesPoolProblem methodsFor:'accessing'! |
1159 |
||
2798 | 1160 |
poolName |
1161 |
^ poolName |
|
1162 |
! |
|
1163 |
||
1164 |
poolName:something |
|
1165 |
poolName := something. |
|
1166 |
! ! |
|
1167 |
||
3160 | 1168 |
!ProjectProblem::ClassUsesPoolButItIsNotASharedPool methodsFor:'accessing-description'! |
2798 | 1169 |
|
1170 |
description |
|
1171 |
"Return a (HTML) describing the problem." |
|
1172 |
||
1173 |
^ |
|
3147 | 1174 |
'A class %1 uses pool %2 but it does not exist. |
2798 | 1175 |
|
3154 | 1176 |
The pool should be removed from the class definition; |
3147 | 1177 |
otherwise the package won''t compile due to a missing class.' |
2911 | 1178 |
bindWith: (self linkToClass: className) |
3154 | 1179 |
with: (self linkToClass: poolName) |
2798 | 1180 |
|
1181 |
"Modified: / 23-02-2012 / 13:48:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1182 |
! |
|
1183 |
||
1184 |
label |
|
1185 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1186 |
||
3160 | 1187 |
^'Used pool %1 is not a SharedPool' bindWith: className allBold |
2798 | 1188 |
|
1189 |
"Modified: / 23-02-2012 / 13:40:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2911 | 1190 |
! ! |
1191 |
||
3160 | 1192 |
!ProjectProblem::ClassUsesPoolInNamespaceButNamespaceIsNotDefined methodsFor:'accessing-description'! |
2911 | 1193 |
|
1194 |
description |
|
1195 |
"Return a (HTML) describing the problem." |
|
1196 |
||
1197 |
^ |
|
3147 | 1198 |
'A class %1 uses pool %2 from same namespace as the class, |
1199 |
but the namespace is not explicitly named in the shared pools definition. |
|
2911 | 1200 |
|
1201 |
Due to a bug in stc, such code will fail to compile. A pool definition |
|
3147 | 1202 |
must contain a fully qualified class name including namespace.' |
2911 | 1203 |
bindWith: (self linkToClass: className) |
3154 | 1204 |
with: (self linkToClass: poolName) |
2911 | 1205 |
|
1206 |
"Modified: / 13-09-2012 / 16:32:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2798 | 1207 |
! |
1208 |
||
2911 | 1209 |
label |
1210 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1211 |
||
3160 | 1212 |
^ 'Missing namespace prefix in shared pools definition of %1' bindWith: className allBold |
2911 | 1213 |
|
1214 |
"Modified: / 13-09-2012 / 16:28:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1215 |
! ! |
|
1216 |
||
3160 | 1217 |
!ProjectProblem::ClassUsesPoolButItDoesNotExist methodsFor:'accessing-description'! |
2911 | 1218 |
|
1219 |
description |
|
1220 |
"Return a (HTML) describing the problem." |
|
1221 |
||
1222 |
^ |
|
3147 | 1223 |
'A class %1 uses pool %2 but it does not exist. |
2911 | 1224 |
|
3154 | 1225 |
The pool should be removed from the class definition; |
3147 | 1226 |
otherwise the package won''t compile due to a missing class.' |
2911 | 1227 |
bindWith: (self linkToClass: className) with: poolName |
1228 |
||
1229 |
"Modified: / 13-09-2012 / 16:24:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2798 | 1230 |
! |
1231 |
||
2911 | 1232 |
label |
1233 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1234 |
||
3160 | 1235 |
^'Missing pool: ' , className allBold |
2911 | 1236 |
|
1237 |
"Modified: / 23-02-2012 / 13:34:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2798 | 1238 |
! ! |
1239 |
||
1240 |
!ProjectProblem::MethodProblem methodsFor:'accessing'! |
|
1241 |
||
1242 |
className:something selector: sel |
|
1243 |
className := something. |
|
1244 |
selector := sel |
|
1245 |
||
1246 |
"Created: / 23-02-2012 / 14:17:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1247 |
! |
|
1248 |
||
2854 | 1249 |
method |
1250 |
| class | |
|
1251 |
||
1252 |
class := self klass. |
|
3166 | 1253 |
class isNil ifTrue:[ ^ nil ]. |
2854 | 1254 |
^class compiledMethodAt: selector |
1255 |
||
1256 |
"Created: / 26-07-2012 / 10:09:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1257 |
! |
|
1258 |
||
1259 |
method: method |
|
1260 |
||
1261 |
self className: method mclass name selector: method selector |
|
1262 |
||
1263 |
"Created: / 11-04-2012 / 12:32:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1264 |
! |
|
1265 |
||
2798 | 1266 |
selector |
1267 |
^ selector |
|
1268 |
! |
|
1269 |
||
1270 |
selector:something |
|
1271 |
selector := something. |
|
1272 |
! ! |
|
1273 |
||
3204 | 1274 |
!ProjectProblem::MethodProblem methodsFor:'fixes'! |
1275 |
||
1276 |
doRemoveMethodFromExtensionsList |
|
1277 |
"update the extension method info in the project definition. |
|
1278 |
Return false if fix fails, true otherwise" |
|
1279 |
||
1280 |
| def mthd | |
|
1281 |
||
1282 |
def := self packageDefinitionClass. |
|
1283 |
def isNil ifTrue:[ ^ false ]. |
|
1284 |
mthd := self method. |
|
1285 |
mthd isNil ifTrue:[ ^ false ]. |
|
1286 |
||
1287 |
def excludeMethods:(Array with:mthd) usingCompiler:nil. |
|
1288 |
UserNotification notify: ('ProjectDefinition updated. Do not forget to check it in!!'). |
|
1289 |
^true |
|
1290 |
! |
|
1291 |
||
1292 |
doRemoveNamedMethodFromExtensionsList |
|
1293 |
"update the extension method info in the project definition. |
|
1294 |
Return false if fix fails, true otherwise" |
|
1295 |
||
1296 |
| def | |
|
1297 |
||
1298 |
def := self packageDefinitionClass. |
|
1299 |
def isNil ifTrue:[ ^ false ]. |
|
1300 |
||
1301 |
def excludeMethodFor:selector inClassNamed:className usingCompiler:nil. |
|
1302 |
UserNotification notify: ('ProjectDefinition updated. Do not forget to check it in!!'). |
|
1303 |
^true |
|
1304 |
! ! |
|
1305 |
||
2798 | 1306 |
!ProjectProblem::MethodProblem methodsFor:'utilities-HTML'! |
1307 |
||
1308 |
linkToMethod |
|
1309 |
||
1310 |
^self linkToClass: className selector: selector |
|
1311 |
||
1312 |
"Created: / 23-02-2012 / 14:21:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1313 |
! ! |
|
1314 |
||
3166 | 1315 |
!ProjectProblem::ExtensionMethodListedButInDifferentPackage methodsFor:'accessing-description'! |
1316 |
||
1317 |
description |
|
1318 |
"Return a (HTML) describing the problem." |
|
1319 |
||
3168 | 1320 |
|mthd text| |
3166 | 1321 |
|
3168 | 1322 |
(mthd := self method) isNil ifTrue:[ ^ 'Method removed.' ]. |
3169 | 1323 |
|
3168 | 1324 |
mthd package = mthd mclass package ifTrue:[ |
1325 |
text := |
|
3650 | 1326 |
'Method %1 is listed as an extension in "%3", but is actually associated to its class''s package "%4" (ie. not as extension). |
1327 |
<P>Maybe the method used to be an extension but is now a proper part of the class. |
|
1328 |
If this is the case, you should remove the method name from the extensions list (%3). |
|
1329 |
<P>Otherwise, the method may have lost its package information due to a recompilation in |
|
1330 |
a tool which did not known about the original package association. |
|
1331 |
Then, you should reassociate the method to the extending package.' |
|
3168 | 1332 |
] ifFalse:[ |
1333 |
text := |
|
3650 | 1334 |
'Method %1 is listed as an extension in "%3" but is actually assicualted to a different package: "%4". |
1335 |
<P>The package will compile but may fail to (auto)load from sources. |
|
1336 |
<P>It is recommended to either remove the method name from the extensions list (%3) |
|
3166 | 1337 |
or move the method it to the correct package.' |
3168 | 1338 |
]. |
1339 |
^ text |
|
1340 |
bindWith: (self linkToClass: (Smalltalk classNamed: className) selector: selector) "className" |
|
1341 |
with: selector |
|
1342 |
with: (self linkToClass: self packageDefinitionClass class selector: #extensionMethodNames) |
|
1343 |
with: mthd package |
|
3166 | 1344 |
|
1345 |
"Modified: / 23-02-2012 / 15:18:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1346 |
! |
|
1347 |
||
1348 |
label |
|
1349 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1350 |
||
3168 | 1351 |
|mthd text| |
1352 |
||
1353 |
text := 'Extension method %1 >> %2 listed but in different package'. |
|
1354 |
||
1355 |
(mthd := self method) notNil ifTrue:[ |
|
1356 |
mthd package = mthd mclass package ifTrue:[ |
|
1357 |
text := 'Extension method %1 >> %2 listed but in classes package' |
|
1358 |
] |
|
1359 |
]. |
|
1360 |
^ text |
|
3166 | 1361 |
bindWith: className allBold |
1362 |
with: selector allBold |
|
1363 |
||
1364 |
"Modified: / 23-02-2012 / 14:22:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1365 |
! ! |
|
1366 |
||
1367 |
!ProjectProblem::ExtensionMethodListedButInDifferentPackage methodsFor:'fixes'! |
|
1368 |
||
3169 | 1369 |
alreadyFixed |
1370 |
|mthd| |
|
1371 |
||
1372 |
(self packageDefinitionClass extensionMethods includes:self method) ifFalse:[^ true]. |
|
1373 |
^ ((mthd := self method) notNil |
|
1374 |
and:[ mthd package = package ]) |
|
1375 |
! |
|
1376 |
||
3166 | 1377 |
doMoveMethodToProject |
1378 |
self method package:package |
|
3549 | 1379 |
! ! |
1380 |
||
1381 |
!ProjectProblem::ExtensionMethodListedButInDifferentPackage methodsFor:'fixing'! |
|
3166 | 1382 |
|
1383 |
fixes |
|
3168 | 1384 |
|mthd| |
1385 |
||
1386 |
(mthd := self method) isNil ifTrue:[ ^ #() ]. |
|
3166 | 1387 |
|
3169 | 1388 |
"/ mthd package = mthd mclass package ifTrue:[ |
1389 |
"/ ^Array |
|
1390 |
"/ with: (Array with: 'Remove from the extensionMethodNames list' with: [ self doRemoveMethodFromExtensionsList ]) |
|
1391 |
"/ ]. |
|
1392 |
"/ |
|
3166 | 1393 |
^Array |
3169 | 1394 |
with: (Array with: 'Remove from the extensionMethodNames list' with: [ self doRemoveMethodFromExtensionsList ]) |
3166 | 1395 |
with: (Array with: 'Move method into package' with: [ self doMoveMethodToProject ]) |
1396 |
||
1397 |
"Created: / 26-07-2012 / 10:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1398 |
! ! |
|
1399 |
||
3160 | 1400 |
!ProjectProblem::ExtensionMethodNotListed methodsFor:'accessing-description'! |
2798 | 1401 |
|
1402 |
description |
|
1403 |
"Return a (HTML) describing the problem." |
|
1404 |
||
3154 | 1405 |
^'Method %1 is not listed in %2. |
3143 | 1406 |
<br>It should either be listed in the project definition, or moved to the owning classes package' |
2798 | 1407 |
bindWith: (self linkToMethod) |
3169 | 1408 |
with: (self linkToClass: self packageDefinitionClass class selector: #extensionMethodNames) |
2798 | 1409 |
|
1410 |
"Modified: / 23-02-2012 / 14:34:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1411 |
! |
|
1412 |
||
1413 |
label |
|
1414 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1415 |
||
3160 | 1416 |
^'Extension method %1 >> %2 not listed in project definition "%3"' bindWith: className allBold with: selector allBold with:self packageDefinitionClass |
2798 | 1417 |
|
1418 |
"Modified: / 23-02-2012 / 14:22:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1419 |
! ! |
|
1420 |
||
3143 | 1421 |
!ProjectProblem::ExtensionMethodNotListed methodsFor:'fixing'! |
1422 |
||
3169 | 1423 |
alreadyFixed |
1424 |
^ (self packageDefinitionClass extensionMethods includes:self method) |
|
1425 |
! |
|
1426 |
||
3143 | 1427 |
doMoveToClassesPackage |
3154 | 1428 |
"move the extension method to the owning classes package. |
3143 | 1429 |
Return false if fix fails, true otherwise" |
1430 |
||
1431 |
| cls mthd | |
|
1432 |
||
1433 |
cls := self klass. |
|
1434 |
cls isNil ifTrue:[ ^ false ]. |
|
1435 |
mthd := cls compiledMethodAt:selector. |
|
1436 |
mthd package:(cls package). |
|
1437 |
UserNotification notify: ('Do not forget to check in the method''s package (or class) ("%1")!!' bindWith:cls package). |
|
1438 |
^true |
|
1439 |
! |
|
1440 |
||
1441 |
doUpdateExtensionMethodsInProject |
|
3154 | 1442 |
"update the extension method info in the project definition. |
3143 | 1443 |
Return false if fix fails, true otherwise" |
1444 |
||
3169 | 1445 |
| def mthd | |
3143 | 1446 |
|
1447 |
def := self packageDefinitionClass. |
|
1448 |
def isNil ifTrue:[ ^ false ]. |
|
3169 | 1449 |
mthd := self method. |
1450 |
mthd isNil ifTrue:[ ^ false ]. |
|
1451 |
||
1452 |
def includeMethods:(Array with:mthd) usingCompiler:nil. |
|
3143 | 1453 |
UserNotification notify: ('ProjectDefinition updated. Do not forget to check it in!!'). |
1454 |
^true |
|
1455 |
! |
|
1456 |
||
1457 |
fixes |
|
1458 |
^Array |
|
3200 | 1459 |
with: (Array with: 'Add method to project' with: [ self doUpdateExtensionMethodsInProject ]) |
3169 | 1460 |
with: (Array with: 'Move to classes package' with: [ self doMoveToClassesPackage ]) |
3198 | 1461 |
with: (Array with: 'Full update of the project definitions (rescan)' with: [ self doUpdateAllProjectDefinitions ]) |
3143 | 1462 |
! ! |
1463 |
||
3166 | 1464 |
!ProjectProblem::ExtensionMethodsClassDoesNotExist methodsFor:'accessing-description'! |
1465 |
||
1466 |
description |
|
1467 |
"Return a (HTML) describing the problem." |
|
1468 |
||
1469 |
^'Method %1 >> %2 listed in %3 but class does not exist. |
|
1470 |
The package will compile but may fail to (auto)load from sources. |
|
1471 |
||
1472 |
It is recommended to remove the method from the list (%3).' |
|
1473 |
bindWith: className |
|
1474 |
with: selector |
|
1475 |
with: (self linkToClass: self packageDefinitionClass class selector: #extensionMethodNames) |
|
1476 |
! |
|
1477 |
||
1478 |
label |
|
1479 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1480 |
||
1481 |
^'Extension method %1 >> %2 listed but class not existing' |
|
1482 |
bindWith: className allBold |
|
1483 |
with: selector allBold |
|
1484 |
||
1485 |
"Modified: / 23-02-2012 / 14:22:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1486 |
! ! |
|
1487 |
||
3549 | 1488 |
!ProjectProblem::ExtensionMethodsClassDoesNotExist methodsFor:'fixing'! |
3204 | 1489 |
|
1490 |
fixes |
|
1491 |
^Array |
|
1492 |
with: (Array with: 'Remove from the extensionMethodNames list' with: [ self doRemoveNamedMethodFromExtensionsList ]) |
|
1493 |
||
1494 |
"Created: / 26-07-2012 / 10:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1495 |
! ! |
|
1496 |
||
3449 | 1497 |
!ProjectProblem::ClassIsCompiledButSuperclassProjectDefinitionIsMissing methodsFor:'accessing'! |
3160 | 1498 |
|
1499 |
description |
|
1500 |
"Return a (HTML) describing the problem." |
|
1501 |
||
1502 |
^ |
|
3449 | 1503 |
'Class %1 is compiled (i.e., not autoloaded) but its superclass''s package |
1504 |
definition is missing. Such class won''t compile because superclass''s package |
|
1505 |
will be likely missing.' |
|
1506 |
bindWith: (self linkToClass: className) |
|
1507 |
with: (self linkToClass: (Smalltalk at: className) superclass name) |
|
3160 | 1508 |
|
3449 | 1509 |
"Modified: / 05-10-2013 / 12:43:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3160 | 1510 |
! |
1511 |
||
1512 |
label |
|
1513 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1514 |
||
3449 | 1515 |
^ 'Class ', className , ' is compiled but its superclass''s package definition is missing' |
3160 | 1516 |
|
3449 | 1517 |
"Modified: / 05-10-2013 / 12:41:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3160 | 1518 |
! ! |
1519 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1520 |
!ProjectProblem::MethodCompilabilityIssue1 methodsFor:'accessing'! |
2854 | 1521 |
|
3160 | 1522 |
severity |
1523 |
^ errors notNil ifTrue:[#error] ifFalse:[#warning] |
|
1524 |
||
1525 |
"Modified: / 11-04-2012 / 15:40:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1526 |
! ! |
|
1527 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1528 |
!ProjectProblem::MethodCompilabilityIssue1 methodsFor:'accessing-description'! |
3160 | 1529 |
|
2854 | 1530 |
description |
1531 |
"Return a (HTML) describing the problem." |
|
1532 |
||
1533 |
| issuePrinter | |
|
1534 |
||
3488 | 1535 |
issuePrinter := |
1536 |
[:stream :issue| |
|
1537 |
stream nextPutAll:'<li>'. |
|
1538 |
issue descriptionOn: stream. |
|
1539 |
stream nextPutAll:'</li>'. |
|
1540 |
stream cr. |
|
1541 |
]. |
|
2854 | 1542 |
|
1543 |
^ String streamContents:[:s| |
|
3488 | 1544 |
s |
1545 |
nextPutAll: 'The following problems have been found in '; |
|
1546 |
nextPutAll: self linkToMethod; |
|
1547 |
nextPutAll: ':'; cr; |
|
1548 |
nextPutAll: '<ul>'. |
|
1549 |
errors ? #() do:[:issue|issuePrinter value: s value: issue]. |
|
1550 |
warnings ? #() do:[:issue|issuePrinter value: s value: issue]. |
|
1551 |
s |
|
1552 |
nextPutAll: '</ul>'. |
|
2854 | 1553 |
|
3488 | 1554 |
errors notNil ifTrue:[ |
1555 |
s nextPutAll: |
|
3147 | 1556 |
'STC won''t compile such code, therefore you must fix it before committing' |
3488 | 1557 |
]. |
2854 | 1558 |
] |
1559 |
||
1560 |
"Modified: / 11-04-2012 / 15:51:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1561 |
! |
|
1562 |
||
1563 |
label |
|
1564 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1565 |
||
3160 | 1566 |
^ (errors notNil |
1567 |
ifTrue:[ 'Uncompilable method %1 >> %2' ] |
|
1568 |
ifFalse:[ 'Warnings for method %1 >> %2' ]) bindWith: className allBold with: selector allBold |
|
1569 |
||
2854 | 1570 |
|
1571 |
"Modified: / 11-04-2012 / 16:04:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1572 |
! ! |
|
1573 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1574 |
!ProjectProblem::MethodCompilabilityIssue1 methodsFor:'error handling'! |
2854 | 1575 |
|
3162 | 1576 |
addError:aMessage from: position to: endPos |
1577 |
errors isNil ifTrue:[ errors := OrderedCollection new]. |
|
1578 |
errors add: (Error message: aMessage from: position to: endPos) |
|
1579 |
! |
|
1580 |
||
1581 |
addWarning:aMessage from: position to: endPos |
|
1582 |
warnings isNil ifTrue:[ warnings := OrderedCollection new]. |
|
1583 |
warnings add: (Warning message: aMessage from: position to: endPos) |
|
1584 |
! |
|
1585 |
||
2854 | 1586 |
correctableError:aMessage position:position to:endPos from:aCompiler |
1587 |
"error notification during fileIn. |
|
1588 |
This is sent by the compiler/evaluator if it detects errors." |
|
1589 |
||
1590 |
self error:aMessage position:position to:endPos from:aCompiler. |
|
1591 |
^ false. "/ no correction |
|
1592 |
||
1593 |
"Created: / 30-07-1999 / 18:11:15 / cg" |
|
1594 |
"Modified: / 02-11-2010 / 12:58:54 / cg" |
|
1595 |
! |
|
1596 |
||
1597 |
correctableSelectorWarning:aMessage position:position to:endPos from:aCompiler |
|
1598 |
"warning notification during fileIn. |
|
1599 |
This is sent by the compiler/evaluator if it detects errors." |
|
1600 |
||
1601 |
self warning:aMessage position:position to:endPos from:aCompiler. |
|
1602 |
^ false. "/ no correction |
|
1603 |
||
1604 |
"Modified: / 02-11-2010 / 12:59:04 / cg" |
|
1605 |
! |
|
1606 |
||
1607 |
correctableWarning:aMessage position:position to:endPos from:aCompiler |
|
1608 |
"error notification during fileIn. |
|
1609 |
This is sent by the compiler/evaluator if it detects errors." |
|
1610 |
||
1611 |
self warning:aMessage position:position to:endPos from:aCompiler. |
|
1612 |
^ false |
|
1613 |
||
1614 |
"Created: / 02-11-2010 / 13:29:40 / cg" |
|
1615 |
! |
|
1616 |
||
1617 |
error:aMessage position:position to:endPos from:aCompiler |
|
1618 |
"error notification during fileIn. |
|
1619 |
This is sent by the compiler/evaluator if it detects errors." |
|
1620 |
||
2911 | 1621 |
"Argh!!!!!!!! If its an ignorable error, why signal error!!!!!! Bad design, |
1622 |
even worse workaround. Sigh." |
|
3162 | 1623 |
(thisContext findNextContextWithSelector:#ignorableParseError: or:nil or:nil) notNil |
1624 |
"/ thisContext sender sender sender sender selector == #ignorableParseError: |
|
1625 |
ifTrue:[ ^ self ]. |
|
2911 | 1626 |
|
3162 | 1627 |
self addError:aMessage from: position to: endPos |
2854 | 1628 |
|
1629 |
"Created: / 30-07-1999 / 18:10:30 / cg" |
|
2911 | 1630 |
"Modified: / 10-09-2012 / 11:32:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2854 | 1631 |
! |
1632 |
||
1633 |
unusedVariableWarning:aMessage position:position to:endPos from:aCompiler |
|
1634 |
"warning notification during fileIn. |
|
1635 |
This is sent by the compiler/evaluator if it detects errors." |
|
1636 |
||
1637 |
^ self warning:aMessage position:position to:endPos from:aCompiler |
|
1638 |
! |
|
1639 |
||
1640 |
warning:aMessage position:position to:endPos from:aCompiler |
|
1641 |
"warning notification during fileIn - ignore it. |
|
1642 |
This is sent by the compiler/evaluator if it detects errors." |
|
1643 |
||
2911 | 1644 |
"/ No, do not show warnings now, too many false positives |
2854 | 1645 |
"/ warnings isNil ifTrue:[ warnings := OrderedCollection new]. |
1646 |
"/ warnings add: (Warning message: aMessage from: position to: endPos). |
|
1647 |
||
1648 |
"Created: / 30-07-1999 / 18:11:05 / cg" |
|
1649 |
"Modified (comment): / 12-04-2012 / 18:19:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1650 |
! ! |
|
1651 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1652 |
!ProjectProblem::MethodCompilabilityIssue1 methodsFor:'queries'! |
2854 | 1653 |
|
1654 |
hasIssue |
|
1655 |
^ (errors ? warnings) notNil |
|
1656 |
||
1657 |
"Created: / 11-04-2012 / 15:43:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1658 |
! ! |
|
1659 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1660 |
!ProjectProblem::MethodCompilabilityIssue1::Error class methodsFor:'instance creation'! |
2854 | 1661 |
|
1662 |
message: message from: startPosition to: endPosition |
|
1663 |
||
1664 |
^self new |
|
2911 | 1665 |
message: message; |
1666 |
startPosition: startPosition; |
|
1667 |
endPosition: endPosition; |
|
1668 |
yourself. |
|
2854 | 1669 |
|
1670 |
"Created: / 11-04-2012 / 15:38:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1671 |
! ! |
|
1672 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1673 |
!ProjectProblem::MethodCompilabilityIssue1::Error methodsFor:'accessing'! |
2854 | 1674 |
|
1675 |
endPosition |
|
1676 |
^ endPosition |
|
1677 |
! |
|
1678 |
||
1679 |
endPosition:something |
|
1680 |
endPosition := something. |
|
1681 |
! |
|
1682 |
||
1683 |
message |
|
1684 |
^ message |
|
1685 |
! |
|
1686 |
||
1687 |
message:something |
|
1688 |
message := something. |
|
1689 |
! |
|
1690 |
||
1691 |
startPosition |
|
1692 |
^ startPosition |
|
1693 |
! |
|
1694 |
||
1695 |
startPosition:something |
|
1696 |
startPosition := something. |
|
1697 |
! ! |
|
1698 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1699 |
!ProjectProblem::MethodCompilabilityIssue1::Error methodsFor:'accessing-description'! |
3160 | 1700 |
|
1701 |
descriptionOn: stream |
|
1702 |
||
1703 |
stream nextPutAll: message; space; nextPutAll:'(error)' |
|
1704 |
||
1705 |
"Created: / 11-04-2012 / 15:52:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1706 |
! ! |
|
1707 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1708 |
!ProjectProblem::MethodCompilabilityIssue1::Warning class methodsFor:'instance creation'! |
2854 | 1709 |
|
1710 |
message: message from: startPosition to: endPosition |
|
1711 |
||
1712 |
^self new |
|
2911 | 1713 |
message: message; |
1714 |
startPosition: startPosition; |
|
1715 |
endPosition: endPosition; |
|
1716 |
yourself. |
|
2854 | 1717 |
|
1718 |
"Created: / 11-04-2012 / 15:38:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1719 |
! ! |
|
1720 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1721 |
!ProjectProblem::MethodCompilabilityIssue1::Warning methodsFor:'accessing'! |
2854 | 1722 |
|
1723 |
endPosition |
|
1724 |
^ endPosition |
|
1725 |
! |
|
1726 |
||
1727 |
endPosition:something |
|
1728 |
endPosition := something. |
|
1729 |
! |
|
1730 |
||
1731 |
message |
|
1732 |
^ message |
|
1733 |
! |
|
1734 |
||
1735 |
message:something |
|
1736 |
message := something. |
|
1737 |
! |
|
1738 |
||
1739 |
startPosition |
|
1740 |
^ startPosition |
|
1741 |
! |
|
1742 |
||
1743 |
startPosition:something |
|
1744 |
startPosition := something. |
|
1745 |
! ! |
|
1746 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1747 |
!ProjectProblem::MethodCompilabilityIssue1::Warning methodsFor:'accessing-description'! |
2798 | 1748 |
|
3160 | 1749 |
descriptionOn: stream |
2798 | 1750 |
|
3160 | 1751 |
stream nextPutAll: message; space"/; nextPutAll:'(warning)' |
2798 | 1752 |
|
3160 | 1753 |
"Created: / 11-04-2012 / 15:52:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1754 |
! ! |
|
1755 |
||
3562
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1756 |
!ProjectProblem::MethodCompilabilityIssue2 methodsFor:'accessing'! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1757 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1758 |
severity |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1759 |
| severities | |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1760 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1761 |
severities := rules collect:[ :rule | rule severity ]. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1762 |
(severities includes: #error) ifTrue:[ ^ #error ]. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1763 |
^ #warning |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1764 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1765 |
"Modified: / 29-05-2014 / 15:41:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1766 |
! ! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1767 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1768 |
!ProjectProblem::MethodCompilabilityIssue2 methodsFor:'accessing-description'! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1769 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1770 |
description |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1771 |
"Return a (HTML) describing the problem." |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1772 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1773 |
| issuePrinter | |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1774 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1775 |
issuePrinter := |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1776 |
[:stream :rule| |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1777 |
stream nextPutAll:'<li>'. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1778 |
stream nextPutAll: rule name. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1779 |
stream nextPutAll: '<br></br>'. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1780 |
stream nextPutAll:'<p>'. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1781 |
stream nextPutAll: rule rationale. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1782 |
stream nextPutAll:'</p>'. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1783 |
stream nextPutAll:'</li>'. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1784 |
stream cr. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1785 |
]. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1786 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1787 |
^ String streamContents:[:s| |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1788 |
s |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1789 |
nextPutAll: 'The following problems have been found in '; |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1790 |
nextPutAll: self linkToMethod; |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1791 |
nextPutAll: ':'; cr; |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1792 |
nextPutAll: '<ul>'. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1793 |
rules ? #() do:[:rule|issuePrinter value: s value: rule]. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1794 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1795 |
s |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1796 |
nextPutAll: '</ul>'. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1797 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1798 |
errors notNil ifTrue:[ |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1799 |
s nextPutAll: |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1800 |
'STC won''t compile such code, therefore you must fix it before committing' |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1801 |
]. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1802 |
] |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1803 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1804 |
"Modified: / 29-05-2014 / 16:26:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1805 |
! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1806 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1807 |
label |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1808 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1809 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1810 |
^ ((self severity == #error) |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1811 |
ifTrue:[ 'Uncompilable method %1 >> %2' ] |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1812 |
ifFalse:[ 'Warnings for method %1 >> %2' ]) bindWith: className allBold with: selector allBold |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1813 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1814 |
"Modified: / 29-05-2014 / 15:39:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1815 |
! ! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1816 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1817 |
!ProjectProblem::MethodCompilabilityIssue2 methodsFor:'adding & removing'! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1818 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1819 |
addViolation: anRBLintRule |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1820 |
rules isNil ifTrue:[ rules := OrderedCollection new ]. |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1821 |
rules add: anRBLintRule |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1822 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1823 |
"Created: / 29-05-2014 / 15:42:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1824 |
! ! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1825 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1826 |
!ProjectProblem::MethodCompilabilityIssue2 methodsFor:'queries'! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1827 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1828 |
hasIssue |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1829 |
^ rules notEmptyOrNil |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1830 |
|
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1831 |
"Created: / 11-04-2012 / 15:43:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1832 |
"Modified: / 29-05-2014 / 15:41:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1833 |
! ! |
a16bc9e17d35
Added lint-based check for stc bugs to ProjectChecker (#checkMethodSTCCompilability2:)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3550
diff
changeset
|
1834 |
|
3160 | 1835 |
!ProjectProblem::MethodInNoPackage methodsFor:'accessing-description'! |
1836 |
||
3217 | 1837 |
alreadyFixed |
3449 | 1838 |
| m | |
1839 |
||
1840 |
"/ One may "fix" the problem by actually removing the method. |
|
3549 | 1841 |
"/ In this case, consider problem as "fixed". |
3449 | 1842 |
m := self method. |
1843 |
^ m isNil or:[self method package ~= PackageId noProjectID] |
|
1844 |
||
1845 |
"Modified (format): / 19-12-2013 / 15:38:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3217 | 1846 |
! |
1847 |
||
3160 | 1848 |
description |
1849 |
"Return a (HTML) describing the problem." |
|
1850 |
||
1851 |
^ |
|
1852 |
'Method %1 does not belong to any package. Such methods |
|
1853 |
are not committed and will be lost when you restart/recompile. |
|
3342 | 1854 |
Especially, it will not be included when you generate a compiled class library. |
1855 |
However, it will be kept in the changes file, so it is not completely lost. |
|
1856 |
The method should be moved to some package, %2 maybe?' |
|
3160 | 1857 |
bindWith: (self linkToMethod) |
3342 | 1858 |
with: package |
3160 | 1859 |
|
1860 |
"Modified: / 23-02-2012 / 14:21:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2854 | 1861 |
! |
1862 |
||
2798 | 1863 |
label |
1864 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1865 |
||
3160 | 1866 |
^'Unpackaged method %1 >> %2' bindWith: className allBold with: selector allBold |
2798 | 1867 |
|
1868 |
"Modified: / 23-02-2012 / 14:19:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1869 |
! ! |
|
1870 |
||
3549 | 1871 |
!ProjectProblem::MethodInNoPackage methodsFor:'fixing'! |
1872 |
||
1873 |
doMoveAllListedMethodsToPackage |
|
1874 |
"move all listed methods to the package. |
|
1875 |
Return false if fix fails, true otherwise" |
|
1876 |
||
1877 |
| m any | |
|
1878 |
||
1879 |
any := false. |
|
1880 |
self allUnfixedProblemsOfMyKindDo:[:p | |
|
1881 |
m := p method. |
|
1882 |
m notNil ifTrue:[ |
|
1883 |
m package: package. |
|
1884 |
any := true. |
|
1885 |
] |
|
1886 |
]. |
|
1887 |
^ any |
|
1888 |
! |
|
1889 |
||
1890 |
doMoveMethodToPackage |
|
1891 |
"move the method to the package. |
|
1892 |
Return false if fix fails, true otherwise" |
|
1893 |
||
1894 |
| m | |
|
1895 |
||
1896 |
m := self method. |
|
1897 |
m notNil ifTrue:[ |
|
1898 |
m package: package. |
|
1899 |
^ true |
|
1900 |
] ifFalse:[ |
|
1901 |
^ false |
|
1902 |
] |
|
1903 |
! |
|
1904 |
||
1905 |
fixes |
|
1906 |
|moveThisToPackage moveAllToTheirPackage| |
|
1907 |
||
1908 |
moveThisToPackage := |
|
1909 |
{ |
|
1910 |
('Move method to package ', package) . |
|
1911 |
[ self doMoveMethodToPackage ] |
|
1912 |
}. |
|
1913 |
||
1914 |
self countOtherProblemsOfThisKind > 0 ifTrue:[ |
|
1915 |
moveAllToTheirPackage := |
|
1916 |
{ |
|
1917 |
('Move all listed unpackaged methods to package ', package) . |
|
1918 |
[ self doMoveAllListedMethodsToPackage ] |
|
1919 |
}. |
|
1920 |
||
1921 |
^ { |
|
1922 |
moveThisToPackage . |
|
1923 |
moveAllToTheirPackage |
|
1924 |
} |
|
1925 |
]. |
|
1926 |
||
1927 |
^ { |
|
1928 |
moveThisToPackage |
|
1929 |
} |
|
1930 |
||
1931 |
"Created: / 26-07-2012 / 09:53:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1932 |
! ! |
|
1933 |
||
3160 | 1934 |
!ProjectProblem::ExtensionMethodListedButDoesNotExist methodsFor:'accessing-description'! |
2798 | 1935 |
|
1936 |
description |
|
1937 |
"Return a (HTML) describing the problem." |
|
1938 |
||
3166 | 1939 |
^'Method %1 listed in %3 but does not exist. |
1940 |
The package will compile but may fail to (auto)load from sources. |
|
2798 | 1941 |
|
3166 | 1942 |
It is recommended to remove the method from the list (%3).' |
1943 |
bindWith: (self linkToClass: (Smalltalk classNamed: className) selector: selector) "className" |
|
1944 |
with: selector |
|
1945 |
with: (self linkToClass: self packageDefinitionClass class selector: #extensionMethodNames) |
|
2798 | 1946 |
|
1947 |
"Modified: / 23-02-2012 / 15:18:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1948 |
! |
|
1949 |
||
1950 |
label |
|
1951 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
1952 |
||
3160 | 1953 |
^'Extension method %1 >> %2 listed but not existing' bindWith: className allBold with: selector allBold |
2798 | 1954 |
|
1955 |
"Modified: / 23-02-2012 / 14:22:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1956 |
! ! |
|
1957 |
||
3549 | 1958 |
!ProjectProblem::ExtensionMethodListedButDoesNotExist methodsFor:'fixing'! |
3204 | 1959 |
|
1960 |
fixes |
|
1961 |
^Array |
|
1962 |
with: (Array with: 'Remove from the extensionMethodNames list' with: [ self doRemoveNamedMethodFromExtensionsList ]) |
|
1963 |
||
1964 |
"Created: / 26-07-2012 / 10:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1965 |
! ! |
|
1966 |
||
2854 | 1967 |
!ProjectProblem::MethodSourceCorrupted methodsFor:'accessing'! |
1968 |
||
3160 | 1969 |
severity |
1970 |
"Return a severity - one of #error, #warning, #info" |
|
1971 |
||
1972 |
^#error |
|
1973 |
||
1974 |
"Created: / 11-04-2012 / 12:47:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1975 |
! ! |
|
1976 |
||
1977 |
!ProjectProblem::MethodSourceCorrupted methodsFor:'accessing-description'! |
|
1978 |
||
2854 | 1979 |
description |
1980 |
"Return a (HTML) describing the problem." |
|
1981 |
||
1982 |
^ |
|
1983 |
'Source code for %1 is <b>corrupted</b>. This is likely because |
|
1984 |
the binary class version does not match the source file. This may happen, |
|
3488 | 1985 |
for instance, if you compile a class library and then edit the ".st" file, |
1986 |
or you have checked out from the SCM into the file system over the existing source code, |
|
1987 |
from which the class was compiled. |
|
1988 |
<P>Be very careful with checkin or fileOut (do NOT save over any existing file), |
|
1989 |
and check the results for currupt source code, |
|
1990 |
<P>Sometimes, you can fix this by disabling the "Use Local Source" in the SCM manager''s settings |
|
1991 |
dialog. If that does not help, it is recommended to leave ST/X, restore the old source or compile a system |
|
1992 |
based on the current source, restart ST/X, reapply the changes via the Changebrowser and commit then.' |
|
2911 | 1993 |
bindWith: (self linkToMethod) |
3488 | 1994 |
with: package |
2854 | 1995 |
|
1996 |
"Modified: / 11-04-2012 / 12:47:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1997 |
! |
|
1998 |
||
1999 |
label |
|
2000 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
2001 |
||
3160 | 2002 |
^ 'Corrupted source code for %1 >> %2' bindWith: className allBold with: selector allBold |
2854 | 2003 |
|
2004 |
"Modified: / 11-04-2012 / 12:42:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3160 | 2005 |
! ! |
2006 |
||
2007 |
!ProjectProblem::MethodSourceNotAvailable methodsFor:'accessing'! |
|
2854 | 2008 |
|
2009 |
severity |
|
2010 |
"Return a severity - one of #error, #warning, #info" |
|
2011 |
||
2012 |
^#error |
|
2013 |
||
3160 | 2014 |
"Created: / 11-04-2012 / 12:47:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2854 | 2015 |
! ! |
2016 |
||
3160 | 2017 |
!ProjectProblem::MethodSourceNotAvailable methodsFor:'accessing-description'! |
2854 | 2018 |
|
2019 |
description |
|
2020 |
"Return a (HTML) describing the problem." |
|
2021 |
||
2022 |
^ |
|
3147 | 2023 |
'Source code for %1 is not available. Check your package path |
2854 | 2024 |
and/or source code management settings. |
2025 |
' |
|
2911 | 2026 |
bindWith: (self linkToMethod) |
3154 | 2027 |
with: package |
2854 | 2028 |
|
2029 |
"Modified: / 11-04-2012 / 12:44:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2030 |
! |
|
2031 |
||
2032 |
label |
|
2033 |
"Return the label (possibly instance if a Text) shortly describing the problem" |
|
2034 |
||
3160 | 2035 |
^ 'Unavailable source code for %1 >> %2' bindWith: className allBold with: selector allBold |
2854 | 2036 |
|
2037 |
"Modified: / 11-04-2012 / 12:41:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3160 | 2038 |
! ! |
2039 |
||
2040 |
!ProjectProblem::ProjectDefinitionDoesNotExist methodsFor:'accessing'! |
|
2854 | 2041 |
|
2042 |
severity |
|
2043 |
"Return a severity - one of #error, #warning, #info" |
|
2044 |
||
2045 |
^#error |
|
2046 |
||
3160 | 2047 |
"Created: / 11-04-2012 / 12:48:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2854 | 2048 |
! ! |
2049 |
||
3160 | 2050 |
!ProjectProblem::ProjectDefinitionDoesNotExist methodsFor:'accessing-description'! |
2798 | 2051 |
|
2052 |
description |
|
2053 |
"Return a (HTML) describing the problem." |
|
2054 |
||
3152 | 2055 |
package = 'stx' ifTrue:[ |
3198 | 2056 |
^ |
3154 | 2057 |
'Move your code to another package. |
3198 | 2058 |
<br>The package name "stx" is reserveed for exept''s ST/X development.' |
3152 | 2059 |
]. |
2060 |
||
2798 | 2061 |
^ |
3152 | 2062 |
'A project definition class for package "%1" does not exist. |
2063 |
<br>Project definition classes keep the meta information of a package, |
|
2064 |
such as contents and build parameters. |
|
3198 | 2065 |
You <b>must</b> create it, otherwise package management won''t work, |
2066 |
and the package cannot be compiled to a binary dll.' |
|
3152 | 2067 |
bindWith: package |
2798 | 2068 |
|
2069 |
"Modified: / 23-02-2012 / 13:29:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2070 |
! |
|
2071 |
||
2072 |
label |
|
3152 | 2073 |
^'Project definition class for "%1" does not exist' bindWith: package |
2798 | 2074 |
|
2075 |
"Modified: / 23-02-2012 / 13:21:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2076 |
! ! |
|
2077 |
||
3152 | 2078 |
!ProjectProblem::ProjectDefinitionDoesNotExist methodsFor:'fixing'! |
2079 |
||
3225 | 2080 |
alreadyFixed |
2081 |
^ (ProjectDefinition definitionClassForPackage:package) notNil |
|
2082 |
! |
|
2083 |
||
3152 | 2084 |
doCreateAs:whatType |
3198 | 2085 |
|prjDef| |
2086 |
||
2087 |
prjDef := ProjectDefinition |
|
2088 |
definitionClassForPackage:package |
|
2089 |
projectType: whatType |
|
2090 |
createIfAbsent:true. |
|
2091 |
||
2092 |
prjDef |
|
2093 |
updateMethodsCodeUsingCompiler:Compiler |
|
2094 |
ignoreOldDefinition:true |
|
3152 | 2095 |
! |
2096 |
||
2097 |
doCreateAsGUIApplication |
|
2098 |
self doCreateAs:ProjectDefinition guiApplicationType |
|
2099 |
! |
|
2100 |
||
2101 |
doCreateAsLibrary |
|
2102 |
self doCreateAs:ProjectDefinition libraryType |
|
2103 |
! |
|
2104 |
||
2105 |
doCreateAsNonGUIApplication |
|
2106 |
self doCreateAs:ProjectDefinition nonGuiApplicationType |
|
2107 |
! |
|
2108 |
||
2109 |
fixes |
|
2110 |
package = 'stx' ifTrue:[ ^ #() ]. |
|
2111 |
||
3154 | 2112 |
^ Array |
2113 |
with: (Array with:'Create as Library' with:[ self doCreateAsLibrary ] ) |
|
2114 |
with: (Array with:'Create as GUI Application' with:[ self doCreateAsGUIApplication ] ) |
|
2115 |
with: (Array with:'Create as non-GUI Application' with:[ self doCreateAsNonGUIApplication ] ) |
|
3152 | 2116 |
! ! |
2117 |
||
2798 | 2118 |
!ProjectProblem class methodsFor:'documentation'! |
2119 |
||
2912 | 2120 |
version |
3776 | 2121 |
^ '$Header: /cvs/stx/stx/libbasic3/ProjectProblem.st,v 1.38 2015-02-10 15:00:19 cg Exp $' |
2912 | 2122 |
! |
2123 |
||
2124 |
version_CVS |
|
3776 | 2125 |
^ '$Header: /cvs/stx/stx/libbasic3/ProjectProblem.st,v 1.38 2015-02-10 15:00:19 cg Exp $' |
2912 | 2126 |
! |
2127 |
||
2854 | 2128 |
version_SVN |
3776 | 2129 |
^ '$Id: ProjectProblem.st,v 1.38 2015-02-10 15:00:19 cg Exp $' |
2798 | 2130 |
! ! |
3160 | 2131 |