diff options
author | hjk <hjk@qt.io> | 2020-03-02 18:34:12 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2020-03-03 09:17:20 +0000 |
commit | b0b50257ecbac450d74982e600f0586e507c8fd2 (patch) | |
tree | ad108ea7e7b9dd7501fe966d64690f788199a6cc /src/plugins | |
parent | 757628bf4a4a323d580f05e2362ebeed3415603b (diff) |
ProjectExplorer: Pass extra project files as QSet
They are available in some cases as such, and consumed as such.
Change-Id: I9866c7d7bd817fb19a8b11a0efbe583ed55fe393
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins')
14 files changed, 22 insertions, 22 deletions
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsbuildsystem.cpp b/src/plugins/autotoolsprojectmanager/autotoolsbuildsystem.cpp index 2345a89076..a6cacabaa2 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsbuildsystem.cpp +++ b/src/plugins/autotoolsprojectmanager/autotoolsbuildsystem.cpp @@ -110,7 +110,7 @@ void AutotoolsBuildSystem::makefileParsingFinished() m_files.clear(); - QVector<Utils::FilePath> filesToWatch; + QSet<Utils::FilePath> filesToWatch; // Apply sources to m_files, which are returned at AutotoolsBuildSystem::files() const QFileInfo fileInfo = projectFilePath().toFileInfo(); @@ -127,7 +127,7 @@ void AutotoolsBuildSystem::makefileParsingFinished() m_files.append(absMakefile); - filesToWatch.append(Utils::FilePath::fromString(absMakefile)); + filesToWatch.insert(Utils::FilePath::fromString(absMakefile)); } // Add configure.ac file to project and watch for changes. @@ -137,7 +137,7 @@ void AutotoolsBuildSystem::makefileParsingFinished() const QString absConfigureAc = dir.absoluteFilePath(configureAc); m_files.append(absConfigureAc); - filesToWatch.append(Utils::FilePath::fromString(absConfigureAc)); + filesToWatch.insert(Utils::FilePath::fromString(absConfigureAc)); } auto newRoot = std::make_unique<ProjectNode>(project()->projectDirectory()); diff --git a/src/plugins/cmakeprojectmanager/builddirmanager.cpp b/src/plugins/cmakeprojectmanager/builddirmanager.cpp index d4d90a7a94..75790bee87 100644 --- a/src/plugins/cmakeprojectmanager/builddirmanager.cpp +++ b/src/plugins/cmakeprojectmanager/builddirmanager.cpp @@ -390,7 +390,7 @@ void BuildDirManager::parse() reparseParameters & REPARSE_FORCE_CONFIGURATION); } -QVector<FilePath> BuildDirManager::takeProjectFilesToWatch() +QSet<FilePath> BuildDirManager::projectFilesToWatch() const { QTC_ASSERT(!m_isHandlingError, return {}); QTC_ASSERT(m_reader, return {}); @@ -398,7 +398,7 @@ QVector<FilePath> BuildDirManager::takeProjectFilesToWatch() Utils::FilePath sourceDir = m_parameters.sourceDirectory; Utils::FilePath buildDir = m_parameters.workDirectory; - return Utils::filtered(m_reader->takeProjectFilesToWatch(), + return Utils::filtered(m_reader->projectFilesToWatch(), [&sourceDir, &buildDir](const Utils::FilePath &p) { return p.isChildOf(sourceDir) diff --git a/src/plugins/cmakeprojectmanager/builddirmanager.h b/src/plugins/cmakeprojectmanager/builddirmanager.h index 00085952a3..3138b24a81 100644 --- a/src/plugins/cmakeprojectmanager/builddirmanager.h +++ b/src/plugins/cmakeprojectmanager/builddirmanager.h @@ -89,7 +89,7 @@ public: bool isFilesystemScanRequested() const; void parse(); - QVector<Utils::FilePath> takeProjectFilesToWatch(); + QSet<Utils::FilePath> projectFilesToWatch() const; std::unique_ptr<CMakeProjectNode> generateProjectTree(const QList<const ProjectExplorer::FileNode *> &allFiles, QString &errorMessage) const; ProjectExplorer::RawProjectParts createRawProjectParts(QString &errorMessage) const; diff --git a/src/plugins/cmakeprojectmanager/builddirreader.h b/src/plugins/cmakeprojectmanager/builddirreader.h index bd04f5676d..71b5edb974 100644 --- a/src/plugins/cmakeprojectmanager/builddirreader.h +++ b/src/plugins/cmakeprojectmanager/builddirreader.h @@ -63,7 +63,7 @@ public: virtual bool isParsing() const = 0; - virtual QVector<Utils::FilePath> takeProjectFilesToWatch() = 0; + virtual QSet<Utils::FilePath> projectFilesToWatch() const = 0; virtual QList<CMakeBuildTarget> takeBuildTargets(QString &errorMessage) = 0; virtual CMakeConfig takeParsedConfiguration(QString &errorMessage) = 0; virtual std::unique_ptr<CMakeProjectNode> generateProjectTree( diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp index 2045a84cd2..c346e368ef 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp @@ -409,7 +409,7 @@ void CMakeBuildSystem::updateProjectData() QTC_ASSERT(m_treeScanner.isFinished() && !m_buildDirManager.isParsing(), return); - m_buildConfiguration->project()->setExtraProjectFiles(m_buildDirManager.takeProjectFilesToWatch()); + m_buildConfiguration->project()->setExtraProjectFiles(m_buildDirManager.projectFilesToWatch()); CMakeConfig patchedConfig = m_buildConfiguration->configurationFromCMake(); { diff --git a/src/plugins/cmakeprojectmanager/fileapireader.cpp b/src/plugins/cmakeprojectmanager/fileapireader.cpp index 83a81f2a70..089354dc80 100644 --- a/src/plugins/cmakeprojectmanager/fileapireader.cpp +++ b/src/plugins/cmakeprojectmanager/fileapireader.cpp @@ -164,9 +164,9 @@ bool FileApiReader::isParsing() const return m_isParsing; } -QVector<FilePath> FileApiReader::takeProjectFilesToWatch() +QSet<FilePath> FileApiReader::projectFilesToWatch() const { - return QVector<FilePath>::fromList(Utils::toList(m_cmakeFiles)); + return m_cmakeFiles; } QList<CMakeBuildTarget> FileApiReader::takeBuildTargets(QString &errorMessage){ diff --git a/src/plugins/cmakeprojectmanager/fileapireader.h b/src/plugins/cmakeprojectmanager/fileapireader.h index 2d0c1a5809..560aafc779 100644 --- a/src/plugins/cmakeprojectmanager/fileapireader.h +++ b/src/plugins/cmakeprojectmanager/fileapireader.h @@ -62,7 +62,7 @@ public: bool isParsing() const final; - QVector<Utils::FilePath> takeProjectFilesToWatch() final; + QSet<Utils::FilePath> projectFilesToWatch() const final; QList<CMakeBuildTarget> takeBuildTargets(QString &errorMessage) final; CMakeConfig takeParsedConfiguration(QString &errorMessage) final; std::unique_ptr<CMakeProjectNode> generateProjectTree( diff --git a/src/plugins/cmakeprojectmanager/servermodereader.h b/src/plugins/cmakeprojectmanager/servermodereader.h index dbf91b2529..3910df1778 100644 --- a/src/plugins/cmakeprojectmanager/servermodereader.h +++ b/src/plugins/cmakeprojectmanager/servermodereader.h @@ -55,7 +55,7 @@ public: bool isParsing() const final; - QVector<Utils::FilePath> takeProjectFilesToWatch() final { return {}; }; + QSet<Utils::FilePath> projectFilesToWatch() const final { return {}; }; QList<CMakeBuildTarget> takeBuildTargets(QString &errorMessage) final; CMakeConfig takeParsedConfiguration(QString &errorMessage) final; std::unique_ptr<CMakeProjectNode> generateProjectTree( diff --git a/src/plugins/cmakeprojectmanager/tealeafreader.cpp b/src/plugins/cmakeprojectmanager/tealeafreader.cpp index 31f13234a6..8b03b33f60 100644 --- a/src/plugins/cmakeprojectmanager/tealeafreader.cpp +++ b/src/plugins/cmakeprojectmanager/tealeafreader.cpp @@ -160,9 +160,9 @@ bool TeaLeafReader::isParsing() const return m_cmakeProcess && m_cmakeProcess->state() != QProcess::NotRunning; } -QVector<FilePath> TeaLeafReader::takeProjectFilesToWatch() +QSet<FilePath> TeaLeafReader::projectFilesToWatch() const { - return transform<QVector>(m_cmakeFiles, [](const FilePath &p) { return p; }); + return m_cmakeFiles; } QList<CMakeBuildTarget> TeaLeafReader::takeBuildTargets(QString &errorMessage) diff --git a/src/plugins/cmakeprojectmanager/tealeafreader.h b/src/plugins/cmakeprojectmanager/tealeafreader.h index b8dd999635..ae77afc47c 100644 --- a/src/plugins/cmakeprojectmanager/tealeafreader.h +++ b/src/plugins/cmakeprojectmanager/tealeafreader.h @@ -54,7 +54,7 @@ public: bool isParsing() const final; - QVector<Utils::FilePath> takeProjectFilesToWatch() final; + QSet<Utils::FilePath> projectFilesToWatch() const final; QList<CMakeBuildTarget> takeBuildTargets(QString &errorMessage) final; CMakeConfig takeParsedConfiguration(QString &errorMessage) final; std::unique_ptr<CMakeProjectNode> generateProjectTree( diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp index 5e511fceda..f338b3bfaf 100644 --- a/src/plugins/projectexplorer/project.cpp +++ b/src/plugins/projectexplorer/project.cpp @@ -354,9 +354,9 @@ void Project::setNeedsInitialExpansion(bool needsExpansion) d->m_needsInitialExpansion = needsExpansion; } -void Project::setExtraProjectFiles(const QVector<Utils::FilePath> &projectDocumentPaths) +void Project::setExtraProjectFiles(const QSet<Utils::FilePath> &projectDocumentPaths) { - QSet<Utils::FilePath> uniqueNewFiles = Utils::toSet(projectDocumentPaths); + QSet<Utils::FilePath> uniqueNewFiles = projectDocumentPaths; uniqueNewFiles.remove(projectFilePath()); // Make sure to never add the main project file! QSet<Utils::FilePath> existingWatches = Utils::transform<QSet>(d->m_extraProjectDocuments, diff --git a/src/plugins/projectexplorer/project.h b/src/plugins/projectexplorer/project.h index 5fb9c3ad8e..b93e273a06 100644 --- a/src/plugins/projectexplorer/project.h +++ b/src/plugins/projectexplorer/project.h @@ -164,7 +164,7 @@ public: // Set project files that will be watched and trigger the same callback // as the main project file. - void setExtraProjectFiles(const QVector<Utils::FilePath> &projectDocumentPaths); + void setExtraProjectFiles(const QSet<Utils::FilePath> &projectDocumentPaths); void setDisplayName(const QString &name); void setProjectLanguage(Core::Id id, bool enabled); diff --git a/src/plugins/qbsprojectmanager/qbsproject.cpp b/src/plugins/qbsprojectmanager/qbsproject.cpp index 090bfae0af..f0de5fe952 100644 --- a/src/plugins/qbsprojectmanager/qbsproject.cpp +++ b/src/plugins/qbsprojectmanager/qbsproject.cpp @@ -700,13 +700,13 @@ void QbsBuildSystem::updateDocuments() OpTimer opTimer("updateDocuments"); const FilePath buildDir = FilePath::fromString( m_projectData.value("build-directory").toString()); - const auto filePaths = transform<QVector<FilePath>>( + const auto filePaths = transform<QSet<FilePath>>( m_projectData.value("build-system-files").toArray(), [](const QJsonValue &v) { return FilePath::fromString(v.toString()); }); // A changed qbs file (project, module etc) should trigger a re-parse, but not if // the file was generated by qbs itself, in which case that might cause an infinite loop. - const QVector<FilePath> nonBuildDirFilePaths = filtered(filePaths, + const QSet<FilePath> nonBuildDirFilePaths = filtered(filePaths, [buildDir](const FilePath &p) { return !p.isChildOf(buildDir); }); diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp index e337f84ed5..58e7b48d87 100644 --- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp @@ -263,9 +263,9 @@ void QmakeBuildSystem::updateCodeModels() void QmakeBuildSystem::updateDocuments() { - QVector<FilePath> projectDocuments; + QSet<FilePath> projectDocuments; project()->rootProjectNode()->forEachProjectNode([&projectDocuments](const ProjectNode *n) { - projectDocuments << n->filePath(); + projectDocuments.insert(n->filePath()); }); project()->setExtraProjectFiles(projectDocuments); } |