forked from qt-creator/qt-creator
Qbs: Show build qbs files not referenced in the products/groups
Show build system files used by Qbs that are part of the project hierarchy in the Projects Pane. Change-Id: Ie7d1f1833fb00376f92c1436bd83e4f0518ae3ac Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
This commit is contained in:
@@ -437,7 +437,7 @@ void QbsGroupNode::updateQbsGroupData(const qbs::GroupData *grp, const QString &
|
||||
emitNodeUpdated();
|
||||
}
|
||||
|
||||
void QbsGroupNode::setupFiles(QbsBaseProjectNode *root, const QStringList &files,
|
||||
void QbsGroupNode::setupFiles(ProjectExplorer::FolderNode *root, const QStringList &files,
|
||||
const QString &productPath, bool updateExisting)
|
||||
{
|
||||
// Build up a tree of nodes:
|
||||
@@ -797,17 +797,53 @@ QbsProjectNode *QbsProjectNode::findProjectNode(const QString &name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// QbsRootProjectNode:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
QbsRootProjectNode::QbsRootProjectNode(QbsProject *project) :
|
||||
QbsProjectNode(project->projectFilePath().toString()),
|
||||
m_project(project)
|
||||
m_project(project),
|
||||
m_buildSystemFiles(new ProjectExplorer::FolderNode(project->projectDirectory().toString()))
|
||||
{
|
||||
m_buildSystemFiles->setDisplayName(tr("Qbs files"));
|
||||
addFolderNodes(QList<FolderNode *>() << m_buildSystemFiles);
|
||||
}
|
||||
|
||||
void QbsRootProjectNode::update()
|
||||
{
|
||||
QStringList buildSystemFiles = unreferencedBuildSystemFiles(m_project->qbsProject());
|
||||
|
||||
QStringList projectBuildSystemFiles;
|
||||
Utils::FileName base = m_project->projectDirectory();
|
||||
foreach (const QString &f, buildSystemFiles) {
|
||||
if (Utils::FileName::fromString(f).isChildOf(base))
|
||||
projectBuildSystemFiles.append(f);
|
||||
}
|
||||
QbsGroupNode::setupFiles(m_buildSystemFiles, projectBuildSystemFiles, base.toString(), false);
|
||||
|
||||
update(m_project->qbsProjectData());
|
||||
}
|
||||
|
||||
static QSet<QString> referencedBuildSystemFiles(const qbs::ProjectData &data)
|
||||
{
|
||||
QSet<QString> result;
|
||||
result.insert(data.location().fileName());
|
||||
foreach (const qbs::ProjectData &subProject, data.subProjects())
|
||||
result.unite(referencedBuildSystemFiles(subProject));
|
||||
foreach (const qbs::ProductData &product, data.products()) {
|
||||
result.insert(product.location().fileName());
|
||||
foreach (const qbs::GroupData &group, product.groups())
|
||||
result.insert(group.location().fileName());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
QStringList QbsRootProjectNode::unreferencedBuildSystemFiles(const qbs::Project &p) const
|
||||
{
|
||||
return p.buildSystemFiles().subtract(referencedBuildSystemFiles(p.projectData())).toList();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QbsProjectManager
|
||||
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
|
||||
QString productPath() const;
|
||||
|
||||
static void setupFiles(QbsBaseProjectNode *root, const QStringList &files,
|
||||
static void setupFiles(FolderNode *root, const QStringList &files,
|
||||
const QString &productPath, bool updateExisting);
|
||||
|
||||
private:
|
||||
@@ -184,6 +184,10 @@ private:
|
||||
static QIcon m_projectIcon;
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// QbsRootProjectNode:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
class QbsRootProjectNode : public QbsProjectNode
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -197,7 +201,10 @@ public:
|
||||
QbsProject *project() const { return m_project; }
|
||||
|
||||
private:
|
||||
QStringList unreferencedBuildSystemFiles(const qbs::Project &p) const;
|
||||
|
||||
QbsProject * const m_project;
|
||||
ProjectExplorer::FolderNode *m_buildSystemFiles;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user