forked from qt-creator/qt-creator
QbsPM: Implement configureAsExampleProject function
This function is used in some of the plugin unit tests of QC. Change-Id: I8e5f5b734a78a207f139b676aa6616abcc9ce7c0 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
#include <cpptools/cppprojectupdater.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <projectexplorer/buildenvironmentwidget.h>
|
||||
#include <projectexplorer/buildinfo.h>
|
||||
#include <projectexplorer/buildmanager.h>
|
||||
#include <projectexplorer/buildtargetinfo.h>
|
||||
#include <projectexplorer/deploymentdata.h>
|
||||
@@ -689,6 +690,30 @@ QString QbsProject::uniqueProductName(const qbs::ProductData &product)
|
||||
return product.name() + QLatin1Char('.') + product.profile();
|
||||
}
|
||||
|
||||
void QbsProject::configureAsExampleProject(const QSet<Id> &platforms)
|
||||
{
|
||||
QList<const BuildInfo *> infoList;
|
||||
QList<Kit *> kits = KitManager::kits();
|
||||
const auto qtVersionMatchesPlatform = [platforms](const QtSupport::BaseQtVersion *version) {
|
||||
return platforms.isEmpty() || platforms.intersects(version->targetDeviceTypes());
|
||||
};
|
||||
foreach (Kit *k, kits) {
|
||||
const QtSupport::BaseQtVersion * const qtVersion
|
||||
= QtSupport::QtKitInformation::qtVersion(k);
|
||||
if (!qtVersion || !qtVersionMatchesPlatform(qtVersion))
|
||||
continue;
|
||||
const IBuildConfigurationFactory * const factory
|
||||
= IBuildConfigurationFactory::find(k, projectFilePath().toString());
|
||||
if (!factory)
|
||||
continue;
|
||||
for (BuildInfo * const info : factory->availableSetups(k, projectFilePath().toString()))
|
||||
infoList << info;
|
||||
}
|
||||
setup(infoList);
|
||||
qDeleteAll(infoList);
|
||||
prepareForParsing();
|
||||
}
|
||||
|
||||
void QbsProject::parse(const QVariantMap &config, const Environment &env, const QString &dir,
|
||||
const QString &configName)
|
||||
{
|
||||
|
@@ -108,6 +108,8 @@ public:
|
||||
const qbs::ProductData &product);
|
||||
static QString uniqueProductName(const qbs::ProductData &product);
|
||||
|
||||
void configureAsExampleProject(const QSet<Core::Id> &platforms) final;
|
||||
|
||||
public:
|
||||
void invalidate();
|
||||
void delayParsing();
|
||||
|
Reference in New Issue
Block a user