From f94e55b80790807a8357f50ee62751d88f80910a Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 26 Jun 2019 18:04:47 +0200 Subject: [PATCH] ProjectExplorer: Align signatures of BuildConfiguration ... availableBuilds() and availableSetups(). Goal is to merge them and inline all the local createBuildInfo() functions. Change-Id: I9f19093163808b6da6dc83977894420e08a1edd9 Reviewed-by: Christian Kandeler --- .../autotoolsbuildconfiguration.cpp | 4 ++-- .../autotoolsbuildconfiguration.h | 3 ++- .../cmakeprojectmanager/cmakebuildconfiguration.cpp | 7 ++++--- .../cmakeprojectmanager/cmakebuildconfiguration.h | 3 ++- .../compilationdatabaseproject.cpp | 5 ++--- .../compilationdatabaseproject.h | 2 +- .../genericprojectmanager/genericbuildconfiguration.cpp | 5 +++-- .../genericprojectmanager/genericbuildconfiguration.h | 3 ++- src/plugins/nim/project/nimbuildconfiguration.cpp | 4 ++-- src/plugins/nim/project/nimbuildconfiguration.h | 3 ++- src/plugins/projectexplorer/buildconfiguration.cpp | 2 +- src/plugins/projectexplorer/buildconfiguration.h | 3 ++- src/plugins/qbsprojectmanager/qbsbuildconfiguration.cpp | 5 +++-- src/plugins/qbsprojectmanager/qbsbuildconfiguration.h | 3 ++- .../qmakeprojectmanager/qmakebuildconfiguration.cpp | 9 +++------ .../qmakeprojectmanager/qmakebuildconfiguration.h | 3 ++- .../tests/qmlprofilerdetailsrewriter_test.cpp | 3 ++- 17 files changed, 37 insertions(+), 30 deletions(-) diff --git a/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp b/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp index 57f593c37f2..9a9afa158a4 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp +++ b/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp @@ -97,9 +97,9 @@ AutotoolsBuildConfigurationFactory::AutotoolsBuildConfigurationFactory() setSupportedProjectMimeTypeName(Constants::MAKEFILE_MIMETYPE); } -QList AutotoolsBuildConfigurationFactory::availableBuilds(const Target *parent) const +QList AutotoolsBuildConfigurationFactory::availableBuilds(const Kit *k, const FilePath &projectPath) const { - return {createBuildInfo(parent->kit(), parent->project()->projectDirectory())}; + return {createBuildInfo(k, projectPath)}; } QList AutotoolsBuildConfigurationFactory::availableSetups(const Kit *k, const FilePath &projectPath) const diff --git a/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.h b/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.h index a77b0293f8f..f5e83c82790 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.h +++ b/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.h @@ -53,7 +53,8 @@ public: AutotoolsBuildConfigurationFactory(); private: - QList availableBuilds(const ProjectExplorer::Target *parent) const override; + QList availableBuilds(const ProjectExplorer::Kit *k, + const Utils::FilePath &projectPath) const override; QList availableSetups(const ProjectExplorer::Kit *k, const Utils::FilePath &projectPath) const override; diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp index 9ef5db87d31..74e643bfbea 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp @@ -481,13 +481,14 @@ BuildConfiguration::BuildType CMakeBuildConfigurationFactory::cmakeBuildTypeToBu return BuildConfiguration::Unknown; } -QList CMakeBuildConfigurationFactory::availableBuilds(const Target *parent) const +QList + CMakeBuildConfigurationFactory::availableBuilds(const Kit *k, const FilePath &projectPath) const { QList result; for (int type = BuildTypeNone; type != BuildTypeLast; ++type) { - result << createBuildInfo(parent->kit(), - parent->project()->projectDirectory().toString(), + result << createBuildInfo(k, + projectPath.toString(), BuildType(type)); } return result; diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h index 5f725780a9f..5c67908070c 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h +++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h @@ -134,7 +134,8 @@ public: static BuildType buildTypeFromByteArray(const QByteArray &in); static ProjectExplorer::BuildConfiguration::BuildType cmakeBuildTypeToBuildType(const BuildType &in); - QList availableBuilds(const ProjectExplorer::Target *parent) const override; + QList availableBuilds(const ProjectExplorer::Kit *k, + const Utils::FilePath &projectPath) const override; QList availableSetups(const ProjectExplorer::Kit *k, const Utils::FilePath &projectPath) const override; diff --git a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp index f589d9a40a5..95cc20b2c0c 100644 --- a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp +++ b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp @@ -541,13 +541,12 @@ static QList defaultBuildInfos( return buildInfos; } -QList CompilationDatabaseBuildConfigurationFactory::availableBuilds( - const ProjectExplorer::Target * /*parent*/) const +QList CompilationDatabaseBuildConfigurationFactory::availableBuilds(const Kit *, const Utils::FilePath &) const { return defaultBuildInfos(this, tr("Release")); } -QList CompilationDatabaseBuildConfigurationFactory::availableSetups(const ProjectExplorer::Kit * /*k*/, const Utils::FilePath & /*projectPath*/) const +QList CompilationDatabaseBuildConfigurationFactory::availableSetups(const Kit *, const Utils::FilePath &) const { return defaultBuildInfos(this, tr("Release")); } diff --git a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.h b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.h index 2865b331ef3..84754e3dbf6 100644 --- a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.h +++ b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.h @@ -105,7 +105,7 @@ public: CompilationDatabaseBuildConfigurationFactory(); QList availableBuilds( - const ProjectExplorer::Target *parent) const override; + const ProjectExplorer::Kit *k, const Utils::FilePath &projectPath) const override; QList availableSetups( const ProjectExplorer::Kit *k, const Utils::FilePath &projectPath) const override; }; diff --git a/src/plugins/genericprojectmanager/genericbuildconfiguration.cpp b/src/plugins/genericprojectmanager/genericbuildconfiguration.cpp index 0f367faf0cb..3ed467108ff 100644 --- a/src/plugins/genericprojectmanager/genericbuildconfiguration.cpp +++ b/src/plugins/genericprojectmanager/genericbuildconfiguration.cpp @@ -87,9 +87,10 @@ GenericBuildConfigurationFactory::GenericBuildConfigurationFactory() GenericBuildConfigurationFactory::~GenericBuildConfigurationFactory() = default; -QList GenericBuildConfigurationFactory::availableBuilds(const Target *parent) const +QList + GenericBuildConfigurationFactory::availableBuilds(const Kit *k, const FilePath &projectPath) const { - return {createBuildInfo(parent->kit(), parent->project()->projectDirectory())}; + return {createBuildInfo(k, projectPath)}; } QList diff --git a/src/plugins/genericprojectmanager/genericbuildconfiguration.h b/src/plugins/genericprojectmanager/genericbuildconfiguration.h index ae46cfcf340..facb74f1786 100644 --- a/src/plugins/genericprojectmanager/genericbuildconfiguration.h +++ b/src/plugins/genericprojectmanager/genericbuildconfiguration.h @@ -53,7 +53,8 @@ public: ~GenericBuildConfigurationFactory() override; private: - QList availableBuilds(const ProjectExplorer::Target *parent) const override; + QList availableBuilds(const ProjectExplorer::Kit *k, + const Utils::FilePath &projectPath) const override; QList availableSetups(const ProjectExplorer::Kit *k, const Utils::FilePath &projectPath) const override; diff --git a/src/plugins/nim/project/nimbuildconfiguration.cpp b/src/plugins/nim/project/nimbuildconfiguration.cpp index c5874ec6ec6..2d49e8626d8 100644 --- a/src/plugins/nim/project/nimbuildconfiguration.cpp +++ b/src/plugins/nim/project/nimbuildconfiguration.cpp @@ -155,11 +155,11 @@ NimBuildConfigurationFactory::NimBuildConfigurationFactory() setSupportedProjectMimeTypeName(Constants::C_NIM_PROJECT_MIMETYPE); } -QList NimBuildConfigurationFactory::availableBuilds(const Target *parent) const +QList NimBuildConfigurationFactory::availableBuilds(const Kit *k, const FilePath &) const { QList result; for (auto buildType : {BuildConfiguration::Debug, BuildConfiguration::Release}) - result.push_back(createBuildInfo(parent->kit(), buildType)); + result.push_back(createBuildInfo(k, buildType)); return result; } diff --git a/src/plugins/nim/project/nimbuildconfiguration.h b/src/plugins/nim/project/nimbuildconfiguration.h index 2c62fc0ca6b..ba750d67768 100644 --- a/src/plugins/nim/project/nimbuildconfiguration.h +++ b/src/plugins/nim/project/nimbuildconfiguration.h @@ -63,7 +63,8 @@ public: NimBuildConfigurationFactory(); private: - QList availableBuilds(const ProjectExplorer::Target *parent) const override; + QList availableBuilds(const ProjectExplorer::Kit *k, + const Utils::FilePath &projectPath) const override; QList availableSetups(const ProjectExplorer::Kit *k, const Utils::FilePath &projectPath) const override; diff --git a/src/plugins/projectexplorer/buildconfiguration.cpp b/src/plugins/projectexplorer/buildconfiguration.cpp index 1457ee5cf4f..0bea346bf03 100644 --- a/src/plugins/projectexplorer/buildconfiguration.cpp +++ b/src/plugins/projectexplorer/buildconfiguration.cpp @@ -416,7 +416,7 @@ const Tasks BuildConfigurationFactory::reportIssues(ProjectExplorer::Kit *kit, c const QList BuildConfigurationFactory::allAvailableBuilds(const Target *parent) const { - return availableBuilds(parent); + return availableBuilds(parent->kit(), parent->project()->projectFilePath()); } const QList diff --git a/src/plugins/projectexplorer/buildconfiguration.h b/src/plugins/projectexplorer/buildconfiguration.h index cd9e0db7853..d2edce03cd8 100644 --- a/src/plugins/projectexplorer/buildconfiguration.h +++ b/src/plugins/projectexplorer/buildconfiguration.h @@ -157,7 +157,8 @@ public: const QString &projectPath, const QString &buildDir) const; protected: - virtual QList availableBuilds(const Target *parent) const = 0; + virtual QList + availableBuilds(const Kit *k, const Utils::FilePath &projectPath) const = 0; virtual QList availableSetups(const Kit *k, const Utils::FilePath &projectPath) const = 0; diff --git a/src/plugins/qbsprojectmanager/qbsbuildconfiguration.cpp b/src/plugins/qbsprojectmanager/qbsbuildconfiguration.cpp index 32895022dcd..3ebed18a1ca 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildconfiguration.cpp +++ b/src/plugins/qbsprojectmanager/qbsbuildconfiguration.cpp @@ -382,9 +382,10 @@ BuildInfo QbsBuildConfigurationFactory::createBuildInfo(const Kit *k, return info; } -QList QbsBuildConfigurationFactory::availableBuilds(const Target *parent) const +QList + QbsBuildConfigurationFactory::availableBuilds(const Kit *k, const FilePath &) const { - return {createBuildInfo(parent->kit(), BuildConfiguration::Debug)}; + return {createBuildInfo(k, BuildConfiguration::Debug)}; } QList diff --git a/src/plugins/qbsprojectmanager/qbsbuildconfiguration.h b/src/plugins/qbsprojectmanager/qbsbuildconfiguration.h index 91e709e044f..7f3f96c2850 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildconfiguration.h +++ b/src/plugins/qbsprojectmanager/qbsbuildconfiguration.h @@ -92,7 +92,8 @@ class QbsBuildConfigurationFactory : public ProjectExplorer::BuildConfigurationF public: QbsBuildConfigurationFactory(); - QList availableBuilds(const ProjectExplorer::Target *parent) const override; + QList availableBuilds(const ProjectExplorer::Kit *k, + const Utils::FilePath &projectPath) const override; QList availableSetups(const ProjectExplorer::Kit *k, const Utils::FilePath &projectPath) const override; diff --git a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp index df053e1521c..1285cbc8ce1 100644 --- a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp +++ b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp @@ -665,15 +665,12 @@ static const QList availableBuildTypes(const Base return types; } -QList QmakeBuildConfigurationFactory::availableBuilds(const Target *parent) const +QList QmakeBuildConfigurationFactory::availableBuilds(const Kit *k, const FilePath &projectPath) const { QList result; - const FilePath projectFilePath = parent->project()->projectFilePath(); - - for (BuildConfiguration::BuildType buildType : - availableBuildTypes(QtKitAspect::qtVersion(parent->kit()))) { - BuildInfo info = createBuildInfo(parent->kit(), projectFilePath, buildType); + for (BuildConfiguration::BuildType buildType : availableBuildTypes(QtKitAspect::qtVersion(k))) { + BuildInfo info = createBuildInfo(k, projectPath, buildType); info.displayName.clear(); // ask for a name info.buildDirectory.clear(); // This depends on the displayName result << info; diff --git a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.h b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.h index e5a11b6d4a2..867f72afdba 100644 --- a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.h +++ b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.h @@ -149,7 +149,8 @@ class QMAKEPROJECTMANAGER_EXPORT QmakeBuildConfigurationFactory : public Project public: QmakeBuildConfigurationFactory(); - QList availableBuilds(const ProjectExplorer::Target *parent) const override; + QList availableBuilds(const ProjectExplorer::Kit *k, + const Utils::FilePath &projectPath) const override; QList availableSetups(const ProjectExplorer::Kit *k, const Utils::FilePath &projectPath) const override; private: diff --git a/src/plugins/qmlprofiler/tests/qmlprofilerdetailsrewriter_test.cpp b/src/plugins/qmlprofiler/tests/qmlprofilerdetailsrewriter_test.cpp index 7d681994da7..049c84d47cb 100644 --- a/src/plugins/qmlprofiler/tests/qmlprofilerdetailsrewriter_test.cpp +++ b/src/plugins/qmlprofiler/tests/qmlprofilerdetailsrewriter_test.cpp @@ -71,7 +71,8 @@ public: class DummyBuildConfigurationFactory : public ProjectExplorer::BuildConfigurationFactory { public: - QList availableBuilds(const ProjectExplorer::Target *) const final + QList availableBuilds(const ProjectExplorer::Kit *, + const FilePath &) const final { return {}; }