added: #allPreRequisitesWithParentDo:
changed:
#allPreRequisites
#allPreRequisitesSorted
--- a/ProjectDefinition.st Wed Apr 13 11:40:50 2011 +0200
+++ b/ProjectDefinition.st Wed Apr 13 15:30:49 2011 +0200
@@ -222,6 +222,79 @@
"answer all (recursive) prerequisite project ids of myself - in random order.
If we exclude a project, but one of our prerequisite projects depends on it, "
+ ^ self allPreRequisitesWithParentDo:[:parent :prereq |
+ prereq = self package ifTrue:[ Transcript showCR:('oops: %1 depends on itself' bindWith:prereq) ].
+ ]
+
+ "
+ stx_libbasic allPreRequisites
+ stx_libbasic2 allPreRequisites
+ stx_libview2 allPreRequisites
+ ubs_application allPreRequisites
+ ubs_application allPreRequisitesSorted
+ exept_expecco_application allPreRequisites
+ exept_expeccoNET_application allPreRequisites
+ alspa_batch_application allPreRequisites
+ "
+
+ "Modified: / 13-04-2011 / 15:30:45 / sr"
+!
+
+allPreRequisitesSorted
+ "answer all the prerequisites of this projects sorted in
+ the order they are needed.
+ Use this to e.g. compile packages in the dependency order"
+
+ |allPreRequisites orderedTuples effective allPreRequisitesWithExtensions sortedPackages|
+
+ orderedTuples := OrderedCollection new.
+
+ allPreRequisites := self allPreRequisites.
+ allPreRequisitesWithExtensions := allPreRequisites union:self extensionPackages.
+
+ allPreRequisites do:[:eachPackageID |
+ |def|
+
+ self assert:(eachPackageID ~= self package).
+ orderedTuples add:(Array with:eachPackageID with:self package).
+
+ def := self definitionClassForPackage:eachPackageID.
+ def isNil ifTrue:[
+ Transcript showCR:'Warning: no definition class for package: ', eachPackageID.
+ ] ifFalse:[
+ effective := def effectivePreRequisites union:def extensionPackages.
+ effective notEmptyOrNil ifTrue:[
+ effective do:[:eachPrerequisitePackageID|
+ self assert:(eachPrerequisitePackageID ~= eachPackageID).
+ orderedTuples add:(Array with:eachPrerequisitePackageID with:eachPackageID).
+ ].
+ ].
+ ].
+ ].
+
+ (orderedTuples detect:[:el | el first = el second] ifNone:nil) notNil ifTrue:[self halt].
+ sortedPackages := orderedTuples topologicalSort.
+
+ "packages which only result from extension methods are used for computing the sort order,
+ but they are not added, if not present in the first place"
+ ^ sortedPackages select:[:eachProject| allPreRequisites includes:eachProject]
+
+ "
+ stx_libbasic allPreRequisitesSorted
+ stx_libbasic2 allPreRequisitesSorted
+ stx_libwidg2 allPreRequisitesSorted
+ exept_expecco_application allPreRequisitesSorted
+ alspa_batch_application allPreRequisitesSorted
+ ubs_application allPreRequisitesSorted
+ "
+
+ "Modified: / 13-04-2011 / 15:19:13 / sr"
+!
+
+allPreRequisitesWithParentDo:aBlock
+ "answer all (recursive) prerequisite project ids of myself - in random order.
+ If we exclude a project, but one of our prerequisite projects depends on it, "
+
|setOfAllPreRequisites toAdd|
setOfAllPreRequisites := Set new.
@@ -249,14 +322,18 @@
select:[:eachSubPreRequisite | (setOfAllPreRequisites includes:eachSubPreRequisite) not]
thenDo:[:eachSubPreRequisite |
Transcript show:'ProjectDefinition preRequisites: '; showCR:(aPreRequisiteProjectID, ' requires ', eachSubPreRequisite).
- toAdd add:eachSubPreRequisite ].
+ aBlock value:def value:eachSubPreRequisite.
+ toAdd add:eachSubPreRequisite
+ ].
"but subprojects of our prerequisites are also prerequisites"
def effectiveSubProjects
- select:[:eachSubSubRequisite | (setOfAllPreRequisites includes:eachSubSubRequisite) not]
+ select:[:eachSubSubRequisite | eachSubSubRequisite ~= self package and:[ (setOfAllPreRequisites includes:eachSubSubRequisite) not ]]
thenDo:[:eachSubSubRequisite |
Transcript show:'ProjectDefinition preRequisites: '; showCR:(aPreRequisiteProjectID, ' hasSub ', eachSubSubRequisite).
- toAdd add:eachSubSubRequisite ].
+ aBlock value:def value:eachSubSubRequisite.
+ toAdd add:eachSubSubRequisite
+ ].
].
]
].
@@ -272,52 +349,8 @@
exept_expeccoNET_application allPreRequisites
alspa_batch_application allPreRequisites
"
-!
-
-allPreRequisitesSorted
- "answer all the prerequisites of this projects sorted in
- the order they are needed.
- Use this to e.g. compile packages in the dependency order"
-
- |allPreRequisites orderedTuples effective allPreRequisitesWithExtensions sortedPackages|
-
- orderedTuples := OrderedCollection new.
-
- allPreRequisites := self allPreRequisites.
- allPreRequisitesWithExtensions := allPreRequisites union:self extensionPackages.
-
- allPreRequisites do:[:eachPackageID |
- |def|
-
- orderedTuples add:(Array with:eachPackageID with:self package).
-
- def := self definitionClassForPackage:eachPackageID.
- def isNil ifTrue:[
- Transcript showCR:'Warning: no definition class for package: ', eachPackageID.
- ] ifFalse:[
- effective := def effectivePreRequisites union:def extensionPackages.
- effective notEmptyOrNil ifTrue:[
- effective do:[:eachPrerequisitePackageID|
- orderedTuples add:(Array with:eachPrerequisitePackageID with:eachPackageID).
- ].
- ].
- ].
- ].
-
- sortedPackages := orderedTuples topologicalSort.
-
- "packages which only result from extension methods are used for computing the sort order,
- but they are not added, if not present in the first place"
- ^ sortedPackages select:[:eachProject| allPreRequisites includes:eachProject]
-
- "
- stx_libbasic allPreRequisitesSorted
- stx_libbasic2 allPreRequisitesSorted
- stx_libwidg2 allPreRequisitesSorted
- exept_expecco_application allPreRequisitesSorted
- alspa_batch_application allPreRequisitesSorted
- ubs_application allPreRequisitesSorted
- "
+
+ "Created: / 13-04-2011 / 15:23:21 / sr"
!
directory
@@ -5668,11 +5701,11 @@
!ProjectDefinition class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.335 2011-03-07 10:10:20 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.336 2011-04-13 13:30:49 sr Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.335 2011-03-07 10:10:20 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.336 2011-04-13 13:30:49 sr Exp $'
! !
ProjectDefinition initialize!