ProjectDefinition.st
changeset 13081 4f67ee8faeb6
parent 12994 1254ff239542
child 13086 96e4c9426645
equal deleted inserted replaced
13080:f692f6c62c02 13081:4f67ee8faeb6
   273 allPreRequisitesSorted
   273 allPreRequisitesSorted
   274     "answer all the prerequisites of this projects sorted in
   274     "answer all the prerequisites of this projects sorted in
   275      the order they are needed.
   275      the order they are needed.
   276      Use this to e.g. compile packages in the dependency order"
   276      Use this to e.g. compile packages in the dependency order"
   277     
   277     
   278     |allPreRequisites orderedTuples effective|
   278     |allPreRequisites orderedTuples effective allPreRequisitesWithExtensions sortedPackages|
   279 
   279 
   280     orderedTuples := OrderedCollection new.
   280     orderedTuples := OrderedCollection new.
   281 
   281 
   282     allPreRequisites := self allPreRequisites.
   282     allPreRequisites := self allPreRequisites.
       
   283     allPreRequisitesWithExtensions := allPreRequisites union:self extensionPackages.
       
   284 
   283     allPreRequisites do:[:eachPackageID |
   285     allPreRequisites do:[:eachPackageID |
   284         |def|
   286         |def|
       
   287 
       
   288         orderedTuples add:(Array with:eachPackageID with:self package).
   285 
   289 
   286         def := self definitionClassForPackage:eachPackageID.
   290         def := self definitionClassForPackage:eachPackageID.
   287         def isNil ifTrue:[
   291         def isNil ifTrue:[
   288             Transcript showCR:'Warning: no definition class for package: ', eachPackageID.
   292             Transcript showCR:'Warning: no definition class for package: ', eachPackageID.
   289             orderedTuples add:(Array with:eachPackageID).
       
   290         ] ifFalse:[
   293         ] ifFalse:[
   291             effective := def effectivePreRequisites.
   294             effective := def effectivePreRequisites union:def extensionPackages.
   292             effective isEmptyOrNil ifTrue:[
   295             effective notEmptyOrNil ifTrue:[
   293                 orderedTuples add:(Array with:eachPackageID).
       
   294             ] ifFalse:[
       
   295                 effective do:[:eachPrerequisitePackageID|
   296                 effective do:[:eachPrerequisitePackageID|
   296                     orderedTuples add:(Array with:eachPrerequisitePackageID with:eachPackageID).
   297                     orderedTuples add:(Array with:eachPrerequisitePackageID with:eachPackageID).
   297                 ].
   298                 ].
   298             ].
   299             ].
   299         ].
   300         ].
   300     ].
   301     ].
   301 
   302 
   302     ^ orderedTuples topologicalSort.
   303     sortedPackages := orderedTuples topologicalSort.
       
   304 
       
   305     "packages which only result from extension methods are used for computing the sort order,
       
   306      but they are not added, if not present in the first place"
       
   307     ^ sortedPackages select:[:eachProject| allPreRequisites includes:eachProject]
   303 
   308 
   304     "
   309     "
   305      stx_libbasic allPreRequisitesSorted
   310      stx_libbasic allPreRequisitesSorted
   306      stx_libbasic2 allPreRequisitesSorted
   311      stx_libbasic2 allPreRequisitesSorted
   307      stx_libwidg2 allPreRequisitesSorted
   312      stx_libwidg2 allPreRequisitesSorted
  5133     ^ self compiled_classNamesForPlatform:#win32.
  5138     ^ self compiled_classNamesForPlatform:#win32.
  5134 
  5139 
  5135     "Created: / 18-08-2006 / 13:37:56 / cg"
  5140     "Created: / 18-08-2006 / 13:37:56 / cg"
  5136 !
  5141 !
  5137 
  5142 
       
  5143 extensionClasses
       
  5144     "answer the set of classes, which are extended by the package"
       
  5145 
       
  5146     |classes|
       
  5147 
       
  5148     classes := IdentitySet new.
       
  5149 
       
  5150     self extensionMethodNames pairWiseDo:[:className :selector | 
       
  5151         |mthdCls cls|
       
  5152 
       
  5153         mthdCls := Smalltalk classNamed:className.
       
  5154         (mthdCls notNil and:[mthdCls isLoaded]) ifTrue:[
       
  5155             cls := mthdCls theNonMetaclass.
       
  5156             (classes includes:cls) ifFalse:[
       
  5157                 cls withAllSuperclassesDo:[:eachClass |
       
  5158                     classes add:eachClass.
       
  5159                 ].
       
  5160             ].
       
  5161         ].
       
  5162     ].
       
  5163     ^ classes.
       
  5164 
       
  5165     "
       
  5166         stx_libboss extensionClasses
       
  5167     "
       
  5168 !
       
  5169 
  5138 extensionMethods
  5170 extensionMethods
  5139     "list my extension methods.
  5171     "list my extension methods.
  5140      Project must be loaded - otherwise an error is reported here.
  5172      Project must be loaded - otherwise an error is reported here.
  5141      Use #extensionMethodsNames if you are only interested in the names"
  5173      Use #extensionMethodsNames if you are only interested in the names"
  5142 
  5174 
  5146         ].
  5178         ].
  5147 
  5179 
  5148     "
  5180     "
  5149      stx_libbasic2 extensionMethodNames
  5181      stx_libbasic2 extensionMethodNames
  5150      stx_libbasic2 extensionMethods
  5182      stx_libbasic2 extensionMethods
       
  5183     "
       
  5184 !
       
  5185 
       
  5186 extensionPackages
       
  5187     "answer the set of packages, which are extended by this package"
       
  5188 
       
  5189     ^ self extensionClasses collect:[:eachClass| eachClass package]
       
  5190 
       
  5191     "
       
  5192         stx_libboss extensionPackages
  5151     "
  5193     "
  5152 !
  5194 !
  5153 
  5195 
  5154 hasAllClassesFullyLoaded
  5196 hasAllClassesFullyLoaded
  5155     "return true, if all classes are present and loaded"
  5197     "return true, if all classes are present and loaded"
  5378 ! !
  5420 ! !
  5379 
  5421 
  5380 !ProjectDefinition class methodsFor:'documentation'!
  5422 !ProjectDefinition class methodsFor:'documentation'!
  5381 
  5423 
  5382 version
  5424 version
  5383     ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.316 2010-08-05 12:04:44 stefan Exp $'
  5425     ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.317 2010-09-28 22:42:01 stefan Exp $'
  5384 !
  5426 !
  5385 
  5427 
  5386 version_CVS
  5428 version_CVS
  5387     ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.316 2010-08-05 12:04:44 stefan Exp $'
  5429     ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.317 2010-09-28 22:42:01 stefan Exp $'
  5388 ! !
  5430 ! !
  5389 
  5431 
  5390 ProjectDefinition initialize!
  5432 ProjectDefinition initialize!