Commit 56414c0c authored by Tobias Hunger's avatar Tobias Hunger

Clean up after qmake

Remove dummy files that qmake litters into the project tree.

Task-number: QTCREATORBUG-17675
Change-Id: I74ec4443e76b40eaeae2c746d25c38b4acf9e92b
Reviewed-by: Tim Jenssen's avatarTim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Oswald Buddenhagen's avatarOswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Eike Ziller's avatarEike Ziller <eike.ziller@qt.io>
parent 92918158
......@@ -29,6 +29,9 @@
#include <coreplugin/fileiconprovider.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtkitinformation.h>
#include <resourceeditor/resourcenode.h>
#include <utils/algorithm.h>
......@@ -39,6 +42,7 @@
using namespace Core;
using namespace ProjectExplorer;
using namespace QtSupport;
using namespace Utils;
namespace {
......@@ -135,7 +139,7 @@ void clearQmakeStaticData()
namespace QmakeProjectManager {
static void createTree(const QmakePriFile *pri, QmakePriFileNode *node)
static void createTree(const QmakePriFile *pri, QmakePriFileNode *node, const FileNameList &toExclude)
{
QTC_ASSERT(pri, return);
QTC_ASSERT(node, return);
......@@ -150,7 +154,9 @@ static void createTree(const QmakePriFile *pri, QmakePriFileNode *node)
const QVector<QmakeStaticData::FileTypeData> &fileTypes = qmakeStaticData()->fileTypeData;
for (int i = 0; i < fileTypes.size(); ++i) {
FileType type = fileTypes.at(i).type;
const QSet<FileName> &newFilePaths = pri->files(type);
const QSet<FileName> &newFilePaths = Utils::filtered(pri->files(type), [&toExclude](const Utils::FileName &fn) {
return !Utils::contains(toExclude, [&fn](const Utils::FileName &ex) { return fn.isChildOf(ex); });
});
if (!newFilePaths.isEmpty()) {
auto vfolder = new VirtualFolderNode(pri->filePath().parentDir(), Node::DefaultVirtualFolderPriority - i);
......@@ -189,15 +195,22 @@ static void createTree(const QmakePriFile *pri, QmakePriFileNode *node)
newNode = new QmakeProFileNode(c->project(), c->filePath());
else
newNode = new QmakePriFileNode(c->project(), node->proFileNode(), c->filePath());
createTree(c, newNode);
createTree(c, newNode, toExclude);
node->addNode(newNode);
}
}
QmakeProFileNode *QmakeNodeTreeBuilder::buildTree(QmakeProject *project)
{
// Remove qmake implementation details that litter up the project data:
Target *t = project->activeTarget();
Kit *k = t ? t->kit() : nullptr;
BaseQtVersion *qt = k ? QtKitInformation::qtVersion(k) : nullptr;
const FileNameList toExclude = qt ? qt->directoriesToIgnoreInProjectTree() : FileNameList();
auto root = new QmakeProFileNode(project, project->projectFilePath());
createTree(project->rootProFile(), root);
createTree(project->rootProFile(), root, toExclude);
return root;
}
......
......@@ -570,6 +570,22 @@ FileName BaseQtVersion::mkspecsPath() const
return result;
}
FileNameList BaseQtVersion::directoriesToIgnoreInProjectTree() const
{
FileNameList result;
const FileName mkspecPathGet = mkspecsPath();
result.append(mkspecPathGet);
FileName mkspecPathSrc = FileName::fromUserInput(qmakeProperty("QT_HOST_DATA", PropertyVariantSrc));
if (!mkspecPathSrc.isEmpty()) {
mkspecPathSrc.appendPath("mkspecs");
if (mkspecPathSrc != mkspecPathGet)
result.append(mkspecPathSrc);
}
return result;
}
QString BaseQtVersion::qtNamespace() const
{
ensureMkSpecParsed();
......
......@@ -212,6 +212,8 @@ public:
Utils::FileName binPath() const;
Utils::FileName mkspecsPath() const;
Utils::FileNameList directoriesToIgnoreInProjectTree() const;
QString qtNamespace() const;
QString qtLibInfix() const;
bool isFrameworkBuild() 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