Commit aab634ff authored by Christian Stenger's avatar Christian Stenger Committed by Eike Ziller

Revert "Qmake: Make finding pro-files fast"

The patch broke defining the correct executable for qmake based
projects. Loading more complex projects (like QC itself) did
end up failing to run any executable out of the box as the
executable name was always wrong.
This reverts commit 21b0e7c3.

Change-Id: I471c9963bd739b74e48286e1bde00f7222b90c8b
Reviewed-by: Eike Ziller's avatarEike Ziller <eike.ziller@qt.io>
parent bacfc28a
...@@ -44,21 +44,20 @@ namespace QmakeProjectManager { ...@@ -44,21 +44,20 @@ namespace QmakeProjectManager {
*/ */
QmakePriFileNode::QmakePriFileNode(QmakeProject *project, QmakeProFileNode *qmakeProFileNode, QmakePriFileNode::QmakePriFileNode(QmakeProject *project, QmakeProFileNode *qmakeProFileNode,
const FileName &filePath, QmakePriFile *pf) : const FileName &filePath) :
ProjectNode(filePath), ProjectNode(filePath),
m_project(project), m_project(project),
m_qmakeProFileNode(qmakeProFileNode), m_qmakeProFileNode(qmakeProFileNode)
m_qmakePriFile(pf)
{ } { }
QmakePriFile *QmakePriFileNode::priFile() const QmakePriFile *QmakePriFileNode::priFile() const
{ {
return m_qmakePriFile; return m_project->rootProFile()->findPriFile(filePath());
} }
bool QmakePriFileNode::deploysFolder(const QString &folder) const bool QmakePriFileNode::deploysFolder(const QString &folder) const
{ {
const QmakePriFile *pri = priFile(); QmakePriFile *pri = priFile();
return pri ? pri->deploysFolder(folder) : false; return pri ? pri->deploysFolder(folder) : false;
} }
...@@ -146,7 +145,7 @@ bool QmakePriFileNode::supportsAction(ProjectAction action, const Node *node) co ...@@ -146,7 +145,7 @@ bool QmakePriFileNode::supportsAction(ProjectAction action, const Node *node) co
bool QmakePriFileNode::canAddSubProject(const QString &proFilePath) const bool QmakePriFileNode::canAddSubProject(const QString &proFilePath) const
{ {
const QmakePriFile *pri = priFile(); QmakePriFile *pri = priFile();
return pri ? pri->canAddSubProject(proFilePath) : false; return pri ? pri->canAddSubProject(proFilePath) : false;
} }
...@@ -214,8 +213,8 @@ QmakeProFileNode *QmakeProFileNode::findProFileFor(const FileName &fileName) con ...@@ -214,8 +213,8 @@ QmakeProFileNode *QmakeProFileNode::findProFileFor(const FileName &fileName) con
\class QmakeProFileNode \class QmakeProFileNode
Implements abstract ProjectNode class Implements abstract ProjectNode class
*/ */
QmakeProFileNode::QmakeProFileNode(QmakeProject *project, const FileName &filePath, QmakeProFile *pf) : QmakeProFileNode::QmakeProFileNode(QmakeProject *project, const FileName &filePath) :
QmakePriFileNode(project, this, filePath, pf) QmakePriFileNode(project, this, filePath)
{ } { }
bool QmakeProFileNode::showInSimpleTree() const bool QmakeProFileNode::showInSimpleTree() const
...@@ -225,7 +224,7 @@ bool QmakeProFileNode::showInSimpleTree() const ...@@ -225,7 +224,7 @@ bool QmakeProFileNode::showInSimpleTree() const
QmakeProFile *QmakeProFileNode::proFile() const QmakeProFile *QmakeProFileNode::proFile() const
{ {
return static_cast<QmakeProFile*>(QmakePriFileNode::priFile()); return m_project->rootProFile()->findProFile(filePath());
} }
FolderNode::AddNewInformation QmakeProFileNode::addNewInformation(const QStringList &files, Node *context) const FolderNode::AddNewInformation QmakeProFileNode::addNewInformation(const QStringList &files, Node *context) const
......
...@@ -42,7 +42,7 @@ class QMAKEPROJECTMANAGER_EXPORT QmakePriFileNode : public ProjectExplorer::Proj ...@@ -42,7 +42,7 @@ class QMAKEPROJECTMANAGER_EXPORT QmakePriFileNode : public ProjectExplorer::Proj
{ {
public: public:
QmakePriFileNode(QmakeProject *project, QmakeProFileNode *qmakeProFileNode, QmakePriFileNode(QmakeProject *project, QmakeProFileNode *qmakeProFileNode,
const Utils::FileName &filePath, QmakePriFile *pf); const Utils::FileName &filePath);
QmakePriFile *priFile() const; QmakePriFile *priFile() const;
...@@ -73,14 +73,13 @@ protected: ...@@ -73,14 +73,13 @@ protected:
private: private:
QmakeProFileNode *m_qmakeProFileNode = nullptr; QmakeProFileNode *m_qmakeProFileNode = nullptr;
QmakePriFile *m_qmakePriFile = nullptr;
}; };
// Implements ProjectNode for qmake .pro files // Implements ProjectNode for qmake .pro files
class QMAKEPROJECTMANAGER_EXPORT QmakeProFileNode : public QmakePriFileNode class QMAKEPROJECTMANAGER_EXPORT QmakeProFileNode : public QmakePriFileNode
{ {
public: public:
QmakeProFileNode(QmakeProject *project, const Utils::FileName &filePath, QmakeProFile *pf); QmakeProFileNode(QmakeProject *project, const Utils::FileName &filePath);
QmakeProFile *proFile() const; QmakeProFile *proFile() const;
......
...@@ -183,12 +183,12 @@ static void createTree(const QmakePriFile *pri, QmakePriFileNode *node, const Fi ...@@ -183,12 +183,12 @@ static void createTree(const QmakePriFile *pri, QmakePriFileNode *node, const Fi
} }
// Virtual folders: // Virtual folders:
for (QmakePriFile *c : pri->children()) { for (const QmakePriFile *c : pri->children()) {
QmakePriFileNode *newNode = nullptr; QmakePriFileNode *newNode = nullptr;
if (auto pf = dynamic_cast<QmakeProFile *>(c)) if (dynamic_cast<const QmakeProFile *>(c))
newNode = new QmakeProFileNode(c->project(), c->filePath(), pf); newNode = new QmakeProFileNode(c->project(), c->filePath());
else else
newNode = new QmakePriFileNode(c->project(), node->proFileNode(), c->filePath(), c); newNode = new QmakePriFileNode(c->project(), node->proFileNode(), c->filePath());
createTree(c, newNode, toExclude); createTree(c, newNode, toExclude);
node->addNode(newNode); node->addNode(newNode);
} }
...@@ -203,7 +203,7 @@ QmakeProFileNode *QmakeNodeTreeBuilder::buildTree(QmakeProject *project) ...@@ -203,7 +203,7 @@ QmakeProFileNode *QmakeNodeTreeBuilder::buildTree(QmakeProject *project)
const FileNameList toExclude = qt ? qt->directoriesToIgnoreInProjectTree() : FileNameList(); const FileNameList toExclude = qt ? qt->directoriesToIgnoreInProjectTree() : FileNameList();
auto root = new QmakeProFileNode(project, project->projectFilePath(), project->rootProFile()); auto root = new QmakeProFileNode(project, project->projectFilePath());
createTree(project->rootProFile(), root, toExclude); createTree(project->rootProFile(), root, toExclude);
return root; return root;
......
...@@ -199,14 +199,12 @@ QmakePriFile *QmakePriFile::findPriFile(const FileName &fileName) ...@@ -199,14 +199,12 @@ QmakePriFile *QmakePriFile::findPriFile(const FileName &fileName)
{ {
if (fileName == filePath()) if (fileName == filePath())
return this; return this;
return findOrDefault(m_children, [&fileName](QmakePriFile *pf) { return pf->findPriFile(fileName); }); for (QmakePriFile *n : children()) {
} if (QmakePriFile *result = n->findPriFile(fileName))
return result;
}
return nullptr;
const QmakePriFile *QmakePriFile::findPriFile(const FileName &fileName) const
{
if (fileName == filePath())
return this;
return findOrDefault(m_children, [&fileName](const QmakePriFile *pf) { return pf->findPriFile(fileName); });
} }
void QmakePriFile::makeEmpty() void QmakePriFile::makeEmpty()
...@@ -1012,11 +1010,6 @@ QmakeProFile *QmakeProFile::findProFile(const FileName &fileName) ...@@ -1012,11 +1010,6 @@ QmakeProFile *QmakeProFile::findProFile(const FileName &fileName)
return dynamic_cast<QmakeProFile *>(findPriFile(fileName)); return dynamic_cast<QmakeProFile *>(findPriFile(fileName));
} }
const QmakeProFile *QmakeProFile::findProFile(const FileName &fileName) const
{
return dynamic_cast<const QmakeProFile *>(findPriFile(fileName));
}
QString QmakeProFile::makefile() const QString QmakeProFile::makefile() const
{ {
return singleVariableValue(Variable::Makefile); return singleVariableValue(Variable::Makefile);
......
...@@ -121,7 +121,6 @@ public: ...@@ -121,7 +121,6 @@ public:
QVector<QmakePriFile *> children() const; QVector<QmakePriFile *> children() const;
QmakePriFile *findPriFile(const Utils::FileName &fileName); QmakePriFile *findPriFile(const Utils::FileName &fileName);
const QmakePriFile *findPriFile(const Utils::FileName &fileName) const;
bool knowsFile(const Utils::FileName &filePath) const; bool knowsFile(const Utils::FileName &filePath) const;
...@@ -281,7 +280,6 @@ public: ...@@ -281,7 +280,6 @@ public:
QList<QmakeProFile *> allProFiles(); QList<QmakeProFile *> allProFiles();
QmakeProFile *findProFile(const Utils::FileName &fileName); QmakeProFile *findProFile(const Utils::FileName &fileName);
const QmakeProFile *findProFile(const Utils::FileName &fileName) const;
ProjectType projectType() const; ProjectType projectType() const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment