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 <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-06-26 18:04:47 +02:00
parent e7c6169d70
commit f94e55b807
17 changed files with 37 additions and 30 deletions

View File

@@ -97,9 +97,9 @@ AutotoolsBuildConfigurationFactory::AutotoolsBuildConfigurationFactory()
setSupportedProjectMimeTypeName(Constants::MAKEFILE_MIMETYPE);
}
QList<BuildInfo> AutotoolsBuildConfigurationFactory::availableBuilds(const Target *parent) const
QList<BuildInfo> AutotoolsBuildConfigurationFactory::availableBuilds(const Kit *k, const FilePath &projectPath) const
{
return {createBuildInfo(parent->kit(), parent->project()->projectDirectory())};
return {createBuildInfo(k, projectPath)};
}
QList<BuildInfo> AutotoolsBuildConfigurationFactory::availableSetups(const Kit *k, const FilePath &projectPath) const

View File

@@ -53,7 +53,8 @@ public:
AutotoolsBuildConfigurationFactory();
private:
QList<ProjectExplorer::BuildInfo> availableBuilds(const ProjectExplorer::Target *parent) const override;
QList<ProjectExplorer::BuildInfo> availableBuilds(const ProjectExplorer::Kit *k,
const Utils::FilePath &projectPath) const override;
QList<ProjectExplorer::BuildInfo> availableSetups(const ProjectExplorer::Kit *k,
const Utils::FilePath &projectPath) const override;

View File

@@ -481,13 +481,14 @@ BuildConfiguration::BuildType CMakeBuildConfigurationFactory::cmakeBuildTypeToBu
return BuildConfiguration::Unknown;
}
QList<BuildInfo> CMakeBuildConfigurationFactory::availableBuilds(const Target *parent) const
QList<BuildInfo>
CMakeBuildConfigurationFactory::availableBuilds(const Kit *k, const FilePath &projectPath) const
{
QList<BuildInfo> 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;

View File

@@ -134,7 +134,8 @@ public:
static BuildType buildTypeFromByteArray(const QByteArray &in);
static ProjectExplorer::BuildConfiguration::BuildType cmakeBuildTypeToBuildType(const BuildType &in);
QList<ProjectExplorer::BuildInfo> availableBuilds(const ProjectExplorer::Target *parent) const override;
QList<ProjectExplorer::BuildInfo> availableBuilds(const ProjectExplorer::Kit *k,
const Utils::FilePath &projectPath) const override;
QList<ProjectExplorer::BuildInfo> availableSetups(const ProjectExplorer::Kit *k,
const Utils::FilePath &projectPath) const override;

View File

@@ -541,13 +541,12 @@ static QList<ProjectExplorer::BuildInfo> defaultBuildInfos(
return buildInfos;
}
QList<ProjectExplorer::BuildInfo> CompilationDatabaseBuildConfigurationFactory::availableBuilds(
const ProjectExplorer::Target * /*parent*/) const
QList<BuildInfo> CompilationDatabaseBuildConfigurationFactory::availableBuilds(const Kit *, const Utils::FilePath &) const
{
return defaultBuildInfos(this, tr("Release"));
}
QList<ProjectExplorer::BuildInfo> CompilationDatabaseBuildConfigurationFactory::availableSetups(const ProjectExplorer::Kit * /*k*/, const Utils::FilePath & /*projectPath*/) const
QList<BuildInfo> CompilationDatabaseBuildConfigurationFactory::availableSetups(const Kit *, const Utils::FilePath &) const
{
return defaultBuildInfos(this, tr("Release"));
}

View File

@@ -105,7 +105,7 @@ public:
CompilationDatabaseBuildConfigurationFactory();
QList<ProjectExplorer::BuildInfo> availableBuilds(
const ProjectExplorer::Target *parent) const override;
const ProjectExplorer::Kit *k, const Utils::FilePath &projectPath) const override;
QList<ProjectExplorer::BuildInfo> availableSetups(
const ProjectExplorer::Kit *k, const Utils::FilePath &projectPath) const override;
};

View File

@@ -87,9 +87,10 @@ GenericBuildConfigurationFactory::GenericBuildConfigurationFactory()
GenericBuildConfigurationFactory::~GenericBuildConfigurationFactory() = default;
QList<BuildInfo> GenericBuildConfigurationFactory::availableBuilds(const Target *parent) const
QList<BuildInfo>
GenericBuildConfigurationFactory::availableBuilds(const Kit *k, const FilePath &projectPath) const
{
return {createBuildInfo(parent->kit(), parent->project()->projectDirectory())};
return {createBuildInfo(k, projectPath)};
}
QList<BuildInfo>

View File

@@ -53,7 +53,8 @@ public:
~GenericBuildConfigurationFactory() override;
private:
QList<ProjectExplorer::BuildInfo> availableBuilds(const ProjectExplorer::Target *parent) const override;
QList<ProjectExplorer::BuildInfo> availableBuilds(const ProjectExplorer::Kit *k,
const Utils::FilePath &projectPath) const override;
QList<ProjectExplorer::BuildInfo> availableSetups(const ProjectExplorer::Kit *k,
const Utils::FilePath &projectPath) const override;

View File

@@ -155,11 +155,11 @@ NimBuildConfigurationFactory::NimBuildConfigurationFactory()
setSupportedProjectMimeTypeName(Constants::C_NIM_PROJECT_MIMETYPE);
}
QList<BuildInfo> NimBuildConfigurationFactory::availableBuilds(const Target *parent) const
QList<BuildInfo> NimBuildConfigurationFactory::availableBuilds(const Kit *k, const FilePath &) const
{
QList<BuildInfo> result;
for (auto buildType : {BuildConfiguration::Debug, BuildConfiguration::Release})
result.push_back(createBuildInfo(parent->kit(), buildType));
result.push_back(createBuildInfo(k, buildType));
return result;
}

View File

@@ -63,7 +63,8 @@ public:
NimBuildConfigurationFactory();
private:
QList<ProjectExplorer::BuildInfo> availableBuilds(const ProjectExplorer::Target *parent) const override;
QList<ProjectExplorer::BuildInfo> availableBuilds(const ProjectExplorer::Kit *k,
const Utils::FilePath &projectPath) const override;
QList<ProjectExplorer::BuildInfo> availableSetups(const ProjectExplorer::Kit *k,
const Utils::FilePath &projectPath) const override;

View File

@@ -416,7 +416,7 @@ const Tasks BuildConfigurationFactory::reportIssues(ProjectExplorer::Kit *kit, c
const QList<BuildInfo> BuildConfigurationFactory::allAvailableBuilds(const Target *parent) const
{
return availableBuilds(parent);
return availableBuilds(parent->kit(), parent->project()->projectFilePath());
}
const QList<BuildInfo>

View File

@@ -157,7 +157,8 @@ public:
const QString &projectPath, const QString &buildDir) const;
protected:
virtual QList<BuildInfo> availableBuilds(const Target *parent) const = 0;
virtual QList<BuildInfo>
availableBuilds(const Kit *k, const Utils::FilePath &projectPath) const = 0;
virtual QList<BuildInfo>
availableSetups(const Kit *k, const Utils::FilePath &projectPath) const = 0;

View File

@@ -382,9 +382,10 @@ BuildInfo QbsBuildConfigurationFactory::createBuildInfo(const Kit *k,
return info;
}
QList<BuildInfo> QbsBuildConfigurationFactory::availableBuilds(const Target *parent) const
QList<BuildInfo>
QbsBuildConfigurationFactory::availableBuilds(const Kit *k, const FilePath &) const
{
return {createBuildInfo(parent->kit(), BuildConfiguration::Debug)};
return {createBuildInfo(k, BuildConfiguration::Debug)};
}
QList<BuildInfo>

View File

@@ -92,7 +92,8 @@ class QbsBuildConfigurationFactory : public ProjectExplorer::BuildConfigurationF
public:
QbsBuildConfigurationFactory();
QList<ProjectExplorer::BuildInfo> availableBuilds(const ProjectExplorer::Target *parent) const override;
QList<ProjectExplorer::BuildInfo> availableBuilds(const ProjectExplorer::Kit *k,
const Utils::FilePath &projectPath) const override;
QList<ProjectExplorer::BuildInfo> availableSetups(const ProjectExplorer::Kit *k,
const Utils::FilePath &projectPath) const override;

View File

@@ -665,15 +665,12 @@ static const QList<BuildConfiguration::BuildType> availableBuildTypes(const Base
return types;
}
QList<BuildInfo> QmakeBuildConfigurationFactory::availableBuilds(const Target *parent) const
QList<BuildInfo> QmakeBuildConfigurationFactory::availableBuilds(const Kit *k, const FilePath &projectPath) const
{
QList<BuildInfo> 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;

View File

@@ -149,7 +149,8 @@ class QMAKEPROJECTMANAGER_EXPORT QmakeBuildConfigurationFactory : public Project
public:
QmakeBuildConfigurationFactory();
QList<ProjectExplorer::BuildInfo> availableBuilds(const ProjectExplorer::Target *parent) const override;
QList<ProjectExplorer::BuildInfo> availableBuilds(const ProjectExplorer::Kit *k,
const Utils::FilePath &projectPath) const override;
QList<ProjectExplorer::BuildInfo> availableSetups(const ProjectExplorer::Kit *k,
const Utils::FilePath &projectPath) const override;
private:

View File

@@ -71,7 +71,8 @@ public:
class DummyBuildConfigurationFactory : public ProjectExplorer::BuildConfigurationFactory
{
public:
QList<ProjectExplorer::BuildInfo> availableBuilds(const ProjectExplorer::Target *) const final
QList<ProjectExplorer::BuildInfo> availableBuilds(const ProjectExplorer::Kit *,
const FilePath &) const final
{
return {};
}