Fix adding order dependent dependency resolution

PackageFSRoot::_AddPackage(): When adding a resolvable which isn't known
yet, make sure all already added matching dependencies are resolved.
This commit is contained in:
Ingo Weinhold 2011-06-25 19:05:10 +02:00
parent b143a5a861
commit 5165b6b1d8
2 changed files with 19 additions and 0 deletions

View File

@ -17,6 +17,9 @@ public:
void AddDependency(Dependency* dependency);
void RemoveDependency(Dependency* dependency);
void AddDependenciesToList(
ResolvableDependencyList& list) const;
const char* Name() const;
bool IsLastDependency(Dependency* dependency) const;
@ -45,6 +48,16 @@ DependencyFamily::RemoveDependency(Dependency* dependency)
}
inline void
DependencyFamily::AddDependenciesToList(ResolvableDependencyList& list) const
{
for (FamilyDependencyList::ConstIterator it = fDependencies.GetIterator();
Dependency* dependency = it.Next();) {
list.Add(dependency);
}
}
inline const char*
DependencyFamily::Name() const
{

View File

@ -246,6 +246,12 @@ PackageFSRoot::_AddPackage(Package* package)
family->AddResolvable(resolvable, dependenciesToUpdate);
fResolvables.Insert(family);
// add pre-existing dependencies for that resolvable
if (DependencyFamily* dependencyFamily
= fDependencies.Lookup(resolvable->Name())) {
dependencyFamily->AddDependenciesToList(dependenciesToUpdate);
}
}
}