QbsProjectManager: Fix object files appearing in locator

This bug got re-introduced by commit fc5ce1e710.

Task-number: QTCREATORBUG-17382
Change-Id: I6114ca8f4305b3c0e356f4849094ecb1ccca7601
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Christian Kandeler
2017-05-05 15:59:59 +02:00
parent d056df2c15
commit 63e395c876
2 changed files with 18 additions and 3 deletions

View File

@@ -149,6 +149,8 @@ public:
static bool sortByPath(const Node *a, const Node *b);
void setParentFolderNode(FolderNode *parentFolder);
void setListInProject(bool l);
static FileType fileTypeForMimeType(const Utils::MimeType &mt);
static FileType fileTypeForFileName(const Utils::FileName &file);
@@ -156,7 +158,6 @@ protected:
Node(NodeType nodeType, const Utils::FileName &filePath, int line = -1);
void setPriority(int priority);
void setListInProject(bool l);
void setIsGenerated(bool g);
private:

View File

@@ -59,9 +59,23 @@ void setupArtifacts(ProjectExplorer::FolderNode *root, const QList<qbs::Artifact
const Utils::FileName path = Utils::FileName::fromString(ad.filePath());
const ProjectExplorer::FileType type = fileType(ad);
const bool isGenerated = ad.isGenerated();
root->addNestedNode(new ProjectExplorer::FileNode(path, type, isGenerated));
};
// A list of human-readable file types that we can reasonably expect
// to get generated during a build. Extend as needed.
static const QSet<QString> sourceTags = {
QLatin1String("c"), QLatin1String("cpp"), QLatin1String("hpp"),
QLatin1String("objc"), QLatin1String("objcpp"),
QLatin1String("c_pch_src"), QLatin1String("cpp_pch_src"),
QLatin1String("objc_pch_src"), QLatin1String("objcpp_pch_src"),
QLatin1String("asm"), QLatin1String("asm_cpp"),
QLatin1String("linkerscript"),
QLatin1String("qrc"), QLatin1String("java.java")
};
ProjectExplorer::FileNode * const node
= new ProjectExplorer::FileNode(path, type, isGenerated);
node->setListInProject(!isGenerated || ad.fileTags().toSet().intersects(sourceTags));
root->addNestedNode(node);
}
root->compress();
}