forked from qt-creator/qt-creator
Add Qt4PriFileNode::subProjectNodesExact which uses the exact parse
Change-Id: Ic6b8dedbc31830295e3dccea82c5f6514840dc57 Reviewed-on: http://codereview.qt.nokia.com/4282 Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com> Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
This commit is contained in:
@@ -248,7 +248,8 @@ Qt4PriFileNode::Qt4PriFileNode(Qt4Project *project, Qt4ProFileNode* qt4ProFileNo
|
|||||||
m_project(project),
|
m_project(project),
|
||||||
m_qt4ProFileNode(qt4ProFileNode),
|
m_qt4ProFileNode(qt4ProFileNode),
|
||||||
m_projectFilePath(QDir::fromNativeSeparators(filePath)),
|
m_projectFilePath(QDir::fromNativeSeparators(filePath)),
|
||||||
m_projectDir(QFileInfo(filePath).absolutePath())
|
m_projectDir(QFileInfo(filePath).absolutePath()),
|
||||||
|
m_includedInExactParse(true)
|
||||||
{
|
{
|
||||||
Q_ASSERT(project);
|
Q_ASSERT(project);
|
||||||
m_qt4PriFile = new Qt4PriFile(this);
|
m_qt4PriFile = new Qt4PriFile(this);
|
||||||
@@ -768,6 +769,27 @@ QList<ProjectExplorer::RunConfiguration *> Qt4PriFileNode::runConfigurationsFor(
|
|||||||
return m_project->activeTarget()->runConfigurationsForNode(node);
|
return m_project->activeTarget()->runConfigurationsForNode(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<Qt4PriFileNode *> Qt4PriFileNode::subProjectNodesExact() const
|
||||||
|
{
|
||||||
|
QList<Qt4PriFileNode *> nodes;
|
||||||
|
foreach (ProjectNode *node, subProjectNodes()) {
|
||||||
|
Qt4PriFileNode *n = qobject_cast<Qt4PriFileNode *>(node);
|
||||||
|
if (n && n->includedInExactParse())
|
||||||
|
nodes << n;
|
||||||
|
}
|
||||||
|
return nodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Qt4PriFileNode::includedInExactParse() const
|
||||||
|
{
|
||||||
|
return m_includedInExactParse;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Qt4PriFileNode::setIncludedInExactParse(bool b)
|
||||||
|
{
|
||||||
|
m_includedInExactParse = b;
|
||||||
|
}
|
||||||
|
|
||||||
QList<ProjectNode::ProjectAction> Qt4PriFileNode::supportedActions(Node *node) const
|
QList<ProjectNode::ProjectAction> Qt4PriFileNode::supportedActions(Node *node) const
|
||||||
{
|
{
|
||||||
QList<ProjectAction> actions;
|
QList<ProjectAction> actions;
|
||||||
@@ -1618,10 +1640,13 @@ void Qt4ProFileNode::applyEvaluate(EvalResult evalResult, bool async)
|
|||||||
|
|
||||||
QStringList newProjectFilesExact;
|
QStringList newProjectFilesExact;
|
||||||
QHash<QString, ProFile*> includeFilesExact;
|
QHash<QString, ProFile*> includeFilesExact;
|
||||||
|
QSet<QString> exactSubdirs;
|
||||||
ProFile *fileForCurrentProjectExact = 0;
|
ProFile *fileForCurrentProjectExact = 0;
|
||||||
if (evalResult == EvalOk) {
|
if (evalResult == EvalOk) {
|
||||||
if (m_projectType == SubDirsTemplate)
|
if (m_projectType == SubDirsTemplate) {
|
||||||
newProjectFilesExact = subDirsPaths(m_readerExact);
|
newProjectFilesExact = subDirsPaths(m_readerExact);
|
||||||
|
exactSubdirs = newProjectFilesExact.toSet();
|
||||||
|
}
|
||||||
foreach (ProFile *includeFile, m_readerExact->includeFiles()) {
|
foreach (ProFile *includeFile, m_readerExact->includeFiles()) {
|
||||||
if (includeFile->fileName() == m_projectFilePath) { // this file
|
if (includeFile->fileName() == m_projectFilePath) { // this file
|
||||||
fileForCurrentProjectExact = includeFile;
|
fileForCurrentProjectExact = includeFile;
|
||||||
@@ -1718,15 +1743,20 @@ void Qt4ProFileNode::applyEvaluate(EvalResult evalResult, bool async)
|
|||||||
ProFile *fileExact = includeFilesExact.value((*existingIt)->path());
|
ProFile *fileExact = includeFilesExact.value((*existingIt)->path());
|
||||||
ProFile *fileCumlative = includeFilesCumlative.value((*existingIt)->path());
|
ProFile *fileCumlative = includeFilesCumlative.value((*existingIt)->path());
|
||||||
if (fileExact || fileCumlative) {
|
if (fileExact || fileCumlative) {
|
||||||
static_cast<Qt4PriFileNode *>(*existingIt)->update(fileExact, m_readerExact, fileCumlative, m_readerCumulative);
|
Qt4PriFileNode *priFileNode = static_cast<Qt4PriFileNode *>(*existingIt);
|
||||||
|
priFileNode->update(fileExact, m_readerExact, fileCumlative, m_readerCumulative);
|
||||||
|
priFileNode->setIncludedInExactParse(fileExact != 0 && includedInExactParse());
|
||||||
} else {
|
} else {
|
||||||
// We always parse exactly, because we later when async parsing don't know whether
|
// We always parse exactly, because we later when async parsing don't know whether
|
||||||
// the .pro file is included in this .pro file
|
// the .pro file is included in this .pro file
|
||||||
// So to compare that later parse with the sync one
|
// So to compare that later parse with the sync one
|
||||||
|
Qt4ProFileNode *proFileNode = static_cast<Qt4ProFileNode *>(*existingIt);
|
||||||
|
// TODO that could be made faster...
|
||||||
|
proFileNode->setIncludedInExactParse(exactSubdirs.contains(proFileNode->path()) && includedInExactParse());
|
||||||
if (async)
|
if (async)
|
||||||
static_cast<Qt4ProFileNode *>(*existingIt)->asyncUpdate();
|
proFileNode->asyncUpdate();
|
||||||
else
|
else
|
||||||
static_cast<Qt4ProFileNode *>(*existingIt)->update();
|
proFileNode->update();
|
||||||
}
|
}
|
||||||
++existingIt;
|
++existingIt;
|
||||||
// newCumalativeIt and newExactIt are already incremented
|
// newCumalativeIt and newExactIt are already incremented
|
||||||
@@ -1752,11 +1782,13 @@ void Qt4ProFileNode::applyEvaluate(EvalResult evalResult, bool async)
|
|||||||
} else if (fileExact || fileCumlative) {
|
} else if (fileExact || fileCumlative) {
|
||||||
Qt4PriFileNode *qt4PriFileNode = new Qt4PriFileNode(m_project, this, nodeToAdd);
|
Qt4PriFileNode *qt4PriFileNode = new Qt4PriFileNode(m_project, this, nodeToAdd);
|
||||||
qt4PriFileNode->setParentFolderNode(this); // Needed for loop detection
|
qt4PriFileNode->setParentFolderNode(this); // Needed for loop detection
|
||||||
|
qt4PriFileNode->setIncludedInExactParse(fileExact != 0 && includedInExactParse());
|
||||||
qt4PriFileNode->update(fileExact, m_readerExact, fileCumlative, m_readerCumulative);
|
qt4PriFileNode->update(fileExact, m_readerExact, fileCumlative, m_readerCumulative);
|
||||||
toAdd << qt4PriFileNode;
|
toAdd << qt4PriFileNode;
|
||||||
} else {
|
} else {
|
||||||
Qt4ProFileNode *qt4ProFileNode = new Qt4ProFileNode(m_project, nodeToAdd);
|
Qt4ProFileNode *qt4ProFileNode = new Qt4ProFileNode(m_project, nodeToAdd);
|
||||||
qt4ProFileNode->setParentFolderNode(this); // Needed for loop detection
|
qt4ProFileNode->setParentFolderNode(this); // Needed for loop detection
|
||||||
|
qt4ProFileNode->setIncludedInExactParse(exactSubdirs.contains(qt4ProFileNode->path()) && includedInExactParse());
|
||||||
if (async)
|
if (async)
|
||||||
qt4ProFileNode->asyncUpdate();
|
qt4ProFileNode->asyncUpdate();
|
||||||
else
|
else
|
||||||
|
@@ -151,7 +151,13 @@ public:
|
|||||||
bool deploysFolder(const QString &folder) const;
|
bool deploysFolder(const QString &folder) const;
|
||||||
QList<ProjectExplorer::RunConfiguration *> runConfigurationsFor(Node *node);
|
QList<ProjectExplorer::RunConfiguration *> runConfigurationsFor(Node *node);
|
||||||
|
|
||||||
|
QList<Qt4PriFileNode*> subProjectNodesExact() const;
|
||||||
|
|
||||||
|
// Set by parent
|
||||||
|
bool includedInExactParse() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void setIncludedInExactParse(bool b);
|
||||||
void clear();
|
void clear();
|
||||||
static QStringList varNames(FileType type);
|
static QStringList varNames(FileType type);
|
||||||
static QStringList dynamicVarNames(QtSupport::ProFileReader *readerExact, QtSupport::ProFileReader *readerCumulative);
|
static QStringList dynamicVarNames(QtSupport::ProFileReader *readerExact, QtSupport::ProFileReader *readerCumulative);
|
||||||
@@ -197,6 +203,7 @@ private:
|
|||||||
QMap<ProjectExplorer::FileType, QSet<QString> > m_files;
|
QMap<ProjectExplorer::FileType, QSet<QString> > m_files;
|
||||||
QSet<QString> m_recursiveEnumerateFiles;
|
QSet<QString> m_recursiveEnumerateFiles;
|
||||||
QSet<QString> m_watchedFolders;
|
QSet<QString> m_watchedFolders;
|
||||||
|
bool m_includedInExactParse;
|
||||||
|
|
||||||
// managed by Qt4ProFileNode
|
// managed by Qt4ProFileNode
|
||||||
friend class Qt4ProjectManager::Qt4ProFileNode;
|
friend class Qt4ProjectManager::Qt4ProFileNode;
|
||||||
|
Reference in New Issue
Block a user