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,
|
bool cmGlobalGenerator::IsExcluded(cmState::Snapshot const& rootSnp,
|
||||||
cmLocalGenerator* gen) const
|
cmState::Snapshot const& snp_) const
|
||||||
{
|
{
|
||||||
if(!gen || gen == root)
|
cmState::Snapshot snp = snp_;
|
||||||
|
while (snp.IsValid())
|
||||||
|
{
|
||||||
|
if(snp == rootSnp)
|
||||||
{
|
{
|
||||||
// No directory excludes itself.
|
// No directory excludes itself.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(gen->GetMakefile()->GetPropertyAsBool("EXCLUDE_FROM_ALL"))
|
if(snp.GetDirectory().GetPropertyAsBool("EXCLUDE_FROM_ALL"))
|
||||||
{
|
{
|
||||||
// This directory is excluded from its parent.
|
// This directory is excluded from its parent.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
snp = snp.GetBuildsystemDirectoryParent();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// This directory is included in its parent. Check whether the
|
bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
|
||||||
// parent is excluded.
|
cmLocalGenerator* gen) const
|
||||||
return this->IsExcluded(root, gen->GetParent());
|
{
|
||||||
|
assert(gen);
|
||||||
|
|
||||||
|
cmState::Snapshot rootSnp = root->GetStateSnapshot();
|
||||||
|
cmState::Snapshot snp = gen->GetStateSnapshot();
|
||||||
|
|
||||||
|
return this->IsExcluded(rootSnp, snp);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
|
bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
|
||||||
@ -2070,13 +2083,10 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
|
|||||||
// This target is excluded from its directory.
|
// This target is excluded from its directory.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// This target is included in its directory. Check whether the
|
// This target is included in its directory. Check whether the
|
||||||
// directory is excluded.
|
// directory is excluded.
|
||||||
return this->IsExcluded(root, target->GetLocalGenerator());
|
return this->IsExcluded(root, target->GetLocalGenerator());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
cmGlobalGenerator::GetEnabledLanguages(std::vector<std::string>& lang) const
|
cmGlobalGenerator::GetEnabledLanguages(std::vector<std::string>& lang) const
|
||||||
|
@ -396,6 +396,8 @@ protected:
|
|||||||
// has been populated.
|
// has been populated.
|
||||||
void FillProjectMap();
|
void FillProjectMap();
|
||||||
void CheckLocalGenerators();
|
void CheckLocalGenerators();
|
||||||
|
bool IsExcluded(cmState::Snapshot const& root,
|
||||||
|
cmState::Snapshot const& snp) const;
|
||||||
bool IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen) const;
|
bool IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen) const;
|
||||||
bool IsExcluded(cmLocalGenerator* root, cmGeneratorTarget* target) const;
|
bool IsExcluded(cmLocalGenerator* root, cmGeneratorTarget* target) const;
|
||||||
virtual void InitializeProgressMarks() {}
|
virtual void InitializeProgressMarks() {}
|
||||||
|
@ -936,14 +936,25 @@ void cmGlobalUnixMakefileGenerator3::InitializeProgressMarks()
|
|||||||
|
|
||||||
cmGeneratorTarget* gt = this->GetGeneratorTarget(&target);
|
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
|
// Consider the directory containing the target and all its
|
||||||
// parents until something excludes the target.
|
// parents until something excludes the target.
|
||||||
for(cmLocalGenerator* clg = lg; clg && !this->IsExcluded(clg, gt);
|
for( ; csnp.IsValid() && !this->IsExcluded(csnp, tsnp);
|
||||||
clg = clg->GetParent())
|
csnp = csnp.GetBuildsystemDirectoryParent())
|
||||||
{
|
{
|
||||||
// This local generator includes the target.
|
// This local generator includes the target.
|
||||||
std::set<cmGeneratorTarget const*>& targetSet =
|
std::set<cmGeneratorTarget const*>& targetSet =
|
||||||
this->DirectoryTargetsMap[clg->GetStateSnapshot()];
|
this->DirectoryTargetsMap[csnp];
|
||||||
targetSet.insert(gt);
|
targetSet.insert(gt);
|
||||||
|
|
||||||
// Add dependencies of the included target. An excluded
|
// Add dependencies of the included target. An excluded
|
||||||
|
@ -1701,3 +1701,13 @@ std::vector<std::string> cmState::Directory::GetPropertyKeys() const
|
|||||||
}
|
}
|
||||||
return keys;
|
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:
|
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 cmState;
|
||||||
friend class Directory;
|
friend class Directory;
|
||||||
friend struct StrictWeakOrder;
|
friend struct StrictWeakOrder;
|
||||||
@ -314,4 +318,7 @@ private:
|
|||||||
bool MSYSShell;
|
bool MSYSShell;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool operator==(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs);
|
||||||
|
bool operator!=(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user