ProjectDefinition.st
changeset 12368 162fdd364a8c
parent 12364 f39b6791e557
child 12369 a369c34ec34e
--- a/ProjectDefinition.st	Mon Oct 26 18:31:00 2009 +0100
+++ b/ProjectDefinition.st	Mon Oct 26 18:43:59 2009 +0100
@@ -1596,67 +1596,14 @@
 
 !ProjectDefinition class methodsFor:'description - classes'!
 
-additionalClassAttributesFor: aClass
-    "Answers additional set of class attributes for given class
-     Individual project definitions may override this method, but
-     overriding method should always merge its attributes with result
-     of 'super additionalClassAttributesFor: aClass'.
-
-     Here, we add #autoload attributes to all test cases and
-     test resources, as they are not neccessary for the package
-     and should not be compiled (because of unwanted dependency
-     on stx:goodies/sunit package)
-    "
-
-    (aClass inheritsFrom: TestCase) ifTrue:[^#(autoload)].
-    (aClass inheritsFrom: TestResource) ifTrue:[^#(autoload)].
-
-    "No additional attributes"
-    ^#()
-
-    "
-        stx_libbasic additionalClassAttributesFor: Object 
-        stx_libtool additionalClassAttributesFor: Tools::NavigationHistoryTests
-        stx_goodies_sunit additionalClassAttributesFor: TestCase 
-
-
-        stx_libtool classNamesAndAttributes_code_ignoreOldEntries:true ignoreOldDefinition: true
-
-    "
-
-    "Created: / 26-10-2009 / 12:54:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
 additionalClassNamesAndAttributes
     ^ #()
 
     "Created: / 21-08-2006 / 19:53:04 / cg"
 !
 
-allClassNames          
-    ^ self classNamesForWhich:[:nm :attr | true ].
-!
-
-autoloaded_classNames          
-    ^ self classNamesForWhich:[:nm :attr | attr notEmptyOrNil and:[attr includes:#autoload]].
-
-    "Modified: / 07-08-2006 / 21:25:25 / fm"
-    "Created: / 30-08-2007 / 18:48:09 / cg"
-!
-
-classNames          
-    "answer an array containing all the class names of the project's classes"
-
-    ^ self classNamesAndAttributesAsSpecArray collect:[:entry | entry first].
-
-    "
-     stx_libhtml classNames
-     stx_libhtml classNamesAndAttributesAsSpecArray
-    "
-!
-
 classNamesAndAttributes
-    "a correponding method with real names is generated in my subclasses"
+    "a correponding method with real names must be present in my concrete subclasses"
 
     "/ should this be a subclassResponsibility here ?
     ^ #()
@@ -1666,119 +1613,11 @@
     "Modified: / 17-08-2006 / 20:47:20 / cg"
 !
 
-classNamesAndAttributesAsSpecArray
-    "given a classNamesAndAttributes array, make this a spec array (array of arrays).  
-     This decompresses class-name entries into a one-element array for easier processing"
-
-    ^ self classNamesAndAttributes
-        collect:[:entry |
-            entry isArray ifTrue:[
-                entry first isSymbol ifTrue:[
-                    entry
-                ] ifFalse:[
-                    (Array with:entry first asSymbol) , (entry copyFrom:2)
-                ].
-            ] ifFalse:[
-                Array with:entry asSymbol.
-            ]].
-
-    "Created: / 19-02-2007 / 16:11:53 / cg"
-!
-
-classNamesAndAttributesFromSpecArray:aSpecArray
-    "given a spec array (array of arrays), make this a classNamesAndAttributes array
-     as stored literally in the method.
-     This compresses single element array-elements into plain names
-     (to save code in the compiled binaries)"
-
-    ^ aSpecArray
-        collect:[:entry |
-            (entry isArray and:[entry size == 1]) ifTrue:[
-                entry first
-            ] ifFalse:[
-                entry
-            ]].
-
-    "Created: / 19-02-2007 / 16:12:32 / cg"
-!
-
-classNamesForWhich:aBlock          
-    "a correponding method with real names is generated in my subclasses"
-
-    |coll|
-
-    coll := OrderedCollection new.
-    self classNamesAndAttributesDo:[:nm :attributes |
-        (aBlock value:nm value:attributes) ifTrue:[
-            coll add:nm.
-        ].
-    ].
-    ^ coll
-
-    "Created: / 07-08-2006 / 19:02:57 / fm"
-    "Modified: / 07-08-2006 / 21:25:25 / fm"
-    "Modified: / 17-08-2006 / 20:47:20 / cg"
-!
-
-compiled_classNames          
-    ^ self classNamesForWhich:[:nm :attr | attr isEmptyOrNil or:[(attr includes:#autoload) not]].
-
-    "Created: / 07-08-2006 / 19:02:57 / fm"
-    "Modified: / 07-08-2006 / 21:25:25 / fm"
-    "Modified: / 21-08-2006 / 18:48:31 / cg"
-!
-
-compiled_classNamesForPlatform
-    "answer the classes to be compiled only for the current platformName"
-
-    ^ self compiled_classNamesForPlatform:OperatingSystem platformName
-!
-
-compiled_classNamesForPlatform:platformName
-    "answer the classes to be compiled only for platformName
-     platformName is one of #unix, #win32 (OperatingSystem platformName)"
-
-    ^ self 
-        classNamesForWhich:[:nm :attr | 
-            (attr includes:#autoload) not and:[attr includes:platformName]
-        ].
-
-    "Created: / 07-08-2006 / 19:02:57 / fm"
-    "Modified: / 07-08-2006 / 21:25:25 / fm"
-    "Modified: / 09-10-2006 / 13:30:08 / cg"
-!
-
-compiled_classNames_common
-    "classes to be compiled for any platform"
-
-    ^ self 
-        classNamesForWhich:[:nm :attr |
-            attr isEmptyOrNil
-        ].
-
-    "Created: / 18-08-2006 / 13:37:51 / cg"
-!
-
-compiled_classNames_unix
-    "class, only to be compiled under unix"
-    
-    ^ self compiled_classNamesForPlatform:#unix.
-
-    "Created: / 18-08-2006 / 13:37:51 / cg"
-!
-
-compiled_classNames_windows
-    "class, only to be compiled under windows"
-    
-    ^ self compiled_classNamesForPlatform:#win32.
-
-    "Created: / 18-08-2006 / 13:37:56 / cg"
-!
-
 extensionMethodNames
     "list class/selector pairs of extensions.
-     A correponding method with real names is generated in my subclasses"
-
+     A correponding method with real names must be present in my concrete subclasses"
+
+    "/ should this be a subclassResponsibility here ?
     ^ #()
 
     "Modified: / 17-08-2006 / 20:49:51 / cg"
@@ -3805,6 +3644,37 @@
 
 !ProjectDefinition class methodsFor:'private'!
 
+additionalClassAttributesFor: aClass
+    "Answers additional set of class attributes for given class
+     Individual project definitions may override this method, but
+     overriding method should always merge its attributes with result
+     of 'super additionalClassAttributesFor: aClass'.
+
+     Here, we add #autoload attributes to all test cases and
+     test resources, as they are not neccessary for the package
+     and should not be compiled (because of unwanted dependency
+     on stx:goodies/sunit package)
+    "
+
+    (aClass inheritsFrom: TestCase) ifTrue:[^#(autoload)].
+    (aClass inheritsFrom: TestResource) ifTrue:[^#(autoload)].
+
+    "No additional attributes"
+    ^#()
+
+    "
+        stx_libbasic additionalClassAttributesFor: Object 
+        stx_libtool additionalClassAttributesFor: Tools::NavigationHistoryTests
+        stx_goodies_sunit additionalClassAttributesFor: TestCase 
+
+
+        stx_libtool classNamesAndAttributes_code_ignoreOldEntries:true ignoreOldDefinition: true
+
+    "
+
+    "Created: / 26-10-2009 / 12:54:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 checkIfClassesArePresent
     "check if all classes defined by this project are present and
      offer a dialog to abort the current operation if not"
@@ -3844,12 +3714,48 @@
     ^ true
 !
 
+classNamesAndAttributesAsSpecArray
+    "given a classNamesAndAttributes array, make this a spec array (array of arrays).  
+     This decompresses class-name entries into a one-element array for easier processing"
+
+    ^ self classNamesAndAttributes
+        collect:[:entry |
+            entry isArray ifTrue:[
+                entry first isSymbol ifTrue:[
+                    entry
+                ] ifFalse:[
+                    (Array with:entry first asSymbol) , (entry copyFrom:2)
+                ].
+            ] ifFalse:[
+                Array with:entry asSymbol.
+            ]].
+
+    "Created: / 19-02-2007 / 16:11:53 / cg"
+!
+
 classNamesAndAttributesDo: aBlock
     self namesAndAttributesIn:(self classNamesAndAttributes) do: aBlock
 
     "Modified: / 22-08-2006 / 18:20:21 / cg"
 !
 
+classNamesAndAttributesFromSpecArray:aSpecArray
+    "given a spec array (array of arrays), make this a classNamesAndAttributes array
+     as stored literally in the method.
+     This compresses single element array-elements into plain names
+     (to save code in the compiled binaries)"
+
+    ^ aSpecArray
+        collect:[:entry |
+            (entry isArray and:[entry size == 1]) ifTrue:[
+                entry first
+            ] ifFalse:[
+                entry
+            ]].
+
+    "Created: / 19-02-2007 / 16:12:32 / cg"
+!
+
 compile:someCode categorized:category
     Class packageQuerySignal 
         answer:self package
@@ -4652,6 +4558,114 @@
 
 !ProjectDefinition class methodsFor:'queries'!
 
+allClassNames          
+    ^ self classNamesForWhich:[:nm :attr | true ].
+!
+
+autoloaded_classNames          
+    ^ self classNamesForWhich:[:nm :attr | attr notEmptyOrNil and:[attr includes:#autoload]].
+
+    "Modified: / 07-08-2006 / 21:25:25 / fm"
+    "Created: / 30-08-2007 / 18:48:09 / cg"
+!
+
+classNames          
+    "answer an array containing all the class names of the project's classes"
+
+    ^ self classNamesAndAttributesAsSpecArray collect:[:entry | entry first].
+
+    "
+     stx_libhtml classNames
+     stx_libhtml classNamesAndAttributesAsSpecArray
+    "
+!
+
+classNamesForWhich:aBlock          
+    "a correponding method with real names is generated in my subclasses"
+
+    |coll|
+
+    coll := OrderedCollection new.
+    self classNamesAndAttributesDo:[:nm :attributes |
+        (aBlock value:nm value:attributes) ifTrue:[
+            coll add:nm.
+        ].
+    ].
+    ^ coll
+
+    "Created: / 07-08-2006 / 19:02:57 / fm"
+    "Modified: / 07-08-2006 / 21:25:25 / fm"
+    "Modified: / 17-08-2006 / 20:47:20 / cg"
+!
+
+classes
+    "list my classes.
+     Project must be loaded - otherwise an error is reported here.
+     Use #classNames if you are only interested in the names"
+
+    ^ self classNames collect:[:nm | Smalltalk at:nm ifAbsent:[self error:'Missing class']]
+
+    "
+     stx_libbasic3 classNames
+     stx_libbasic3 classes
+    "
+!
+
+compiled_classNames          
+    ^ self classNamesForWhich:[:nm :attr | attr isEmptyOrNil or:[(attr includes:#autoload) not]].
+
+    "Created: / 07-08-2006 / 19:02:57 / fm"
+    "Modified: / 07-08-2006 / 21:25:25 / fm"
+    "Modified: / 21-08-2006 / 18:48:31 / cg"
+!
+
+compiled_classNamesForPlatform
+    "answer the classes to be compiled only for the current platformName"
+
+    ^ self compiled_classNamesForPlatform:OperatingSystem platformName
+!
+
+compiled_classNamesForPlatform:platformName
+    "answer the classes to be compiled only for platformName
+     platformName is one of #unix, #win32 (OperatingSystem platformName)"
+
+    ^ self 
+        classNamesForWhich:[:nm :attr | 
+            (attr includes:#autoload) not and:[attr includes:platformName]
+        ].
+
+    "Created: / 07-08-2006 / 19:02:57 / fm"
+    "Modified: / 07-08-2006 / 21:25:25 / fm"
+    "Modified: / 09-10-2006 / 13:30:08 / cg"
+!
+
+compiled_classNames_common
+    "classes to be compiled for any platform"
+
+    ^ self 
+        classNamesForWhich:[:nm :attr |
+            attr isEmptyOrNil
+        ].
+
+    "Created: / 18-08-2006 / 13:37:51 / cg"
+!
+
+compiled_classNames_unix
+    "class, only to be compiled under unix"
+    
+    ^ self compiled_classNamesForPlatform:#unix.
+
+    "Created: / 18-08-2006 / 13:37:51 / cg"
+!
+
+compiled_classNames_windows
+    "class, only to be compiled under windows"
+    
+    ^ self compiled_classNamesForPlatform:#win32.
+
+    "Created: / 18-08-2006 / 13:37:56 / cg"
+!
+
 definitionClassForMonticelloPackage:aMonicelloPackagename
     ^ self definitionClassForMonticelloPackage:aMonicelloPackagename createIfAbsent:false
 
@@ -4737,6 +4751,22 @@
     "Modified: / 23-08-2006 / 13:49:27 / cg"
 !
 
+extensionMethods
+    "list my extension methods.
+     Project must be loaded - otherwise an error is reported here.
+     Use #extensionMethodsNames if you are only interested in the names"
+
+    ^ self extensionMethodNames 
+        pairWiseCollect:[:className :selector |
+            (Smalltalk classNamed:className) compiledMethodAt:selector.
+        ].
+
+    "
+     stx_libbasic2 extensionMethodNames
+     stx_libbasic2 extensionMethods
+    "
+!
+
 hasAllClassesFullyLoaded
     "return true, if all classes are present and loaded"
 
@@ -4942,11 +4972,11 @@
 !ProjectDefinition class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.272 2009-10-26 17:30:19 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.273 2009-10-26 17:43:59 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.272 2009-10-26 17:30:19 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.273 2009-10-26 17:43:59 cg Exp $'
 ! !
 
 ProjectDefinition initialize!