check compilability before checking in
authorClaus Gittinger <cg@exept.de>
Tue, 02 Nov 2010 13:39:17 +0100
changeset 9622 03bc7e8658aa
parent 9621 2353a178d5c7
child 9623 0a09bca25eb4
check compilability before checking in
NewSystemBrowser.st
Tools__NewSystemBrowser.st
--- a/NewSystemBrowser.st	Tue Nov 02 13:30:31 2010 +0100
+++ b/NewSystemBrowser.st	Tue Nov 02 13:39:17 2010 +0100
@@ -19405,6 +19405,61 @@
     "Modified: / 22.12.2001 / 03:04:48 / cg"
 !
 
+checkCompilabilityOf:aClass errorsOnly:errorsOnly outputTo:outStream
+    "check compilability of aClass; write warning and errormessages to outStream.
+     (meant for a human to read)"
+
+    |warningCollector|
+
+    warningCollector := TextCollectingCompilationErrorHandler new.
+    warningCollector collectingStream:outStream.
+    warningCollector errorsOnly:errorsOnly.
+
+    aClass withAllPrivateClassesDo:[:eachClass |
+        eachClass instAndClassSelectorsAndMethodsDo:[:aSelector :aMethod | 
+            Parser warningSignal 
+                handle:[:ex | self halt ]
+                do:[
+                    eachClass compilerClass 
+                        compile:aMethod source
+                        forClass:aMethod mclass
+                        inCategory:'others'
+                        notifying:warningCollector
+                        install:false
+                        skipIfSame:false
+                        silent:false
+                ]
+        ].
+    ].
+
+    "Created: / 02-11-2010 / 13:11:17 / cg"
+!
+
+checkCompilabilityOfAll:aCollectionOfClasses errorsOnly:errorsOnly
+    "check compilability of aClass; write warning and errormessages to outStream.
+     (meant for a human to read)"
+
+    |stream|
+
+    stream := WriteStream on:(Text new:100).
+    self checkCompilabilityOfAll:aCollectionOfClasses errorsOnly:errorsOnly outputTo:stream.
+    ^ stream contents.
+
+    "Created: / 02-11-2010 / 13:14:47 / cg"
+!
+
+checkCompilabilityOfAll:aCollectionOfClasses errorsOnly:errorsOnly outputTo:outStream
+    "check compilability of aClass; write warning and errormessages to outStream.
+     (meant for a human to read)"
+
+    self 
+        selectedClassesDo:[:eachClass |
+            self checkCompilabilityOf:eachClass errorsOnly:errorsOnly outputTo:outStream.
+        ].
+
+    "Created: / 02-11-2010 / 13:11:47 / cg"
+!
+
 classClassDefinitionTemplateFor:aClass in:cat asNamespace:isNameSpace private:isPrivate
     "common helper for newClass and newSubclass
      - show a template to define a subclass of aClass in category cat.
@@ -19525,16 +19580,15 @@
 classMenuCheckCompilability
     "check compilability of selected classes (kludge - for me)"
 
-    self selectedClassesDo:[:eachClass |
-        eachClass instAndClassSelectorsAndMethodsDo:[:aSelector :aMethod |
-            eachClass compilerClass
-                compile:aMethod source
-                forClass:aMethod mclass
-                install:false
-        ]
+    |allMessages|
+
+    allMessages := self checkCompilabilityOfAll:(self selectedClasses) errorsOnly:false.
+    allMessages notEmpty ifTrue:[
+        Dialog warn:allMessages
     ].
 
     "Created: / 16-11-2006 / 14:53:21 / cg"
+    "Modified: / 02-11-2010 / 13:15:12 / cg"
 !
 
 classMenuChildrenToSiblings
@@ -23106,7 +23160,15 @@
     "check a bunch of classes into the source repository.
      If logInfoOrNil isNil, ask for one."
 
-    |classesNotInPackage msg answer|
+    |classesNotInPackage msg answer errors|
+
+    errors := self checkCompilabilityOfAll:aCollectionOfClasses errorsOnly:true.
+    errors notEmptyOrNil ifTrue:[
+        (TextBox openOn:errors title:'Attention: about to check in class with errors' readOnly:true) isNil
+        ifTrue:[
+            AbortSignal raise
+        ].
+    ].
 
     self withActivityNotificationsRedirectedToInfoLabelDo:[
         SourceCodeManagerUtilities
@@ -23155,7 +23217,7 @@
         ].
     ].
 
-    "Modified: / 05-10-2007 / 13:20:17 / cg"
+    "Modified: / 02-11-2010 / 13:19:35 / cg"
 !
 
 checkOutClass:aClass askForRevision:askForRevision
@@ -44638,11 +44700,11 @@
 !NewSystemBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Attic/NewSystemBrowser.st,v 1.1484 2010-10-27 09:38:00 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Attic/NewSystemBrowser.st,v 1.1485 2010-11-02 12:39:17 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Attic/NewSystemBrowser.st,v 1.1484 2010-10-27 09:38:00 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Attic/NewSystemBrowser.st,v 1.1485 2010-11-02 12:39:17 cg Exp $'
 ! !
 
 NewSystemBrowser initialize!
--- a/Tools__NewSystemBrowser.st	Tue Nov 02 13:30:31 2010 +0100
+++ b/Tools__NewSystemBrowser.st	Tue Nov 02 13:39:17 2010 +0100
@@ -19405,6 +19405,61 @@
     "Modified: / 22.12.2001 / 03:04:48 / cg"
 !
 
+checkCompilabilityOf:aClass errorsOnly:errorsOnly outputTo:outStream
+    "check compilability of aClass; write warning and errormessages to outStream.
+     (meant for a human to read)"
+
+    |warningCollector|
+
+    warningCollector := TextCollectingCompilationErrorHandler new.
+    warningCollector collectingStream:outStream.
+    warningCollector errorsOnly:errorsOnly.
+
+    aClass withAllPrivateClassesDo:[:eachClass |
+        eachClass instAndClassSelectorsAndMethodsDo:[:aSelector :aMethod | 
+            Parser warningSignal 
+                handle:[:ex | self halt ]
+                do:[
+                    eachClass compilerClass 
+                        compile:aMethod source
+                        forClass:aMethod mclass
+                        inCategory:'others'
+                        notifying:warningCollector
+                        install:false
+                        skipIfSame:false
+                        silent:false
+                ]
+        ].
+    ].
+
+    "Created: / 02-11-2010 / 13:11:17 / cg"
+!
+
+checkCompilabilityOfAll:aCollectionOfClasses errorsOnly:errorsOnly
+    "check compilability of aClass; write warning and errormessages to outStream.
+     (meant for a human to read)"
+
+    |stream|
+
+    stream := WriteStream on:(Text new:100).
+    self checkCompilabilityOfAll:aCollectionOfClasses errorsOnly:errorsOnly outputTo:stream.
+    ^ stream contents.
+
+    "Created: / 02-11-2010 / 13:14:47 / cg"
+!
+
+checkCompilabilityOfAll:aCollectionOfClasses errorsOnly:errorsOnly outputTo:outStream
+    "check compilability of aClass; write warning and errormessages to outStream.
+     (meant for a human to read)"
+
+    self 
+        selectedClassesDo:[:eachClass |
+            self checkCompilabilityOf:eachClass errorsOnly:errorsOnly outputTo:outStream.
+        ].
+
+    "Created: / 02-11-2010 / 13:11:47 / cg"
+!
+
 classClassDefinitionTemplateFor:aClass in:cat asNamespace:isNameSpace private:isPrivate
     "common helper for newClass and newSubclass
      - show a template to define a subclass of aClass in category cat.
@@ -19525,16 +19580,15 @@
 classMenuCheckCompilability
     "check compilability of selected classes (kludge - for me)"
 
-    self selectedClassesDo:[:eachClass |
-        eachClass instAndClassSelectorsAndMethodsDo:[:aSelector :aMethod |
-            eachClass compilerClass
-                compile:aMethod source
-                forClass:aMethod mclass
-                install:false
-        ]
+    |allMessages|
+
+    allMessages := self checkCompilabilityOfAll:(self selectedClasses) errorsOnly:false.
+    allMessages notEmpty ifTrue:[
+        Dialog warn:allMessages
     ].
 
     "Created: / 16-11-2006 / 14:53:21 / cg"
+    "Modified: / 02-11-2010 / 13:15:12 / cg"
 !
 
 classMenuChildrenToSiblings
@@ -23106,7 +23160,15 @@
     "check a bunch of classes into the source repository.
      If logInfoOrNil isNil, ask for one."
 
-    |classesNotInPackage msg answer|
+    |classesNotInPackage msg answer errors|
+
+    errors := self checkCompilabilityOfAll:aCollectionOfClasses errorsOnly:true.
+    errors notEmptyOrNil ifTrue:[
+        (TextBox openOn:errors title:'Attention: about to check in class with errors' readOnly:true) isNil
+        ifTrue:[
+            AbortSignal raise
+        ].
+    ].
 
     self withActivityNotificationsRedirectedToInfoLabelDo:[
         SourceCodeManagerUtilities
@@ -23155,7 +23217,7 @@
         ].
     ].
 
-    "Modified: / 05-10-2007 / 13:20:17 / cg"
+    "Modified: / 02-11-2010 / 13:19:35 / cg"
 !
 
 checkOutClass:aClass askForRevision:askForRevision
@@ -44638,11 +44700,11 @@
 !NewSystemBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__NewSystemBrowser.st,v 1.1484 2010-10-27 09:38:00 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__NewSystemBrowser.st,v 1.1485 2010-11-02 12:39:17 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__NewSystemBrowser.st,v 1.1484 2010-10-27 09:38:00 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__NewSystemBrowser.st,v 1.1485 2010-11-02 12:39:17 cg Exp $'
 ! !
 
 NewSystemBrowser initialize!