Merge topic 'refactor-progress'
7fbc56ac
cmGlobalUnixMakefileGenerator3: Implement progress in terms of cmState.65c434e1
cmGlobalUnixMakefileGenerator3: Inline an IsExcluded call.be56feb6
cmGlobalGenerator: Extract new IsExcluded overload.45f52003
cmGlobalGenerator: Implement IsExcluded in terms of cmState::Snapshot.af9fc277
cmState: Make Snapshot EqualityComparable.9b44018d
cmGlobalGenerator: Convert IsExcluded to loop.5f05b562
cmGlobalGenerator: Refactor IsExcluded.95925a60
cmGlobalGenerator: Don't use else after return.
This commit is contained in:
commit
2985b9c003
|
@ -2041,24 +2041,37 @@ void cmGlobalGenerator::SetConfiguredFilesPath(cmGlobalGenerator* gen)
|
|||
}
|
||||
}
|
||||
|
||||
bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
|
||||
cmLocalGenerator* gen) const
|
||||
bool cmGlobalGenerator::IsExcluded(cmState::Snapshot const& rootSnp,
|
||||
cmState::Snapshot const& snp_) const
|
||||
{
|
||||
if(!gen || gen == root)
|
||||
cmState::Snapshot snp = snp_;
|
||||
while (snp.IsValid())
|
||||
{
|
||||
if(snp == rootSnp)
|
||||
{
|
||||
// No directory excludes itself.
|
||||
return false;
|
||||
}
|
||||
|
||||
if(gen->GetMakefile()->GetPropertyAsBool("EXCLUDE_FROM_ALL"))
|
||||
if(snp.GetDirectory().GetPropertyAsBool("EXCLUDE_FROM_ALL"))
|
||||
{
|
||||
// This directory is excluded from its parent.
|
||||
return true;
|
||||
}
|
||||
snp = snp.GetBuildsystemDirectoryParent();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// This directory is included in its parent. Check whether the
|
||||
// parent is excluded.
|
||||
return this->IsExcluded(root, gen->GetParent());
|
||||
bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
|
||||
cmLocalGenerator* gen) const
|
||||
{
|
||||
assert(gen);
|
||||
|
||||
cmState::Snapshot rootSnp = root->GetStateSnapshot();
|
||||
cmState::Snapshot snp = gen->GetStateSnapshot();
|
||||
|
||||
return this->IsExcluded(rootSnp, snp);
|
||||
}
|
||||
|
||||
bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
|
||||
|
@ -2070,12 +2083,9 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
|
|||
// This target is excluded from its directory.
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// This target is included in its directory. Check whether the
|
||||
// directory is excluded.
|
||||
return this->IsExcluded(root, target->GetLocalGenerator());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -396,6 +396,8 @@ protected:
|
|||
// has been populated.
|
||||
void FillProjectMap();
|
||||
void CheckLocalGenerators();
|
||||
bool IsExcluded(cmState::Snapshot const& root,
|
||||
cmState::Snapshot const& snp) const;
|
||||
bool IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen) const;
|
||||
bool IsExcluded(cmLocalGenerator* root, cmGeneratorTarget* target) const;
|
||||
virtual void InitializeProgressMarks() {}
|
||||
|
|
|
@ -936,14 +936,25 @@ void cmGlobalUnixMakefileGenerator3::InitializeProgressMarks()
|
|||
|
||||
cmGeneratorTarget* gt = this->GetGeneratorTarget(&target);
|
||||
|
||||
cmLocalGenerator* tlg = gt->GetLocalGenerator();
|
||||
|
||||
if(gt->GetType() == cmTarget::INTERFACE_LIBRARY
|
||||
|| gt->Target->GetPropertyAsBool("EXCLUDE_FROM_ALL"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
cmState::Snapshot csnp = lg->GetStateSnapshot();
|
||||
cmState::Snapshot tsnp = tlg->GetStateSnapshot();
|
||||
|
||||
// Consider the directory containing the target and all its
|
||||
// parents until something excludes the target.
|
||||
for(cmLocalGenerator* clg = lg; clg && !this->IsExcluded(clg, gt);
|
||||
clg = clg->GetParent())
|
||||
for( ; csnp.IsValid() && !this->IsExcluded(csnp, tsnp);
|
||||
csnp = csnp.GetBuildsystemDirectoryParent())
|
||||
{
|
||||
// This local generator includes the target.
|
||||
std::set<cmGeneratorTarget const*>& targetSet =
|
||||
this->DirectoryTargetsMap[clg->GetStateSnapshot()];
|
||||
this->DirectoryTargetsMap[csnp];
|
||||
targetSet.insert(gt);
|
||||
|
||||
// Add dependencies of the included target. An excluded
|
||||
|
|
|
@ -1701,3 +1701,13 @@ std::vector<std::string> cmState::Directory::GetPropertyKeys() const
|
|||
}
|
||||
return keys;
|
||||
}
|
||||
|
||||
bool operator==(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs)
|
||||
{
|
||||
return lhs.Position == rhs.Position;
|
||||
}
|
||||
|
||||
bool operator!=(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs)
|
||||
{
|
||||
return lhs.Position != rhs.Position;
|
||||
}
|
||||
|
|
|
@ -93,6 +93,10 @@ public:
|
|||
};
|
||||
|
||||
private:
|
||||
friend bool operator==(const cmState::Snapshot& lhs,
|
||||
const cmState::Snapshot& rhs);
|
||||
friend bool operator!=(const cmState::Snapshot& lhs,
|
||||
const cmState::Snapshot& rhs);
|
||||
friend class cmState;
|
||||
friend class Directory;
|
||||
friend struct StrictWeakOrder;
|
||||
|
@ -314,4 +318,7 @@ private:
|
|||
bool MSYSShell;
|
||||
};
|
||||
|
||||
bool operator==(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs);
|
||||
bool operator!=(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue