'From Cuis 5.0 [latest update: #3913] on 11 October 2019 at 3:08:31 pm'!

!FeatureRequirement methodsFor: 'requires' stamp: 'KenD 10/11/2019 15:05:48'!
requireUnlessIn: toLoad main: mainFeatureOrNil
	"See if all the requirements can be met and answer the load order"

	self isAlreadySatisfied ifFalse: [
		(toLoad anySatisfy: [ :featReq | featReq sameNameAs: self])
		ifFalse: [
		(self findPackageFileAsReqOf: mainFeatureOrNil)
			ifTrue: [ | otherRequirements |
				otherRequirements := self requirements.
				otherRequirements ifNotNil: [
					otherRequirements do: [ :requires | 
						requires requireUnlessIn: toLoad main: (mainFeatureOrNil ifNil: [self])]].
				self == mainFeatureOrNil ifFalse: [
					self addToLoad: toLoad withMyRequirements: otherRequirements ].
				]
			ifFalse: [
				FeatureRequirementUnsatisfied 
					signal: 'Could not find package supplying: ',
							String newLineString, '        ',
							self printString,
							String newLineString,
							'Required by Feature ', self name printString
			]]].

	^ toLoad! !
