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:
@@ -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;
|
||||
}
|
||||
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(temp, [](QmakeProFile *f) {
|
||||
BuildTargetInfo bti;
|
||||
bti.targetName = f->filePath().toString();
|
||||
return bti;
|
||||
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
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user