#excludeClasses:usingCompiler:
authorClaus Gittinger <cg@exept.de>
Fri, 23 Oct 2009 16:27:51 +0200
changeset 12339 918b3eddd723
parent 12338 2026ed7d56fa
child 12340 e9ea989ffe01
#excludeClasses:usingCompiler: #includeClasses:usingCompiler: #makeClassesAutoloaded:usingCompiler:
ProjectDefinition.st
--- a/ProjectDefinition.st	Fri Oct 23 16:22:57 2009 +0200
+++ b/ProjectDefinition.st	Fri Oct 23 16:27:51 2009 +0200
@@ -729,6 +729,128 @@
     "Created: / 14-09-2006 / 14:59:53 / cg"
 ! !
 
+!ProjectDefinition class methodsFor:'accessing - packaging'!
+
+excludeClasses:toExclude usingCompiler:compilerOrNil
+    "exclude (remove from classList) a number of classes. 
+     Because this requires compilation of my classList-method, a compiler can be passed in, 
+     which has to do the job.
+     (this is used by the systembrowser to pass in a CodeGeneratorTool with undo support)"
+
+    |oldSpec newSpec newCode|
+
+    oldSpec := self classNamesAndAttributes.
+    newSpec := oldSpec copy.
+
+    toExclude do:[:eachClassToExclude |
+        |className|
+        className := eachClassToExclude theNonMetaclass name.
+        (self allClassNames includes:className) ifTrue:[
+            |idx|
+
+            idx := newSpec findFirst:[:entry | entry = className or:[entry first = className]].
+            idx ~~ 0 ifTrue:[
+                newSpec := newSpec copyWithoutIndex:idx.
+            ].
+        ].
+    ].
+
+    newSpec = oldSpec ifTrue: [^ self].
+
+    newCode := self classNamesAndAttributes_codeFor:newSpec.
+
+    (compilerOrNil ? self compilerClass)
+        compile:newCode
+        forClass:self theMetaclass
+        inCategory:'description - contents'.
+
+    "Created: / 30-08-2007 / 18:28:28 / cg"
+!
+
+includeClasses:toInclude usingCompiler:compilerOrNil
+    "include (add to classList) a number of classes. 
+     Because this requires compilation of my classList-method, a compiler can be passed in, 
+     which has to do the job.
+     (this is used by the systembrowser to pass in a CodeGeneratorTool with undo support)"
+
+    |oldSpec newSpec newCode|
+
+    oldSpec := self classNamesAndAttributes.
+    newSpec := oldSpec copy.
+
+    toInclude do:[:eachClassToInclude |
+        |className|
+
+        className := eachClassToInclude theNonMetaclass name.
+        (self compiled_classNames includes:className) ifFalse:[
+            | idx entry|
+
+            idx := oldSpec findFirst:[:entry | entry = className or:[entry first = className]].
+            idx == 0 ifTrue:[
+                newSpec := newSpec copyWith:(Array with:className)
+            ] ifFalse:[
+                entry := newSpec at:idx.
+                entry isArray ifTrue:[
+                    entry := entry copyWithout:#autoload
+                ].
+                newSpec at:idx put:entry
+            ].
+        ].
+    ].
+
+    newSpec = oldSpec ifTrue: [^ self].
+
+    newCode := self classNamesAndAttributes_codeFor:newSpec.
+
+    (compilerOrNil ? self compilerClass)
+        compile:newCode
+        forClass:self theMetaclass
+        inCategory:'description - contents'.
+!
+
+makeClassesAutoloaded:toMakeAutoloaded usingCompiler:compilerOrNil
+    "include as autoloaded (add to classList) a number of classes. 
+     Because this requires compilation of my classList-method, a compiler can be passed in, 
+     which has to do the job.
+     (this is used by the systembrowser to pass in a CodeGeneratorTool with undo support)"
+
+    |oldSpec newCode newSpec|
+
+    oldSpec := self classNamesAndAttributes.
+    newSpec := oldSpec copy.
+
+    toMakeAutoloaded do:[:eachClassToMakeAutoloaded |
+        |className|
+
+        className := eachClassToMakeAutoloaded theNonMetaclass name.
+        (self autoloaded_classNames includes:className) ifFalse:[
+            |idx entry|
+
+            idx := newSpec findFirst:[:entry | entry = className or:[entry first = className]].
+            idx == 0 ifTrue:[
+                newSpec := newSpec copyWith:(Array with:className with:#autoload)
+            ] ifFalse:[
+                entry := newSpec at:idx.
+                entry isArray ifTrue:[
+                    entry := (entry copyWithout:#autoload) copyWith:#autoload.
+                ] ifFalse:[
+                    entry := Array with:entry with:#autoload
+                ].
+                newSpec at:idx put:entry.
+            ].
+        ].
+    ].
+
+    newSpec = oldSpec ifTrue: [^ self].
+
+    newCode := self classNamesAndAttributes_codeFor:newSpec.
+
+    (compilerOrNil ? self compilerClass)
+        compile:newCode
+        forClass:self theMetaclass
+        inCategory:'description - contents'.
+! !
+
 !ProjectDefinition class methodsFor:'accessing - svn'!
 
 svnRevision
@@ -1057,37 +1179,6 @@
     ^ subProjects
 !
 
-excludeClasses:toExclude usingCompiler:generator
-    |oldSpec newSpec newCode|
-
-    oldSpec := self classNamesAndAttributes.
-    newSpec := oldSpec copy.
-
-    toExclude do:[:eachClassToExclude |
-        |className|
-        className := eachClassToExclude theNonMetaclass name.
-        (self allClassNames includes:className) ifTrue:[
-            |idx|
-
-            idx := newSpec findFirst:[:entry | entry = className or:[entry first = className]].
-            idx ~~ 0 ifTrue:[
-                newSpec := newSpec copyWithoutIndex:idx.
-            ].
-        ].
-    ].
-
-    newSpec = oldSpec ifTrue: [^ self].
-
-    newCode := self classNamesAndAttributes_codeFor:newSpec.
-
-    generator
-        compile:newCode
-        forClass:self theMetaclass
-        inCategory:'description - contents'.
-
-    "Created: / 30-08-2007 / 18:28:28 / cg"
-!
-
 extensionMethodNames_code
     ^ self extensionMethodNames_code_ignoreOldEntries:true
 
@@ -1210,42 +1301,6 @@
     "Modified: / 10-10-2006 / 22:02:24 / cg"
 !
 
-includeClasses:toInclude usingCompiler:compiler
-    |oldSpec newSpec newCode|
-
-    oldSpec := self classNamesAndAttributes.
-    newSpec := oldSpec copy.
-
-    toInclude do:[:eachClassToInclude |
-        |className|
-
-        className := eachClassToInclude theNonMetaclass name.
-        (self compiled_classNames includes:className) ifFalse:[
-            | idx entry|
-
-            idx := oldSpec findFirst:[:entry | entry = className or:[entry first = className]].
-            idx == 0 ifTrue:[
-                newSpec := newSpec copyWith:(Array with:className)
-            ] ifFalse:[
-                entry := newSpec at:idx.
-                entry isArray ifTrue:[
-                    entry := entry copyWithout:#autoload
-                ].
-                newSpec at:idx put:entry
-            ].
-        ].
-    ].
-
-    newSpec = oldSpec ifTrue: [^ self].
-
-    newCode := self classNamesAndAttributes_codeFor:newSpec.
-
-    compiler
-        compile:newCode
-        forClass:self theMetaclass
-        inCategory:'description - contents'.
-!
-
 legalCopyright_code
     ^ String streamContents:[:s |
         s nextPutLine:'legalCopyright'.
@@ -1261,44 +1316,6 @@
     "Created: / 18-08-2006 / 16:21:01 / cg"
 !
 
-makeClassesAutoloaded:toMakeAutoloaded usingCompiler:generator
-    |oldSpec newCode newSpec|
-
-    oldSpec := self classNamesAndAttributes.
-    newSpec := oldSpec copy.
-
-    toMakeAutoloaded do:[:eachClassToMakeAutoloaded |
-        |className|
-
-        className := eachClassToMakeAutoloaded theNonMetaclass name.
-        (self autoloaded_classNames includes:className) ifFalse:[
-            |idx entry|
-
-            idx := newSpec findFirst:[:entry | entry = className or:[entry first = className]].
-            idx == 0 ifTrue:[
-                newSpec := newSpec copyWith:(Array with:className with:#autoload)
-            ] ifFalse:[
-                entry := newSpec at:idx.
-                entry isArray ifTrue:[
-                    entry := (entry copyWithout:#autoload) copyWith:#autoload.
-                ] ifFalse:[
-                    entry := Array with:entry with:#autoload
-                ].
-                newSpec at:idx put:entry.
-            ].
-        ].
-    ].
-
-    newSpec = oldSpec ifTrue: [^ self].
-
-    newCode := self classNamesAndAttributes_codeFor:newSpec.
-
-    generator
-        compile:newCode
-        forClass:self theMetaclass
-        inCategory:'description - contents'.
-!
-
 preRequisites_code
     "generate the code of the #preRequisites method"
 
@@ -4846,11 +4863,11 @@
 !ProjectDefinition class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.265 2009-10-23 14:22:57 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.266 2009-10-23 14:27:51 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.265 2009-10-23 14:22:57 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.266 2009-10-23 14:27:51 cg Exp $'
 ! !
 
 ProjectDefinition initialize!