forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -48,9 +48,8 @@ BareMetalRunConfigurationFactory::BareMetalRunConfigurationFactory(QObject *pare
|
|||||||
setSupportedTargetDeviceTypes({BareMetal::Constants::BareMetalOsType});
|
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 Utils::transform(parent->applicationTargets().list, [this](const BuildTargetInfo &bti) {
|
||||||
return convert(tr("%1 (on GDB server or hardware debugger)").arg(QFileInfo(bti.targetName).fileName()),
|
return convert(tr("%1 (on GDB server or hardware debugger)").arg(QFileInfo(bti.targetName).fileName()),
|
||||||
bti.projectFilePath.toString() + '/' + bti.targetName);
|
bti.projectFilePath.toString() + '/' + bti.targetName);
|
||||||
|
@@ -38,7 +38,7 @@ public:
|
|||||||
explicit BareMetalRunConfigurationFactory(QObject *parent = nullptr);
|
explicit BareMetalRunConfigurationFactory(QObject *parent = nullptr);
|
||||||
|
|
||||||
QList<ProjectExplorer::RunConfigurationCreationInfo>
|
QList<ProjectExplorer::RunConfigurationCreationInfo>
|
||||||
availableCreators(ProjectExplorer::Target *parent, CreationMode mode = UserCreate) const override;
|
availableCreators(ProjectExplorer::Target *parent) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class BareMetalCustomRunConfigurationFactory : public ProjectExplorer::FixedRunConfigurationFactory
|
class BareMetalCustomRunConfigurationFactory : public ProjectExplorer::FixedRunConfigurationFactory
|
||||||
|
@@ -239,10 +239,8 @@ CMakeRunConfigurationFactory::CMakeRunConfigurationFactory(QObject *parent) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList<RunConfigurationCreationInfo>
|
QList<RunConfigurationCreationInfo>
|
||||||
CMakeRunConfigurationFactory::availableCreators(Target *parent,
|
CMakeRunConfigurationFactory::availableCreators(Target *parent) const
|
||||||
IRunConfigurationFactory::CreationMode mode) const
|
|
||||||
{
|
{
|
||||||
Q_UNUSED(mode);
|
|
||||||
CMakeProject *project = static_cast<CMakeProject *>(parent->project());
|
CMakeProject *project = static_cast<CMakeProject *>(parent->project());
|
||||||
const QStringList titles = project->buildTargetTitles(true);
|
const QStringList titles = project->buildTargetTitles(true);
|
||||||
return Utils::transform(titles, [this](const QString &title) { return convert(title, title); });
|
return Utils::transform(titles, [this](const QString &title) { return convert(title, title); });
|
||||||
|
@@ -84,7 +84,7 @@ public:
|
|||||||
explicit CMakeRunConfigurationFactory(QObject *parent = 0);
|
explicit CMakeRunConfigurationFactory(QObject *parent = 0);
|
||||||
|
|
||||||
QList<ProjectExplorer::RunConfigurationCreationInfo>
|
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;
|
bool canCreateHelper(ProjectExplorer::Target *parent, const QString &suffix) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -52,22 +52,11 @@ IosRunConfigurationFactory::IosRunConfigurationFactory(QObject *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList<RunConfigurationCreationInfo>
|
QList<RunConfigurationCreationInfo>
|
||||||
IosRunConfigurationFactory::availableCreators(Target *parent, CreationMode mode) const
|
IosRunConfigurationFactory::availableCreators(Target *parent) const
|
||||||
{
|
{
|
||||||
auto project = static_cast<QmakeProject *>(parent->project());
|
auto project = static_cast<QmakeProject *>(parent->project());
|
||||||
return Utils::transform(project->buildTargets(mode, {ProjectType::ApplicationTemplate,
|
return project->runConfigurationCreators(this, {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});
|
ProjectType::SharedLibraryTemplate});
|
||||||
return Utils::contains(buildTargets, [buildTarget](const BuildTargetInfo &bti) {
|
|
||||||
return bti.targetName == buildTarget;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IosRunConfigurationFactory::hasRunConfigForProFile(RunConfiguration *rc, const Utils::FileName &n) const
|
bool IosRunConfigurationFactory::hasRunConfigForProFile(RunConfiguration *rc, const Utils::FileName &n) const
|
||||||
|
@@ -44,9 +44,7 @@ public:
|
|||||||
explicit IosRunConfigurationFactory(QObject *parent = 0);
|
explicit IosRunConfigurationFactory(QObject *parent = 0);
|
||||||
|
|
||||||
QList<ProjectExplorer::RunConfigurationCreationInfo>
|
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;
|
|
||||||
|
|
||||||
bool hasRunConfigForProFile(ProjectExplorer::RunConfiguration *rc, const Utils::FileName &n) const override;
|
bool hasRunConfigForProFile(ProjectExplorer::RunConfiguration *rc, const Utils::FileName &n) const override;
|
||||||
};
|
};
|
||||||
|
@@ -449,9 +449,8 @@ const QList<IRunConfigurationFactory *> IRunConfigurationFactory::allRunConfigur
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList<RunConfigurationCreationInfo>
|
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 Utils::transform(parent->applicationTargets().list, [this](const BuildTargetInfo &ti) {
|
||||||
return RunConfigurationCreationInfo(this, m_runConfigBaseId, ti.targetName,
|
return RunConfigurationCreationInfo(this, m_runConfigBaseId, ti.targetName,
|
||||||
QFileInfo(ti.targetName).completeBaseName());
|
QFileInfo(ti.targetName).completeBaseName());
|
||||||
@@ -610,12 +609,9 @@ FixedRunConfigurationFactory::FixedRunConfigurationFactory(const QString &displa
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
QList<RunConfigurationCreationInfo>
|
QList<RunConfigurationCreationInfo>
|
||||||
FixedRunConfigurationFactory::availableCreators(Target *parent, CreationMode mode) const
|
FixedRunConfigurationFactory::availableCreators(Target *parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(mode);
|
Q_UNUSED(parent);
|
||||||
if (!canHandle(parent))
|
|
||||||
return {};
|
|
||||||
|
|
||||||
return {RunConfigurationCreationInfo(this, runConfigurationBaseId(), QString(), m_fixedBuildTarget)};
|
return {RunConfigurationCreationInfo(this, runConfigurationBaseId(), QString(), m_fixedBuildTarget)};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -280,14 +280,22 @@ private:
|
|||||||
class RunConfigurationCreationInfo
|
class RunConfigurationCreationInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RunConfigurationCreationInfo(const IRunConfigurationFactory *factory, Core::Id id,
|
enum CreationMode {AlwaysCreate, ManualCreationOnly};
|
||||||
QString extra, QString displayName)
|
RunConfigurationCreationInfo(const IRunConfigurationFactory *factory,
|
||||||
: factory(factory) , id(id) , extra(extra) , displayName(displayName) {}
|
Core::Id id,
|
||||||
|
QString extra, QString displayName,
|
||||||
|
CreationMode creationMode = AlwaysCreate)
|
||||||
|
: factory(factory), id(id),
|
||||||
|
extra(extra),
|
||||||
|
displayName(displayName),
|
||||||
|
creationMode(creationMode)
|
||||||
|
{}
|
||||||
|
|
||||||
const IRunConfigurationFactory *factory = nullptr;
|
const IRunConfigurationFactory *factory = nullptr;
|
||||||
Core::Id id;
|
Core::Id id;
|
||||||
QString extra;
|
QString extra;
|
||||||
QString displayName;
|
QString displayName;
|
||||||
|
CreationMode creationMode = AlwaysCreate;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT IRunConfigurationFactory : public QObject
|
class PROJECTEXPLORER_EXPORT IRunConfigurationFactory : public QObject
|
||||||
@@ -300,10 +308,7 @@ public:
|
|||||||
|
|
||||||
static const QList<IRunConfigurationFactory *> allRunConfigurationFactories();
|
static const QList<IRunConfigurationFactory *> allRunConfigurationFactories();
|
||||||
|
|
||||||
enum CreationMode {UserCreate, AutoCreate};
|
virtual QList<RunConfigurationCreationInfo> availableCreators(Target *parent) const;
|
||||||
|
|
||||||
virtual QList<RunConfigurationCreationInfo> availableCreators(Target *parent,
|
|
||||||
CreationMode mode = UserCreate) const;
|
|
||||||
|
|
||||||
virtual bool canHandle(Target *target) const;
|
virtual bool canHandle(Target *target) const;
|
||||||
|
|
||||||
@@ -317,6 +322,8 @@ public:
|
|||||||
static IRunConfigurationFactory *find(Target *parent, RunConfiguration *rc);
|
static IRunConfigurationFactory *find(Target *parent, RunConfiguration *rc);
|
||||||
static QList<IRunConfigurationFactory *> find(Target *parent);
|
static QList<IRunConfigurationFactory *> find(Target *parent);
|
||||||
|
|
||||||
|
Core::Id runConfigurationBaseId() const { return m_runConfigBaseId; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool canCreateHelper(Target *parent, const QString &buildTarget) const;
|
virtual bool canCreateHelper(Target *parent, const QString &buildTarget) const;
|
||||||
|
|
||||||
@@ -333,8 +340,6 @@ protected:
|
|||||||
void setSupportedTargetDeviceTypes(const QList<Core::Id> &ids);
|
void setSupportedTargetDeviceTypes(const QList<Core::Id> &ids);
|
||||||
void setDisplayNamePattern(const QString &pattern);
|
void setDisplayNamePattern(const QString &pattern);
|
||||||
|
|
||||||
Core::Id runConfigurationBaseId() const { return m_runConfigBaseId; }
|
|
||||||
|
|
||||||
RunConfigurationCreationInfo convert(const BuildTargetInfo &ti) const;
|
RunConfigurationCreationInfo convert(const BuildTargetInfo &ti) const;
|
||||||
RunConfigurationCreationInfo convert(const QString &displayName, const QString &targetName = QString()) const;
|
RunConfigurationCreationInfo convert(const QString &displayName, const QString &targetName = QString()) const;
|
||||||
|
|
||||||
@@ -352,8 +357,7 @@ class PROJECTEXPLORER_EXPORT FixedRunConfigurationFactory : public IRunConfigura
|
|||||||
public:
|
public:
|
||||||
explicit FixedRunConfigurationFactory(const QString &displayName, QObject *parent = nullptr);
|
explicit FixedRunConfigurationFactory(const QString &displayName, QObject *parent = nullptr);
|
||||||
|
|
||||||
QList<RunConfigurationCreationInfo> availableCreators(Target *parent,
|
QList<RunConfigurationCreationInfo> availableCreators(Target *parent) const override;
|
||||||
CreationMode mode = UserCreate) const override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QString m_fixedBuildTarget;
|
const QString m_fixedBuildTarget;
|
||||||
|
@@ -554,14 +554,19 @@ void Target::updateDefaultRunConfigurations()
|
|||||||
int configuredCount = existingConfigured.count();
|
int configuredCount = existingConfigured.count();
|
||||||
|
|
||||||
// find all RC ids that can get created:
|
// find all RC ids that can get created:
|
||||||
QList<RunConfigurationCreationInfo> availableFactories;
|
QList<RunConfigurationCreationInfo> allAvailableFactories;
|
||||||
for (IRunConfigurationFactory *rcFactory : rcFactories)
|
|
||||||
availableFactories.append(rcFactory->availableCreators(this));
|
|
||||||
|
|
||||||
QList<RunConfigurationCreationInfo> autoCreateFactories;
|
QList<RunConfigurationCreationInfo> autoCreateFactories;
|
||||||
for (IRunConfigurationFactory *rcFactory : rcFactories)
|
|
||||||
autoCreateFactories.append(rcFactory->availableCreators(this,
|
for (IRunConfigurationFactory *rcFactory : rcFactories) {
|
||||||
IRunConfigurationFactory::AutoCreate));
|
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
|
// Put outdated RCs into toRemove, do not bother with factories
|
||||||
// that produce already existing RCs
|
// that produce already existing RCs
|
||||||
@@ -569,7 +574,7 @@ void Target::updateDefaultRunConfigurations()
|
|||||||
QList<RunConfigurationCreationInfo> existing;
|
QList<RunConfigurationCreationInfo> existing;
|
||||||
foreach (RunConfiguration *rc, existingConfigured) {
|
foreach (RunConfiguration *rc, existingConfigured) {
|
||||||
bool present = false;
|
bool present = false;
|
||||||
for (const RunConfigurationCreationInfo &item : availableFactories) {
|
for (const RunConfigurationCreationInfo &item : allAvailableFactories) {
|
||||||
if (item.id == rc->id() && item.extra == rc->extraId()) {
|
if (item.id == rc->id() && item.extra == rc->extraId()) {
|
||||||
existing.append(item);
|
existing.append(item);
|
||||||
present = true;
|
present = true;
|
||||||
|
@@ -271,10 +271,8 @@ public:
|
|||||||
addSupportedProjectType(PythonProjectId);
|
addSupportedProjectType(PythonProjectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<RunConfigurationCreationInfo> availableCreators(Target *parent,
|
QList<RunConfigurationCreationInfo> availableCreators(Target *parent) const override
|
||||||
CreationMode mode) const override
|
|
||||||
{
|
{
|
||||||
Q_UNUSED(mode);
|
|
||||||
return Utils::transform(parent->project()->files(Project::AllFiles),[this](const FileName &fn) {
|
return Utils::transform(parent->project()->files(Project::AllFiles),[this](const FileName &fn) {
|
||||||
return convert(fn.toString(), fn.toString());
|
return convert(fn.toString(), fn.toString());
|
||||||
});
|
});
|
||||||
|
@@ -385,7 +385,7 @@ bool QbsRunConfigurationFactory::canCreateHelper(Target *parent, const QString &
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList<RunConfigurationCreationInfo>
|
QList<RunConfigurationCreationInfo>
|
||||||
QbsRunConfigurationFactory::availableCreators(Target *parent, CreationMode mode) const
|
QbsRunConfigurationFactory::availableCreators(Target *parent) const
|
||||||
{
|
{
|
||||||
QList<qbs::ProductData> products;
|
QList<qbs::ProductData> products;
|
||||||
|
|
||||||
@@ -398,19 +398,23 @@ QbsRunConfigurationFactory::availableCreators(Target *parent, CreationMode mode)
|
|||||||
products << product;
|
products << product;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == AutoCreate) {
|
const auto isQtcRunnable = [](const qbs::ProductData &product) {
|
||||||
std::function<bool (const qbs::ProductData &)> hasQtcRunnable = [](const qbs::ProductData &product) {
|
|
||||||
return product.properties().value("qtcRunnable").toBool();
|
return product.properties().value("qtcRunnable").toBool();
|
||||||
};
|
};
|
||||||
|
const bool hasAnyQtcRunnable = Utils::anyOf(products, isQtcRunnable);
|
||||||
|
|
||||||
if (Utils::anyOf(products, hasQtcRunnable))
|
return Utils::transform(products, [&](const qbs::ProductData &product) {
|
||||||
Utils::erase(products, std::not1(hasQtcRunnable));
|
|
||||||
}
|
|
||||||
|
|
||||||
return Utils::transform(products, [this, project](const qbs::ProductData &product) {
|
|
||||||
const QString displayName = product.fullDisplayName();
|
const QString displayName = product.fullDisplayName();
|
||||||
const QString targetName = QbsProject::uniqueProductName(product) + rcNameSeparator() + displayName;
|
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
|
||||||
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -119,7 +119,7 @@ public:
|
|||||||
bool canCreateHelper(ProjectExplorer::Target *parent, const QString &suffix) const override;
|
bool canCreateHelper(ProjectExplorer::Target *parent, const QString &suffix) const override;
|
||||||
|
|
||||||
QList<ProjectExplorer::RunConfigurationCreationInfo>
|
QList<ProjectExplorer::RunConfigurationCreationInfo>
|
||||||
availableCreators(ProjectExplorer::Target *parent, CreationMode mode = UserCreate) const override;
|
availableCreators(ProjectExplorer::Target *parent) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -56,12 +56,10 @@ QmakeAndroidRunConfigurationFactory::QmakeAndroidRunConfigurationFactory(QObject
|
|||||||
setSupportedTargetDeviceTypes({Android::Constants::ANDROID_DEVICE_TYPE});
|
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());
|
auto project = static_cast<QmakeProject *>(parent->project());
|
||||||
return Utils::transform(project->buildTargets(mode, {ProjectType::ApplicationTemplate, ProjectType::SharedLibraryTemplate}),
|
return project->runConfigurationCreators(this, {ProjectType::ApplicationTemplate, ProjectType::SharedLibraryTemplate});
|
||||||
[this](const BuildTargetInfo &ti) { return convert(ti); });
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -40,7 +40,7 @@ public:
|
|||||||
explicit QmakeAndroidRunConfigurationFactory(QObject *parent = nullptr);
|
explicit QmakeAndroidRunConfigurationFactory(QObject *parent = nullptr);
|
||||||
|
|
||||||
QList<ProjectExplorer::RunConfigurationCreationInfo>
|
QList<ProjectExplorer::RunConfigurationCreationInfo>
|
||||||
availableCreators(ProjectExplorer::Target *parent, CreationMode mode = UserCreate) const;
|
availableCreators(ProjectExplorer::Target *parent) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -444,10 +444,10 @@ bool DesktopQmakeRunConfigurationFactory::canCreateHelper(Target *parent, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList<RunConfigurationCreationInfo>
|
QList<RunConfigurationCreationInfo>
|
||||||
DesktopQmakeRunConfigurationFactory::availableCreators(Target *parent, CreationMode mode) const
|
DesktopQmakeRunConfigurationFactory::availableCreators(Target *parent) const
|
||||||
{
|
{
|
||||||
QmakeProject *project = static_cast<QmakeProject *>(parent->project());
|
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
|
bool DesktopQmakeRunConfigurationFactory::hasRunConfigForProFile(RunConfiguration *rc, const Utils::FileName &n) const
|
||||||
|
@@ -141,7 +141,7 @@ public:
|
|||||||
bool canCreateHelper(ProjectExplorer::Target *parent, const QString &suffix) const override;
|
bool canCreateHelper(ProjectExplorer::Target *parent, const QString &suffix) const override;
|
||||||
|
|
||||||
QList<ProjectExplorer::RunConfigurationCreationInfo>
|
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;
|
bool hasRunConfigForProFile(ProjectExplorer::RunConfiguration *rc, const Utils::FileName &n) const override;
|
||||||
};
|
};
|
||||||
|
@@ -50,6 +50,7 @@
|
|||||||
#include <projectexplorer/deploymentdata.h>
|
#include <projectexplorer/deploymentdata.h>
|
||||||
#include <projectexplorer/headerpath.h>
|
#include <projectexplorer/headerpath.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
|
#include <projectexplorer/runconfiguration.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
#include <projectexplorer/taskhub.h>
|
#include <projectexplorer/taskhub.h>
|
||||||
#include <projectexplorer/toolchain.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));
|
return Utils::contains(list, Utils::equal(&QmakeProFile::filePath, path));
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<BuildTargetInfo> QmakeProject::buildTargets(IRunConfigurationFactory::CreationMode mode,
|
QList<RunConfigurationCreationInfo>
|
||||||
|
QmakeProject::runConfigurationCreators(const IRunConfigurationFactory *factory,
|
||||||
const QList<ProjectType> &projectTypes)
|
const QList<ProjectType> &projectTypes)
|
||||||
{
|
{
|
||||||
QList<ProjectType> realTypes = projectTypes;
|
QList<ProjectType> realTypes = projectTypes;
|
||||||
if (realTypes.isEmpty())
|
if (realTypes.isEmpty())
|
||||||
realTypes = {ProjectType::ApplicationTemplate, ProjectType::ScriptTemplate};
|
realTypes = {ProjectType::ApplicationTemplate, ProjectType::ScriptTemplate};
|
||||||
QList<QmakeProFile *> files = allProFiles(realTypes);
|
|
||||||
QList<QmakeProFile *> temp = files;
|
|
||||||
|
|
||||||
if (mode == IRunConfigurationFactory::AutoCreate) {
|
const QList<QmakeProFile *> files = allProFiles(realTypes);
|
||||||
QList<QmakeProFile *> filtered = Utils::filtered(files, [](const QmakeProFile *f) {
|
const auto isQtcRunnable = [](const QmakeProFile *f) { return f->isQtcRunnable(); };
|
||||||
return f->isQtcRunnable();
|
const bool hasAnyQtcRunnable = Utils::anyOf(files, isQtcRunnable);
|
||||||
});
|
|
||||||
temp = filtered.isEmpty() ? files : filtered;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Utils::transform(temp, [](QmakeProFile *f) {
|
return Utils::transform(files, [&](QmakeProFile *f) {
|
||||||
BuildTargetInfo bti;
|
const QString targetName = f->filePath().toString();
|
||||||
bti.targetName = f->filePath().toString();
|
return RunConfigurationCreationInfo {
|
||||||
return bti;
|
factory,
|
||||||
|
factory->runConfigurationBaseId(),
|
||||||
|
targetName,
|
||||||
|
QFileInfo(targetName).completeBaseName(),
|
||||||
|
(hasAnyQtcRunnable && !f->isQtcRunnable())
|
||||||
|
? RunConfigurationCreationInfo::ManualCreationOnly
|
||||||
|
: RunConfigurationCreationInfo::AlwaysCreate
|
||||||
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -73,8 +73,8 @@ public:
|
|||||||
QList<QmakeProFile *> applicationProFiles(Parsing parse = ExactParse) const;
|
QList<QmakeProFile *> applicationProFiles(Parsing parse = ExactParse) const;
|
||||||
bool hasApplicationProFile(const Utils::FileName &path) const;
|
bool hasApplicationProFile(const Utils::FileName &path) const;
|
||||||
|
|
||||||
QList<ProjectExplorer::BuildTargetInfo>
|
QList<ProjectExplorer::RunConfigurationCreationInfo> runConfigurationCreators
|
||||||
buildTargets(ProjectExplorer::IRunConfigurationFactory::CreationMode mode,
|
(const ProjectExplorer::IRunConfigurationFactory *factory,
|
||||||
const QList<ProjectType> &projectTypes = {});
|
const QList<ProjectType> &projectTypes = {});
|
||||||
|
|
||||||
static void notifyChanged(const Utils::FileName &name);
|
static void notifyChanged(const Utils::FileName &name);
|
||||||
|
@@ -46,9 +46,8 @@ QnxRunConfigurationFactory::QnxRunConfigurationFactory(QObject *parent) :
|
|||||||
setSupportedTargetDeviceTypes({Constants::QNX_QNX_OS_TYPE});
|
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 Utils::transform(parent->applicationTargets().list, [this](const BuildTargetInfo &bti) {
|
||||||
return convert(tr("%1 on QNX Device").arg(QFileInfo(bti.targetName).completeBaseName()), bti.targetName);
|
return convert(tr("%1 on QNX Device").arg(QFileInfo(bti.targetName).completeBaseName()), bti.targetName);
|
||||||
});
|
});
|
||||||
|
@@ -27,8 +27,6 @@
|
|||||||
|
|
||||||
#include <projectexplorer/runconfiguration.h>
|
#include <projectexplorer/runconfiguration.h>
|
||||||
|
|
||||||
namespace QmakeProjectManager { class QmakeProFileNode; }
|
|
||||||
|
|
||||||
namespace Qnx {
|
namespace Qnx {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -39,7 +37,7 @@ public:
|
|||||||
explicit QnxRunConfigurationFactory(QObject *parent = nullptr);
|
explicit QnxRunConfigurationFactory(QObject *parent = nullptr);
|
||||||
|
|
||||||
QList<ProjectExplorer::RunConfigurationCreationInfo>
|
QList<ProjectExplorer::RunConfigurationCreationInfo>
|
||||||
availableCreators(ProjectExplorer::Target *parent, CreationMode mode = UserCreate) const override;
|
availableCreators(ProjectExplorer::Target *parent) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -51,9 +51,8 @@ RemoteLinuxRunConfigurationFactory::RemoteLinuxRunConfigurationFactory(QObject *
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList<RunConfigurationCreationInfo>
|
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 Utils::transform(parent->applicationTargets().list, [this](const BuildTargetInfo &bti) {
|
||||||
return convert(tr("%1 (on Remote Generic Linux Host)").arg(bti.targetName),
|
return convert(tr("%1 (on Remote Generic Linux Host)").arg(bti.targetName),
|
||||||
QFileInfo(bti.targetName).completeBaseName());
|
QFileInfo(bti.targetName).completeBaseName());
|
||||||
|
@@ -38,7 +38,7 @@ public:
|
|||||||
explicit RemoteLinuxRunConfigurationFactory(QObject *parent = nullptr);
|
explicit RemoteLinuxRunConfigurationFactory(QObject *parent = nullptr);
|
||||||
|
|
||||||
QList<ProjectExplorer::RunConfigurationCreationInfo>
|
QList<ProjectExplorer::RunConfigurationCreationInfo>
|
||||||
availableCreators(ProjectExplorer::Target *parent, CreationMode mode) const override;
|
availableCreators(ProjectExplorer::Target *parent) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RemoteLinuxCustomRunConfigurationFactory : public ProjectExplorer::FixedRunConfigurationFactory
|
class RemoteLinuxCustomRunConfigurationFactory : public ProjectExplorer::FixedRunConfigurationFactory
|
||||||
|
@@ -50,12 +50,13 @@ WinRtRunConfigurationFactory::WinRtRunConfigurationFactory()
|
|||||||
Constants::WINRT_DEVICE_TYPE_EMULATOR});
|
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());
|
QmakeProject *project = static_cast<QmakeProject *>(parent->project());
|
||||||
const QList<BuildTargetInfo> buildTargets = project->buildTargets(mode);
|
const QList<RunConfigurationCreationInfo> list = project->runConfigurationCreators(this);
|
||||||
return Utils::transform(project->buildTargets(mode), [this](const BuildTargetInfo &bti) {
|
return Utils::transform(list, [this](RunConfigurationCreationInfo rci) {
|
||||||
return convert(tr("Run App Package"), bti.targetName);
|
rci.displayName = tr("Run App Package");
|
||||||
|
return rci;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -39,7 +39,7 @@ public:
|
|||||||
WinRtRunConfigurationFactory();
|
WinRtRunConfigurationFactory();
|
||||||
|
|
||||||
QList<ProjectExplorer::RunConfigurationCreationInfo>
|
QList<ProjectExplorer::RunConfigurationCreationInfo>
|
||||||
availableCreators(ProjectExplorer::Target *parent, CreationMode mode = UserCreate) const override;
|
availableCreators(ProjectExplorer::Target *parent) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
Reference in New Issue
Block a user