forked from qt-creator/qt-creator
ProjectExplorer: Merge BuildConfigurationFactory::availableBuilds
... and availableSetups as far as mechanically possible. Change-Id: Ia1d7babe943eea25da97cef7838187c234378673 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -97,28 +97,18 @@ AutotoolsBuildConfigurationFactory::AutotoolsBuildConfigurationFactory()
|
||||
setSupportedProjectMimeTypeName(Constants::MAKEFILE_MIMETYPE);
|
||||
}
|
||||
|
||||
QList<BuildInfo> AutotoolsBuildConfigurationFactory::availableBuilds(const Kit *k, const FilePath &projectPath) const
|
||||
{
|
||||
return {createBuildInfo(k, projectPath)};
|
||||
}
|
||||
|
||||
QList<BuildInfo> AutotoolsBuildConfigurationFactory::availableSetups(const Kit *k, const FilePath &projectPath) const
|
||||
{
|
||||
const QString path = projectPath.toFileInfo().absolutePath();
|
||||
BuildInfo info = createBuildInfo(k, Utils::FilePath::fromString(path));
|
||||
//: The name of the build configuration created by default for a autotools project.
|
||||
info.displayName = tr("Default");
|
||||
return {info};
|
||||
}
|
||||
|
||||
BuildInfo AutotoolsBuildConfigurationFactory::createBuildInfo(const Kit *k,
|
||||
const Utils::FilePath &buildDir) const
|
||||
QList<BuildInfo> AutotoolsBuildConfigurationFactory::availableBuilds
|
||||
(const Kit *k, const FilePath &projectPath, bool forSetup) const
|
||||
{
|
||||
BuildInfo info(this);
|
||||
info.typeName = tr("Build");
|
||||
info.buildDirectory = buildDir;
|
||||
info.buildDirectory = forSetup ? FilePath::fromString(projectPath.toFileInfo().absolutePath()) : projectPath;
|
||||
info.kitId = k->id();
|
||||
return info;
|
||||
if (forSetup) {
|
||||
//: The name of the build configuration created by default for a autotools project.
|
||||
info.displayName = tr("Default");
|
||||
}
|
||||
return {info};
|
||||
}
|
||||
|
||||
BuildConfiguration::BuildType AutotoolsBuildConfiguration::buildType() const
|
||||
|
@@ -29,8 +29,6 @@
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
|
||||
namespace Utils { class FilePath; }
|
||||
|
||||
namespace AutotoolsProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
@@ -54,11 +52,8 @@ public:
|
||||
|
||||
private:
|
||||
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;
|
||||
|
||||
ProjectExplorer::BuildInfo createBuildInfo(const ProjectExplorer::Kit *k, const Utils::FilePath &buildDir) const;
|
||||
const Utils::FilePath &projectPath,
|
||||
bool forSetup) const override;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -481,31 +481,21 @@ BuildConfiguration::BuildType CMakeBuildConfigurationFactory::cmakeBuildTypeToBu
|
||||
return BuildConfiguration::Unknown;
|
||||
}
|
||||
|
||||
QList<BuildInfo>
|
||||
CMakeBuildConfigurationFactory::availableBuilds(const Kit *k, const FilePath &projectPath) const
|
||||
QList<BuildInfo> CMakeBuildConfigurationFactory::availableBuilds
|
||||
(const Kit *k, const FilePath &projectPath, bool forSetup) const
|
||||
{
|
||||
QList<BuildInfo> result;
|
||||
|
||||
FilePath path = forSetup ? Project::projectDirectory(projectPath) : projectPath;
|
||||
|
||||
for (int type = BuildTypeNone; type != BuildTypeLast; ++type) {
|
||||
result << createBuildInfo(k,
|
||||
projectPath.toString(),
|
||||
BuildType(type));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QList<BuildInfo>
|
||||
CMakeBuildConfigurationFactory::availableSetups(const Kit *k, const FilePath &projectPath) const
|
||||
{
|
||||
QList<BuildInfo> result;
|
||||
for (int type = BuildTypeDebug; type != BuildTypeLast; ++type) {
|
||||
BuildInfo info = createBuildInfo(k,
|
||||
ProjectExplorer::Project::projectDirectory(projectPath).toString(),
|
||||
BuildType(type));
|
||||
BuildInfo info = createBuildInfo(k, path.toString(), BuildType(type));
|
||||
if (forSetup) {
|
||||
info.displayName = info.typeName;
|
||||
info.buildDirectory
|
||||
= CMakeBuildConfiguration::shadowBuildDirectory(projectPath, k,
|
||||
info.displayName, info.buildType);
|
||||
}
|
||||
result << info;
|
||||
}
|
||||
return result;
|
||||
|
@@ -135,9 +135,8 @@ public:
|
||||
static ProjectExplorer::BuildConfiguration::BuildType cmakeBuildTypeToBuildType(const BuildType &in);
|
||||
|
||||
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;
|
||||
const Utils::FilePath &projectPath,
|
||||
bool forSetup) const override;
|
||||
|
||||
private:
|
||||
ProjectExplorer::BuildInfo createBuildInfo(const ProjectExplorer::Kit *k,
|
||||
|
@@ -59,6 +59,7 @@
|
||||
#endif
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace CompilationDatabaseProjectManager {
|
||||
namespace Internal {
|
||||
@@ -529,26 +530,15 @@ CompilationDatabaseBuildConfigurationFactory::CompilationDatabaseBuildConfigurat
|
||||
setSupportedProjectMimeTypeName(Constants::COMPILATIONDATABASEMIMETYPE);
|
||||
}
|
||||
|
||||
static QList<ProjectExplorer::BuildInfo> defaultBuildInfos(
|
||||
const ProjectExplorer::BuildConfigurationFactory *factory, const QString &name)
|
||||
QList<BuildInfo> CompilationDatabaseBuildConfigurationFactory::availableBuilds
|
||||
(const Kit *, const FilePath &, bool) const
|
||||
{
|
||||
ProjectExplorer::BuildInfo info(factory);
|
||||
const QString name = tr("Release");
|
||||
ProjectExplorer::BuildInfo info(this);
|
||||
info.typeName = name;
|
||||
info.displayName = name;
|
||||
info.buildType = BuildConfiguration::Release;
|
||||
QList<ProjectExplorer::BuildInfo> buildInfos;
|
||||
buildInfos << info;
|
||||
return buildInfos;
|
||||
}
|
||||
|
||||
QList<BuildInfo> CompilationDatabaseBuildConfigurationFactory::availableBuilds(const Kit *, const Utils::FilePath &) const
|
||||
{
|
||||
return defaultBuildInfos(this, tr("Release"));
|
||||
}
|
||||
|
||||
QList<BuildInfo> CompilationDatabaseBuildConfigurationFactory::availableSetups(const Kit *, const Utils::FilePath &) const
|
||||
{
|
||||
return defaultBuildInfos(this, tr("Release"));
|
||||
return {info};
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -104,10 +104,9 @@ class CompilationDatabaseBuildConfigurationFactory
|
||||
public:
|
||||
CompilationDatabaseBuildConfigurationFactory();
|
||||
|
||||
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;
|
||||
QList<ProjectExplorer::BuildInfo> availableBuilds(const ProjectExplorer::Kit *k,
|
||||
const Utils::FilePath &projectPath,
|
||||
bool forSetup) const override;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -85,31 +85,20 @@ GenericBuildConfigurationFactory::GenericBuildConfigurationFactory()
|
||||
setSupportedProjectMimeTypeName(Constants::GENERICMIMETYPE);
|
||||
}
|
||||
|
||||
GenericBuildConfigurationFactory::~GenericBuildConfigurationFactory() = default;
|
||||
|
||||
QList<BuildInfo>
|
||||
GenericBuildConfigurationFactory::availableBuilds(const Kit *k, const FilePath &projectPath) const
|
||||
{
|
||||
return {createBuildInfo(k, projectPath)};
|
||||
}
|
||||
|
||||
QList<BuildInfo>
|
||||
GenericBuildConfigurationFactory::availableSetups(const Kit *k, const FilePath &projectPath) const
|
||||
{
|
||||
BuildInfo info = createBuildInfo(k, Project::projectDirectory(projectPath));
|
||||
//: The name of the build configuration created by default for a generic project.
|
||||
info.displayName = tr("Default");
|
||||
return {info};
|
||||
}
|
||||
|
||||
BuildInfo
|
||||
GenericBuildConfigurationFactory::createBuildInfo(const Kit *k, const FilePath &buildDir) const
|
||||
QList<BuildInfo> GenericBuildConfigurationFactory::availableBuilds
|
||||
(const Kit *k, const FilePath &projectPath, bool forSetup) const
|
||||
{
|
||||
BuildInfo info(this);
|
||||
info.typeName = tr("Build");
|
||||
info.buildDirectory = buildDir;
|
||||
info.buildDirectory = forSetup ? Project::projectDirectory(projectPath) : projectPath;
|
||||
info.kitId = k->id();
|
||||
return info;
|
||||
|
||||
if (forSetup) {
|
||||
//: The name of the build configuration created by default for a generic project.
|
||||
info.displayName = tr("Default");
|
||||
}
|
||||
|
||||
return {info};
|
||||
}
|
||||
|
||||
BuildConfiguration::BuildType GenericBuildConfiguration::buildType() const
|
||||
|
@@ -50,15 +50,11 @@ class GenericBuildConfigurationFactory : public ProjectExplorer::BuildConfigurat
|
||||
|
||||
public:
|
||||
GenericBuildConfigurationFactory();
|
||||
~GenericBuildConfigurationFactory() override;
|
||||
|
||||
private:
|
||||
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;
|
||||
|
||||
ProjectExplorer::BuildInfo createBuildInfo(const ProjectExplorer::Kit *k, const Utils::FilePath &buildDir) const;
|
||||
const Utils::FilePath &projectPath,
|
||||
bool forSetup) const override;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -155,48 +155,30 @@ NimBuildConfigurationFactory::NimBuildConfigurationFactory()
|
||||
setSupportedProjectMimeTypeName(Constants::C_NIM_PROJECT_MIMETYPE);
|
||||
}
|
||||
|
||||
QList<BuildInfo> NimBuildConfigurationFactory::availableBuilds(const Kit *k, const FilePath &) const
|
||||
{
|
||||
QList<BuildInfo> result;
|
||||
for (auto buildType : {BuildConfiguration::Debug, BuildConfiguration::Release})
|
||||
result.push_back(createBuildInfo(k, buildType));
|
||||
return result;
|
||||
}
|
||||
|
||||
QList<BuildInfo> NimBuildConfigurationFactory::availableSetups(const Kit *k, const FilePath &projectPath) const
|
||||
QList<BuildInfo> NimBuildConfigurationFactory::availableBuilds
|
||||
(const Kit *k, const FilePath &projectPath, bool forSetup) const
|
||||
{
|
||||
QList<BuildInfo> result;
|
||||
for (auto buildType : {BuildConfiguration::Debug, BuildConfiguration::Release}) {
|
||||
BuildInfo info = createBuildInfo(k, buildType);
|
||||
BuildInfo info(this);
|
||||
info.buildType = buildType;
|
||||
info.kitId = k->id();
|
||||
|
||||
if (buildType == BuildConfiguration::Debug)
|
||||
info.typeName = tr("Debug");
|
||||
else if (buildType == BuildConfiguration::Profile)
|
||||
info.typeName = tr("Profile");
|
||||
else if (buildType == BuildConfiguration::Release)
|
||||
info.typeName = tr("Release");
|
||||
|
||||
if (forSetup) {
|
||||
info.displayName = info.typeName;
|
||||
info.buildDirectory = defaultBuildDirectory(k, projectPath, info.typeName, buildType);
|
||||
}
|
||||
result.push_back(info);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
BuildInfo NimBuildConfigurationFactory::createBuildInfo(const Kit *k, BuildConfiguration::BuildType buildType) const
|
||||
{
|
||||
BuildInfo info(this);
|
||||
info.buildType = buildType;
|
||||
info.kitId = k->id();
|
||||
info.typeName = displayName(buildType);
|
||||
return info;
|
||||
}
|
||||
|
||||
QString NimBuildConfigurationFactory::displayName(BuildConfiguration::BuildType buildType) const
|
||||
{
|
||||
switch (buildType) {
|
||||
case ProjectExplorer::BuildConfiguration::Debug:
|
||||
return tr("Debug");
|
||||
case ProjectExplorer::BuildConfiguration::Profile:
|
||||
return tr("Profile");
|
||||
case ProjectExplorer::BuildConfiguration::Release:
|
||||
return tr("Release");
|
||||
default:
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Nim
|
||||
|
||||
|
@@ -64,15 +64,8 @@ public:
|
||||
|
||||
private:
|
||||
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;
|
||||
|
||||
ProjectExplorer::BuildInfo createBuildInfo(const ProjectExplorer::Kit *k,
|
||||
ProjectExplorer::BuildConfiguration::BuildType buildType) const;
|
||||
|
||||
QString displayName(ProjectExplorer::BuildConfiguration::BuildType buildType) const;
|
||||
const Utils::FilePath &projectPath,
|
||||
bool forSetup) const override;
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -416,13 +416,13 @@ const Tasks BuildConfigurationFactory::reportIssues(ProjectExplorer::Kit *kit, c
|
||||
|
||||
const QList<BuildInfo> BuildConfigurationFactory::allAvailableBuilds(const Target *parent) const
|
||||
{
|
||||
return availableBuilds(parent->kit(), parent->project()->projectFilePath());
|
||||
return availableBuilds(parent->kit(), parent->project()->projectFilePath(), false);
|
||||
}
|
||||
|
||||
const QList<BuildInfo>
|
||||
BuildConfigurationFactory::allAvailableSetups(const Kit *k, const FilePath &projectPath) const
|
||||
{
|
||||
return availableSetups(k, projectPath);
|
||||
return availableBuilds(k, projectPath, /* forSetup = */ true);
|
||||
}
|
||||
|
||||
bool BuildConfigurationFactory::supportsTargetDeviceType(Core::Id id) const
|
||||
|
@@ -158,9 +158,7 @@ public:
|
||||
|
||||
protected:
|
||||
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;
|
||||
availableBuilds(const Kit *k, const Utils::FilePath &projectPath, bool forSetup) const = 0;
|
||||
|
||||
bool supportsTargetDeviceType(Core::Id id) const;
|
||||
void setSupportedProjectType(Core::Id id);
|
||||
|
@@ -369,30 +369,12 @@ QbsBuildConfigurationFactory::QbsBuildConfigurationFactory()
|
||||
});
|
||||
}
|
||||
|
||||
BuildInfo QbsBuildConfigurationFactory::createBuildInfo(const Kit *k,
|
||||
BuildConfiguration::BuildType type) const
|
||||
{
|
||||
BuildInfo info(this);
|
||||
info.kitId = k->id();
|
||||
info.buildType = type;
|
||||
info.typeName = tr("Build");
|
||||
QVariantMap config;
|
||||
config.insert("configName", type == BuildConfiguration::Debug ? "Debug" : "Release");
|
||||
info.extraInfo = config;
|
||||
return info;
|
||||
}
|
||||
|
||||
QList<BuildInfo>
|
||||
QbsBuildConfigurationFactory::availableBuilds(const Kit *k, const FilePath &) const
|
||||
{
|
||||
return {createBuildInfo(k, BuildConfiguration::Debug)};
|
||||
}
|
||||
|
||||
QList<BuildInfo>
|
||||
QbsBuildConfigurationFactory::availableSetups(const Kit *k, const FilePath &projectPath) const
|
||||
QList<BuildInfo> QbsBuildConfigurationFactory::availableBuilds(const Kit *k, const FilePath &projectPath, bool forSetup) const
|
||||
{
|
||||
QList<BuildInfo> result;
|
||||
|
||||
if (forSetup) {
|
||||
|
||||
BuildInfo info = createBuildInfo(k, BuildConfiguration::Debug);
|
||||
//: The name of the debug build configuration created by default for a qbs project.
|
||||
info.displayName = tr("Debug");
|
||||
@@ -411,8 +393,27 @@ QList<BuildInfo>
|
||||
info.buildType);
|
||||
result << info;
|
||||
|
||||
} else {
|
||||
|
||||
result << createBuildInfo(k, BuildConfiguration::Debug);
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
BuildInfo QbsBuildConfigurationFactory::createBuildInfo(const Kit *k,
|
||||
BuildConfiguration::BuildType type) const
|
||||
{
|
||||
BuildInfo info(this);
|
||||
info.kitId = k->id();
|
||||
info.buildType = type;
|
||||
info.typeName = tr("Build");
|
||||
QVariantMap config;
|
||||
config.insert("configName", type == BuildConfiguration::Debug ? "Debug" : "Release");
|
||||
info.extraInfo = config;
|
||||
return info;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QbsProjectManager
|
||||
|
@@ -92,10 +92,8 @@ class QbsBuildConfigurationFactory : public ProjectExplorer::BuildConfigurationF
|
||||
public:
|
||||
QbsBuildConfigurationFactory();
|
||||
|
||||
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;
|
||||
QList<ProjectExplorer::BuildInfo> availableBuilds
|
||||
(const ProjectExplorer::Kit *k, const Utils::FilePath &projectPath, bool forSetup) const override;
|
||||
|
||||
private:
|
||||
ProjectExplorer::BuildInfo createBuildInfo(const ProjectExplorer::Kit *k,
|
||||
|
@@ -665,29 +665,25 @@ static const QList<BuildConfiguration::BuildType> availableBuildTypes(const Base
|
||||
return types;
|
||||
}
|
||||
|
||||
QList<BuildInfo> QmakeBuildConfigurationFactory::availableBuilds(const Kit *k, const FilePath &projectPath) const
|
||||
QList<BuildInfo> QmakeBuildConfigurationFactory::availableBuilds(const Kit *k, const FilePath &projectPath, bool forSetup) const
|
||||
{
|
||||
QList<BuildInfo> result;
|
||||
|
||||
for (BuildConfiguration::BuildType buildType : availableBuildTypes(QtKitAspect::qtVersion(k))) {
|
||||
BaseQtVersion *qtVersion = QtKitAspect::qtVersion(k);
|
||||
|
||||
if (forSetup && (!qtVersion || !qtVersion->isValid()))
|
||||
return {};
|
||||
|
||||
|
||||
for (BuildConfiguration::BuildType buildType : availableBuildTypes(qtVersion)) {
|
||||
BuildInfo info = createBuildInfo(k, projectPath, buildType);
|
||||
if (!forSetup) {
|
||||
info.displayName.clear(); // ask for a name
|
||||
info.buildDirectory.clear(); // This depends on the displayName
|
||||
result << info;
|
||||
}
|
||||
result << info;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
QList<BuildInfo> QmakeBuildConfigurationFactory::availableSetups(const Kit *k, const FilePath &projectPath) const
|
||||
{
|
||||
QList<BuildInfo> result;
|
||||
BaseQtVersion *qtVersion = QtKitAspect::qtVersion(k);
|
||||
if (!qtVersion || !qtVersion->isValid())
|
||||
return result;
|
||||
|
||||
for (BuildConfiguration::BuildType buildType : availableBuildTypes(qtVersion))
|
||||
result << createBuildInfo(k, projectPath, buildType);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@@ -150,9 +150,8 @@ public:
|
||||
QmakeBuildConfigurationFactory();
|
||||
|
||||
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;
|
||||
const Utils::FilePath &projectPath,
|
||||
bool forSetup) const override;
|
||||
private:
|
||||
ProjectExplorer::BuildInfo createBuildInfo(const ProjectExplorer::Kit *k, const Utils::FilePath &projectPath,
|
||||
ProjectExplorer::BuildConfiguration::BuildType type) const;
|
||||
|
@@ -72,13 +72,7 @@ class DummyBuildConfigurationFactory : public ProjectExplorer::BuildConfiguratio
|
||||
{
|
||||
public:
|
||||
QList<ProjectExplorer::BuildInfo> availableBuilds(const ProjectExplorer::Kit *,
|
||||
const FilePath &) const final
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
QList<ProjectExplorer::BuildInfo> availableSetups(const ProjectExplorer::Kit *,
|
||||
const FilePath &) const final
|
||||
const FilePath &, bool) const final
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
Reference in New Issue
Block a user