class: ProjectDefinition
authorClaus Gittinger <cg@exept.de>
Sat, 14 Jun 2014 10:28:45 +0200
changeset 16572 044aad2e50b7
parent 16571 e7bc644361e4
child 16573 a77c7cf596c2
class: ProjectDefinition changed: #classNamesAndAttributesFromSpecArray: #classNamesAndAttributes_code_ignoreOldEntries:ignoreOldDefinition: must also sort by load order when updating the contents description (not only when regenerating from scratch)
ProjectDefinition.st
--- a/ProjectDefinition.st	Sat Jun 14 00:44:09 2014 +0200
+++ b/ProjectDefinition.st	Sat Jun 14 10:28:45 2014 +0200
@@ -1234,7 +1234,7 @@
      the class is installed as autoloaded in the image (i.e. the state in the image is taken).
      If false, it is taken from an existing definition in #classNamesAndAttributes"
 
-    |newSpec oldSpec ignored|
+    |newSpec oldSpec ignored sortedSpec|
 
     oldSpec := self classNamesAndAttributesAsSpecArray.
     ignored := self ignoredClassNames asSet.
@@ -1312,8 +1312,8 @@
             ]
         ]
     ].
-
-    ^ self classNamesAndAttributes_codeFor:newSpec
+    sortedSpec := self classNamesAndAttributesFromSpecArray:newSpec.
+    ^ self classNamesAndAttributes_codeFor:sortedSpec
 
     "
      stx_libbasic3 classNamesAndAttributes_code_ignoreOldEntries:false ignoreOldDefinition:true
@@ -5184,23 +5184,30 @@
     "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)"
-
-    |newSpec loadedClasses loadedClassNames itemsForLoadedClasses itemsForUnloadedClasses|
+     (to save code in the compiled binaries) and especially sorts them by load/compile order"
+
+    |newSpec loadedClasses loadedClassNames itemsForUnloadedClasses
+     entriesByName|
+
+    entriesByName := Dictionary new.
 
     newSpec :=
         aSpecArray
             collect:[:entry |
+                |nm|
+
                 (entry isArray and:[entry size == 1]) ifTrue:[
-                    entry first
+                    nm := entry first.
+                    entriesByName at:nm put:nm.
                 ] ifFalse:[
-                    entry
-                ]
+                    nm := entry.
+                    entriesByName at:nm put:entry.
+                ].
+                nm
             ].
 
     "/ extract loaded and unloaded classes.
     loadedClasses := OrderedCollection new.
-    itemsForLoadedClasses := OrderedCollection new.
     itemsForUnloadedClasses := OrderedCollection new.
 
     newSpec do:[:entry |
@@ -5210,22 +5217,16 @@
         clsOrNil := Smalltalk classNamed:clsName.
         (clsOrNil notNil and:[clsOrNil isLoaded]) ifTrue:[
             loadedClasses add:clsOrNil.
-            itemsForLoadedClasses add:entry.
         ] ifFalse:[
             itemsForUnloadedClasses add:entry.
         ]
     ].
     "/ and sort by load order 
     loadedClassNames := (Class classesSortedByLoadOrder:loadedClasses) collect:[:cls | cls name].
+    newSpec := loadedClassNames collect:[:nm | entriesByName at:nm].
+
     "/ reconstruct contents array, unloaded classes last.
-    newSpec := loadedClassNames
-                collect:[:nm | itemsForLoadedClasses 
-                                    detect:[:entry |
-                                        entry = nm
-                                        or:[entry isArray and:[entry first = nm]]]].
-    newSpec := newSpec asArray , itemsForUnloadedClasses asArray.
-    "/ self halt.
-    ^ newSpec
+    ^ newSpec asArray , itemsForUnloadedClasses asArray.
 !
 
 compile:someCode categorized:category
@@ -7476,11 +7477,11 @@
 !ProjectDefinition class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.506 2014-06-13 22:44:09 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.507 2014-06-14 08:28:45 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.506 2014-06-13 22:44:09 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.507 2014-06-14 08:28:45 cg Exp $'
 !
 
 version_SVN