summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2018-02-08 15:07:10 +0100
committerhjk <hjk@qt.io>2018-02-15 14:23:02 +0000
commit9f2bb5d0c5ec33a03759d038fb58c3dcddb6f7c5 (patch)
tree6a18b06eb2aa7d0f484e8c9ff6d7ef41190b03f7
parent3da9c8998139308270eec27eb9b5dddd74090bf5 (diff)
downloadqt-creator-9f2bb5d0c5ec33a03759d038fb58c3dcddb6f7c5.tar.gz
ProjectExplorer: Simplify collection of RunConfigurationCreationInfos
Instead of calling twice for AutoCreated and UserCreated, call once and record to which case it belongs. Only the 'both' and 'user only' combination are ever used. Change-Id: I9c15085bcbb4bf6584a6156135f2084dbfc51c1c Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--src/plugins/baremetal/baremetalrunconfigurationfactory.cpp3
-rw-r--r--src/plugins/baremetal/baremetalrunconfigurationfactory.h2
-rw-r--r--src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp4
-rw-r--r--src/plugins/cmakeprojectmanager/cmakerunconfiguration.h2
-rw-r--r--src/plugins/ios/iosrunfactories.cpp17
-rw-r--r--src/plugins/ios/iosrunfactories.h4
-rw-r--r--src/plugins/projectexplorer/runconfiguration.cpp10
-rw-r--r--src/plugins/projectexplorer/runconfiguration.h26
-rw-r--r--src/plugins/projectexplorer/target.cpp21
-rw-r--r--src/plugins/pythoneditor/pythoneditorplugin.cpp4
-rw-r--r--src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp26
-rw-r--r--src/plugins/qbsprojectmanager/qbsrunconfiguration.h2
-rw-r--r--src/plugins/qmakeandroidsupport/qmakeandroidrunfactories.cpp6
-rw-r--r--src/plugins/qmakeandroidsupport/qmakeandroidrunfactories.h2
-rw-r--r--src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp4
-rw-r--r--src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.h2
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeproject.cpp34
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeproject.h6
-rw-r--r--src/plugins/qnx/qnxrunconfigurationfactory.cpp3
-rw-r--r--src/plugins/qnx/qnxrunconfigurationfactory.h4
-rw-r--r--src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp3
-rw-r--r--src/plugins/remotelinux/remotelinuxrunconfigurationfactory.h2
-rw-r--r--src/plugins/winrt/winrtrunfactories.cpp9
-rw-r--r--src/plugins/winrt/winrtrunfactories.h2
24 files changed, 94 insertions, 104 deletions
diff --git a/src/plugins/baremetal/baremetalrunconfigurationfactory.cpp b/src/plugins/baremetal/baremetalrunconfigurationfactory.cpp
index a59024d728..62b82f36b6 100644
--- a/src/plugins/baremetal/baremetalrunconfigurationfactory.cpp
+++ b/src/plugins/baremetal/baremetalrunconfigurationfactory.cpp
@@ -48,9 +48,8 @@ BareMetalRunConfigurationFactory::BareMetalRunConfigurationFactory(QObject *pare
setSupportedTargetDeviceTypes({BareMetal::Constants::BareMetalOsType});
}
-QList<RunConfigurationCreationInfo> BareMetalRunConfigurationFactory::availableCreators(Target *parent, IRunConfigurationFactory::CreationMode mode) const
+QList<RunConfigurationCreationInfo> BareMetalRunConfigurationFactory::availableCreators(Target *parent) const
{
- Q_UNUSED(mode);
return Utils::transform(parent->applicationTargets().list, [this](const BuildTargetInfo &bti) {
return convert(tr("%1 (on GDB server or hardware debugger)").arg(QFileInfo(bti.targetName).fileName()),
bti.projectFilePath.toString() + '/' + bti.targetName);
diff --git a/src/plugins/baremetal/baremetalrunconfigurationfactory.h b/src/plugins/baremetal/baremetalrunconfigurationfactory.h
index 271f6fa4cb..d3de78e70f 100644
--- a/src/plugins/baremetal/baremetalrunconfigurationfactory.h
+++ b/src/plugins/baremetal/baremetalrunconfigurationfactory.h
@@ -38,7 +38,7 @@ public:
explicit BareMetalRunConfigurationFactory(QObject *parent = nullptr);
QList<ProjectExplorer::RunConfigurationCreationInfo>
- availableCreators(ProjectExplorer::Target *parent, CreationMode mode = UserCreate) const override;
+ availableCreators(ProjectExplorer::Target *parent) const override;
};
class BareMetalCustomRunConfigurationFactory : public ProjectExplorer::FixedRunConfigurationFactory
diff --git a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp
index 96ca235225..c5a26508ca 100644
--- a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp
@@ -239,10 +239,8 @@ CMakeRunConfigurationFactory::CMakeRunConfigurationFactory(QObject *parent) :
}
QList<RunConfigurationCreationInfo>
-CMakeRunConfigurationFactory::availableCreators(Target *parent,
- IRunConfigurationFactory::CreationMode mode) const
+CMakeRunConfigurationFactory::availableCreators(Target *parent) const
{
- Q_UNUSED(mode);
CMakeProject *project = static_cast<CMakeProject *>(parent->project());
const QStringList titles = project->buildTargetTitles(true);
return Utils::transform(titles, [this](const QString &title) { return convert(title, title); });
diff --git a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.h b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.h
index 0e71555340..f13ef97322 100644
--- a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.h
+++ b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.h
@@ -84,7 +84,7 @@ public:
explicit CMakeRunConfigurationFactory(QObject *parent = 0);
QList<ProjectExplorer::RunConfigurationCreationInfo>
- availableCreators(ProjectExplorer::Target *parent, CreationMode mode = UserCreate) const override;
+ availableCreators(ProjectExplorer::Target *parent) const override;
bool canCreateHelper(ProjectExplorer::Target *parent, const QString &suffix) const override;
};
diff --git a/src/plugins/ios/iosrunfactories.cpp b/src/plugins/ios/iosrunfactories.cpp
index 1e737d727b..b2f7a8d706 100644
--- a/src/plugins/ios/iosrunfactories.cpp
+++ b/src/plugins/ios/iosrunfactories.cpp
@@ -52,22 +52,11 @@ IosRunConfigurationFactory::IosRunConfigurationFactory(QObject *parent)
}
QList<RunConfigurationCreationInfo>
-IosRunConfigurationFactory::availableCreators(Target *parent, CreationMode mode) const
+IosRunConfigurationFactory::availableCreators(Target *parent) const
{
auto project = static_cast<QmakeProject *>(parent->project());
- return Utils::transform(project->buildTargets(mode, {ProjectType::ApplicationTemplate,
- ProjectType::SharedLibraryTemplate}),
- [this](const BuildTargetInfo &ti) { return convert(ti); });
-}
-
-bool IosRunConfigurationFactory::canCreateHelper(Target *parent, const QString &buildTarget) const
-{
- auto project = static_cast<QmakeProject *>(parent->project());
- const QList<BuildTargetInfo> buildTargets = project->buildTargets(UserCreate, {ProjectType::ApplicationTemplate,
- ProjectType::SharedLibraryTemplate});
- return Utils::contains(buildTargets, [buildTarget](const BuildTargetInfo &bti) {
- return bti.targetName == buildTarget;
- });
+ return project->runConfigurationCreators(this, {ProjectType::ApplicationTemplate,
+ ProjectType::SharedLibraryTemplate});
}
bool IosRunConfigurationFactory::hasRunConfigForProFile(RunConfiguration *rc, const Utils::FileName &n) const
diff --git a/src/plugins/ios/iosrunfactories.h b/src/plugins/ios/iosrunfactories.h
index e9a574ee4d..a6736286de 100644
--- a/src/plugins/ios/iosrunfactories.h
+++ b/src/plugins/ios/iosrunfactories.h
@@ -44,9 +44,7 @@ public:
explicit IosRunConfigurationFactory(QObject *parent = 0);
QList<ProjectExplorer::RunConfigurationCreationInfo>
- availableCreators(ProjectExplorer::Target *parent, CreationMode mode = UserCreate) const override;
-
- bool canCreateHelper(ProjectExplorer::Target *parent, const QString &suffix) const override;
+ availableCreators(ProjectExplorer::Target *parent) const override;
bool hasRunConfigForProFile(ProjectExplorer::RunConfiguration *rc, const Utils::FileName &n) const override;
};
diff --git a/src/plugins/projectexplorer/runconfiguration.cpp b/src/plugins/projectexplorer/runconfiguration.cpp
index 51dac8d769..182b510b89 100644
--- a/src/plugins/projectexplorer/runconfiguration.cpp
+++ b/src/plugins/projectexplorer/runconfiguration.cpp
@@ -449,9 +449,8 @@ const QList<IRunConfigurationFactory *> IRunConfigurationFactory::allRunConfigur
}
QList<RunConfigurationCreationInfo>
-IRunConfigurationFactory::availableCreators(Target *parent, IRunConfigurationFactory::CreationMode mode) const
+IRunConfigurationFactory::availableCreators(Target *parent) const
{
- Q_UNUSED(mode);
return Utils::transform(parent->applicationTargets().list, [this](const BuildTargetInfo &ti) {
return RunConfigurationCreationInfo(this, m_runConfigBaseId, ti.targetName,
QFileInfo(ti.targetName).completeBaseName());
@@ -610,12 +609,9 @@ FixedRunConfigurationFactory::FixedRunConfigurationFactory(const QString &displa
{ }
QList<RunConfigurationCreationInfo>
-FixedRunConfigurationFactory::availableCreators(Target *parent, CreationMode mode) const
+FixedRunConfigurationFactory::availableCreators(Target *parent) const
{
- Q_UNUSED(mode);
- if (!canHandle(parent))
- return {};
-
+ Q_UNUSED(parent);
return {RunConfigurationCreationInfo(this, runConfigurationBaseId(), QString(), m_fixedBuildTarget)};
}
diff --git a/src/plugins/projectexplorer/runconfiguration.h b/src/plugins/projectexplorer/runconfiguration.h
index 123b38102c..c335318630 100644
--- a/src/plugins/projectexplorer/runconfiguration.h
+++ b/src/plugins/projectexplorer/runconfiguration.h
@@ -280,14 +280,22 @@ private:
class RunConfigurationCreationInfo
{
public:
- RunConfigurationCreationInfo(const IRunConfigurationFactory *factory, Core::Id id,
- QString extra, QString displayName)
- : factory(factory) , id(id) , extra(extra) , displayName(displayName) {}
+ enum CreationMode {AlwaysCreate, ManualCreationOnly};
+ RunConfigurationCreationInfo(const IRunConfigurationFactory *factory,
+ Core::Id id,
+ QString extra, QString displayName,
+ CreationMode creationMode = AlwaysCreate)
+ : factory(factory), id(id),
+ extra(extra),
+ displayName(displayName),
+ creationMode(creationMode)
+ {}
const IRunConfigurationFactory *factory = nullptr;
Core::Id id;
QString extra;
QString displayName;
+ CreationMode creationMode = AlwaysCreate;
};
class PROJECTEXPLORER_EXPORT IRunConfigurationFactory : public QObject
@@ -300,10 +308,7 @@ public:
static const QList<IRunConfigurationFactory *> allRunConfigurationFactories();
- enum CreationMode {UserCreate, AutoCreate};
-
- virtual QList<RunConfigurationCreationInfo> availableCreators(Target *parent,
- CreationMode mode = UserCreate) const;
+ virtual QList<RunConfigurationCreationInfo> availableCreators(Target *parent) const;
virtual bool canHandle(Target *target) const;
@@ -317,6 +322,8 @@ public:
static IRunConfigurationFactory *find(Target *parent, RunConfiguration *rc);
static QList<IRunConfigurationFactory *> find(Target *parent);
+ Core::Id runConfigurationBaseId() const { return m_runConfigBaseId; }
+
protected:
virtual bool canCreateHelper(Target *parent, const QString &buildTarget) const;
@@ -333,8 +340,6 @@ protected:
void setSupportedTargetDeviceTypes(const QList<Core::Id> &ids);
void setDisplayNamePattern(const QString &pattern);
- Core::Id runConfigurationBaseId() const { return m_runConfigBaseId; }
-
RunConfigurationCreationInfo convert(const BuildTargetInfo &ti) const;
RunConfigurationCreationInfo convert(const QString &displayName, const QString &targetName = QString()) const;
@@ -352,8 +357,7 @@ class PROJECTEXPLORER_EXPORT FixedRunConfigurationFactory : public IRunConfigura
public:
explicit FixedRunConfigurationFactory(const QString &displayName, QObject *parent = nullptr);
- QList<RunConfigurationCreationInfo> availableCreators(Target *parent,
- CreationMode mode = UserCreate) const override;
+ QList<RunConfigurationCreationInfo> availableCreators(Target *parent) const override;
private:
const QString m_fixedBuildTarget;
diff --git a/src/plugins/projectexplorer/target.cpp b/src/plugins/projectexplorer/target.cpp
index 2d80aa77aa..3b69057780 100644
--- a/src/plugins/projectexplorer/target.cpp
+++ b/src/plugins/projectexplorer/target.cpp
@@ -554,14 +554,19 @@ void Target::updateDefaultRunConfigurations()
int configuredCount = existingConfigured.count();
// find all RC ids that can get created:
- QList<RunConfigurationCreationInfo> availableFactories;
- for (IRunConfigurationFactory *rcFactory : rcFactories)
- availableFactories.append(rcFactory->availableCreators(this));
-
+ QList<RunConfigurationCreationInfo> allAvailableFactories;
QList<RunConfigurationCreationInfo> autoCreateFactories;
- for (IRunConfigurationFactory *rcFactory : rcFactories)
- autoCreateFactories.append(rcFactory->availableCreators(this,
- IRunConfigurationFactory::AutoCreate));
+
+ for (IRunConfigurationFactory *rcFactory : rcFactories) {
+ if (rcFactory->canHandle(this)) {
+ const QList<RunConfigurationCreationInfo> creators = rcFactory->availableCreators(this);
+ for (const RunConfigurationCreationInfo &creator : creators) {
+ allAvailableFactories.append(creator); // Manual and Auto
+ if (creator.creationMode == RunConfigurationCreationInfo::AlwaysCreate)
+ autoCreateFactories.append(creator); // Auto only.
+ }
+ }
+ }
// Put outdated RCs into toRemove, do not bother with factories
// that produce already existing RCs
@@ -569,7 +574,7 @@ void Target::updateDefaultRunConfigurations()
QList<RunConfigurationCreationInfo> existing;
foreach (RunConfiguration *rc, existingConfigured) {
bool present = false;
- for (const RunConfigurationCreationInfo &item : availableFactories) {
+ for (const RunConfigurationCreationInfo &item : allAvailableFactories) {
if (item.id == rc->id() && item.extra == rc->extraId()) {
existing.append(item);
present = true;
diff --git a/src/plugins/pythoneditor/pythoneditorplugin.cpp b/src/plugins/pythoneditor/pythoneditorplugin.cpp
index e83b2564d3..d0266d2378 100644
--- a/src/plugins/pythoneditor/pythoneditorplugin.cpp
+++ b/src/plugins/pythoneditor/pythoneditorplugin.cpp
@@ -271,10 +271,8 @@ public:
addSupportedProjectType(PythonProjectId);
}
- QList<RunConfigurationCreationInfo> availableCreators(Target *parent,
- CreationMode mode) const override
+ QList<RunConfigurationCreationInfo> availableCreators(Target *parent) const override
{
- Q_UNUSED(mode);
return Utils::transform(parent->project()->files(Project::AllFiles),[this](const FileName &fn) {
return convert(fn.toString(), fn.toString());
});
diff --git a/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp b/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp
index 02da061d34..b609f5c519 100644
--- a/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp
+++ b/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp
@@ -385,7 +385,7 @@ bool QbsRunConfigurationFactory::canCreateHelper(Target *parent, const QString &
}
QList<RunConfigurationCreationInfo>
-QbsRunConfigurationFactory::availableCreators(Target *parent, CreationMode mode) const
+QbsRunConfigurationFactory::availableCreators(Target *parent) const
{
QList<qbs::ProductData> products;
@@ -398,19 +398,23 @@ QbsRunConfigurationFactory::availableCreators(Target *parent, CreationMode mode)
products << product;
}
- if (mode == AutoCreate) {
- std::function<bool (const qbs::ProductData &)> hasQtcRunnable = [](const qbs::ProductData &product) {
- return product.properties().value("qtcRunnable").toBool();
- };
-
- if (Utils::anyOf(products, hasQtcRunnable))
- Utils::erase(products, std::not1(hasQtcRunnable));
- }
+ const auto isQtcRunnable = [](const qbs::ProductData &product) {
+ return product.properties().value("qtcRunnable").toBool();
+ };
+ const bool hasAnyQtcRunnable = Utils::anyOf(products, isQtcRunnable);
- return Utils::transform(products, [this, project](const qbs::ProductData &product) {
+ return Utils::transform(products, [&](const qbs::ProductData &product) {
const QString displayName = product.fullDisplayName();
const QString targetName = QbsProject::uniqueProductName(product) + rcNameSeparator() + displayName;
- return convert(displayName, targetName);
+ return RunConfigurationCreationInfo {
+ this,
+ runConfigurationBaseId(),
+ targetName,
+ displayName,
+ (hasAnyQtcRunnable && !isQtcRunnable(product))
+ ? RunConfigurationCreationInfo::ManualCreationOnly
+ : RunConfigurationCreationInfo::AlwaysCreate
+ };
});
}
diff --git a/src/plugins/qbsprojectmanager/qbsrunconfiguration.h b/src/plugins/qbsprojectmanager/qbsrunconfiguration.h
index 78c8796d0b..3a39d67c7b 100644
--- a/src/plugins/qbsprojectmanager/qbsrunconfiguration.h
+++ b/src/plugins/qbsprojectmanager/qbsrunconfiguration.h
@@ -119,7 +119,7 @@ public:
bool canCreateHelper(ProjectExplorer::Target *parent, const QString &suffix) const override;
QList<ProjectExplorer::RunConfigurationCreationInfo>
- availableCreators(ProjectExplorer::Target *parent, CreationMode mode = UserCreate) const override;
+ availableCreators(ProjectExplorer::Target *parent) const override;
};
} // namespace Internal
diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidrunfactories.cpp b/src/plugins/qmakeandroidsupport/qmakeandroidrunfactories.cpp
index 108667f0ac..61d0d4abc8 100644
--- a/src/plugins/qmakeandroidsupport/qmakeandroidrunfactories.cpp
+++ b/src/plugins/qmakeandroidsupport/qmakeandroidrunfactories.cpp
@@ -56,12 +56,10 @@ QmakeAndroidRunConfigurationFactory::QmakeAndroidRunConfigurationFactory(QObject
setSupportedTargetDeviceTypes({Android::Constants::ANDROID_DEVICE_TYPE});
}
-QList<RunConfigurationCreationInfo> QmakeAndroidRunConfigurationFactory::availableCreators(Target *parent, IRunConfigurationFactory::CreationMode mode) const
+QList<RunConfigurationCreationInfo> QmakeAndroidRunConfigurationFactory::availableCreators(Target *parent) const
{
auto project = static_cast<QmakeProject *>(parent->project());
- return Utils::transform(project->buildTargets(mode, {ProjectType::ApplicationTemplate, ProjectType::SharedLibraryTemplate}),
- [this](const BuildTargetInfo &ti) { return convert(ti); });
-
+ return project->runConfigurationCreators(this, {ProjectType::ApplicationTemplate, ProjectType::SharedLibraryTemplate});
}
} // namespace Internal
diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidrunfactories.h b/src/plugins/qmakeandroidsupport/qmakeandroidrunfactories.h
index ebcfce1e49..73dc1a735a 100644
--- a/src/plugins/qmakeandroidsupport/qmakeandroidrunfactories.h
+++ b/src/plugins/qmakeandroidsupport/qmakeandroidrunfactories.h
@@ -40,7 +40,7 @@ public:
explicit QmakeAndroidRunConfigurationFactory(QObject *parent = nullptr);
QList<ProjectExplorer::RunConfigurationCreationInfo>
- availableCreators(ProjectExplorer::Target *parent, CreationMode mode = UserCreate) const;
+ availableCreators(ProjectExplorer::Target *parent) const;
};
} // namespace Internal
diff --git a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp
index 7d09f18731..0fc0873785 100644
--- a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp
+++ b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp
@@ -444,10 +444,10 @@ bool DesktopQmakeRunConfigurationFactory::canCreateHelper(Target *parent, const
}
QList<RunConfigurationCreationInfo>
-DesktopQmakeRunConfigurationFactory::availableCreators(Target *parent, CreationMode mode) const
+DesktopQmakeRunConfigurationFactory::availableCreators(Target *parent) const
{
QmakeProject *project = static_cast<QmakeProject *>(parent->project());
- return Utils::transform(project->buildTargets(mode), [this](const BuildTargetInfo &ti) { return convert(ti); });
+ return project->runConfigurationCreators(this);
}
bool DesktopQmakeRunConfigurationFactory::hasRunConfigForProFile(RunConfiguration *rc, const Utils::FileName &n) const
diff --git a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.h b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.h
index 70eea33835..7451d02161 100644
--- a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.h
+++ b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.h
@@ -141,7 +141,7 @@ public:
bool canCreateHelper(ProjectExplorer::Target *parent, const QString &suffix) const override;
QList<ProjectExplorer::RunConfigurationCreationInfo>
- availableCreators(ProjectExplorer::Target *parent, CreationMode mode = UserCreate) const override;
+ availableCreators(ProjectExplorer::Target *parent) const override;
bool hasRunConfigForProFile(ProjectExplorer::RunConfiguration *rc, const Utils::FileName &n) const override;
};
diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp
index d5f741a947..84c335b063 100644
--- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp
@@ -50,6 +50,7 @@
#include <projectexplorer/deploymentdata.h>
#include <projectexplorer/headerpath.h>
#include <projectexplorer/projectexplorer.h>
+#include <projectexplorer/runconfiguration.h>
#include <projectexplorer/target.h>
#include <projectexplorer/taskhub.h>
#include <projectexplorer/toolchain.h>
@@ -784,26 +785,29 @@ bool QmakeProject::hasApplicationProFile(const FileName &path) const
return Utils::contains(list, Utils::equal(&QmakeProFile::filePath, path));
}
-QList<BuildTargetInfo> QmakeProject::buildTargets(IRunConfigurationFactory::CreationMode mode,
- const QList<ProjectType> &projectTypes)
+QList<RunConfigurationCreationInfo>
+QmakeProject::runConfigurationCreators(const IRunConfigurationFactory *factory,
+ const QList<ProjectType> &projectTypes)
{
QList<ProjectType> realTypes = projectTypes;
if (realTypes.isEmpty())
realTypes = {ProjectType::ApplicationTemplate, ProjectType::ScriptTemplate};
- QList<QmakeProFile *> files = allProFiles(realTypes);
- QList<QmakeProFile *> temp = files;
-
- if (mode == IRunConfigurationFactory::AutoCreate) {
- QList<QmakeProFile *> filtered = Utils::filtered(files, [](const QmakeProFile *f) {
- return f->isQtcRunnable();
- });
- temp = filtered.isEmpty() ? files : filtered;
- }
- return Utils::transform(temp, [](QmakeProFile *f) {
- BuildTargetInfo bti;
- bti.targetName = f->filePath().toString();
- return bti;
+ const QList<QmakeProFile *> files = allProFiles(realTypes);
+ const auto isQtcRunnable = [](const QmakeProFile *f) { return f->isQtcRunnable(); };
+ const bool hasAnyQtcRunnable = Utils::anyOf(files, isQtcRunnable);
+
+ return Utils::transform(files, [&](QmakeProFile *f) {
+ const QString targetName = f->filePath().toString();
+ return RunConfigurationCreationInfo {
+ factory,
+ factory->runConfigurationBaseId(),
+ targetName,
+ QFileInfo(targetName).completeBaseName(),
+ (hasAnyQtcRunnable && !f->isQtcRunnable())
+ ? RunConfigurationCreationInfo::ManualCreationOnly
+ : RunConfigurationCreationInfo::AlwaysCreate
+ };
});
}
diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.h b/src/plugins/qmakeprojectmanager/qmakeproject.h
index 3e745193e8..acb45f1161 100644
--- a/src/plugins/qmakeprojectmanager/qmakeproject.h
+++ b/src/plugins/qmakeprojectmanager/qmakeproject.h
@@ -73,9 +73,9 @@ public:
QList<QmakeProFile *> applicationProFiles(Parsing parse = ExactParse) const;
bool hasApplicationProFile(const Utils::FileName &path) const;
- QList<ProjectExplorer::BuildTargetInfo>
- buildTargets(ProjectExplorer::IRunConfigurationFactory::CreationMode mode,
- const QList<ProjectType> &projectTypes = {});
+ QList<ProjectExplorer::RunConfigurationCreationInfo> runConfigurationCreators
+ (const ProjectExplorer::IRunConfigurationFactory *factory,
+ const QList<ProjectType> &projectTypes = {});
static void notifyChanged(const Utils::FileName &name);
diff --git a/src/plugins/qnx/qnxrunconfigurationfactory.cpp b/src/plugins/qnx/qnxrunconfigurationfactory.cpp
index 05f9abfe8e..9a8ac138d6 100644
--- a/src/plugins/qnx/qnxrunconfigurationfactory.cpp
+++ b/src/plugins/qnx/qnxrunconfigurationfactory.cpp
@@ -46,9 +46,8 @@ QnxRunConfigurationFactory::QnxRunConfigurationFactory(QObject *parent) :
setSupportedTargetDeviceTypes({Constants::QNX_QNX_OS_TYPE});
}
-QList<RunConfigurationCreationInfo> QnxRunConfigurationFactory::availableCreators(Target *parent, IRunConfigurationFactory::CreationMode mode) const
+QList<RunConfigurationCreationInfo> QnxRunConfigurationFactory::availableCreators(Target *parent) const
{
- Q_UNUSED(mode);
return Utils::transform(parent->applicationTargets().list, [this](const BuildTargetInfo &bti) {
return convert(tr("%1 on QNX Device").arg(QFileInfo(bti.targetName).completeBaseName()), bti.targetName);
});
diff --git a/src/plugins/qnx/qnxrunconfigurationfactory.h b/src/plugins/qnx/qnxrunconfigurationfactory.h
index 4558ab3d9f..6e557da32d 100644
--- a/src/plugins/qnx/qnxrunconfigurationfactory.h
+++ b/src/plugins/qnx/qnxrunconfigurationfactory.h
@@ -27,8 +27,6 @@
#include <projectexplorer/runconfiguration.h>
-namespace QmakeProjectManager { class QmakeProFileNode; }
-
namespace Qnx {
namespace Internal {
@@ -39,7 +37,7 @@ public:
explicit QnxRunConfigurationFactory(QObject *parent = nullptr);
QList<ProjectExplorer::RunConfigurationCreationInfo>
- availableCreators(ProjectExplorer::Target *parent, CreationMode mode = UserCreate) const override;
+ availableCreators(ProjectExplorer::Target *parent) const override;
};
} // namespace Internal
diff --git a/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp b/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp
index 3b191162a4..af9ba0cbb3 100644
--- a/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp
+++ b/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp
@@ -51,9 +51,8 @@ RemoteLinuxRunConfigurationFactory::RemoteLinuxRunConfigurationFactory(QObject *
}
QList<RunConfigurationCreationInfo>
- RemoteLinuxRunConfigurationFactory::availableCreators(Target *parent, CreationMode mode) const
+ RemoteLinuxRunConfigurationFactory::availableCreators(Target *parent) const
{
- Q_UNUSED(mode);
return Utils::transform(parent->applicationTargets().list, [this](const BuildTargetInfo &bti) {
return convert(tr("%1 (on Remote Generic Linux Host)").arg(bti.targetName),
QFileInfo(bti.targetName).completeBaseName());
diff --git a/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.h b/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.h
index fd6a9682a1..9ce9d1a979 100644
--- a/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.h
+++ b/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.h
@@ -38,7 +38,7 @@ public:
explicit RemoteLinuxRunConfigurationFactory(QObject *parent = nullptr);
QList<ProjectExplorer::RunConfigurationCreationInfo>
- availableCreators(ProjectExplorer::Target *parent, CreationMode mode) const override;
+ availableCreators(ProjectExplorer::Target *parent) const override;
};
class RemoteLinuxCustomRunConfigurationFactory : public ProjectExplorer::FixedRunConfigurationFactory
diff --git a/src/plugins/winrt/winrtrunfactories.cpp b/src/plugins/winrt/winrtrunfactories.cpp
index 98b3917d93..465de83012 100644
--- a/src/plugins/winrt/winrtrunfactories.cpp
+++ b/src/plugins/winrt/winrtrunfactories.cpp
@@ -50,12 +50,13 @@ WinRtRunConfigurationFactory::WinRtRunConfigurationFactory()
Constants::WINRT_DEVICE_TYPE_EMULATOR});
}
-QList<RunConfigurationCreationInfo> WinRtRunConfigurationFactory::availableCreators(Target *parent, IRunConfigurationFactory::CreationMode mode) const
+QList<RunConfigurationCreationInfo> WinRtRunConfigurationFactory::availableCreators(Target *parent) const
{
QmakeProject *project = static_cast<QmakeProject *>(parent->project());
- const QList<BuildTargetInfo> buildTargets = project->buildTargets(mode);
- return Utils::transform(project->buildTargets(mode), [this](const BuildTargetInfo &bti) {
- return convert(tr("Run App Package"), bti.targetName);
+ const QList<RunConfigurationCreationInfo> list = project->runConfigurationCreators(this);
+ return Utils::transform(list, [this](RunConfigurationCreationInfo rci) {
+ rci.displayName = tr("Run App Package");
+ return rci;
});
}
diff --git a/src/plugins/winrt/winrtrunfactories.h b/src/plugins/winrt/winrtrunfactories.h
index 6de8c948e5..705e415946 100644
--- a/src/plugins/winrt/winrtrunfactories.h
+++ b/src/plugins/winrt/winrtrunfactories.h
@@ -39,7 +39,7 @@ public:
WinRtRunConfigurationFactory();
QList<ProjectExplorer::RunConfigurationCreationInfo>
- availableCreators(ProjectExplorer::Target *parent, CreationMode mode = UserCreate) const override;
+ availableCreators(ProjectExplorer::Target *parent) const override;
};
} // namespace Internal