forked from qt-creator/qt-creator
QbsProjectManager: Make use of qbs config --add-profile
... if available. Task-number: QTCREATORBUG-25463 Change-Id: I7fc8a06a5c43b35c4b1b571504d31cc03a95b189 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -183,9 +183,13 @@ void QbsProfileManager::addProfileFromKit(const ProjectExplorer::Kit *k)
|
|||||||
if (const QtSupport::BaseQtVersion * const qt = QtSupport::QtKitAspect::qtVersion(k))
|
if (const QtSupport::BaseQtVersion * const qt = QtSupport::QtKitAspect::qtVersion(k))
|
||||||
data.insert("moduleProviders.Qt.qmakeFilePaths", qt->qmakeCommand().toString());
|
data.insert("moduleProviders.Qt.qmakeFilePaths", qt->qmakeCommand().toString());
|
||||||
|
|
||||||
|
if (QbsSettings::qbsVersion() < QVersionNumber({1, 20})) {
|
||||||
const QString keyPrefix = "profiles." + name + ".";
|
const QString keyPrefix = "profiles." + name + ".";
|
||||||
for (auto it = data.begin(); it != data.end(); ++it)
|
for (auto it = data.begin(); it != data.end(); ++it)
|
||||||
runQbsConfig(QbsConfigOp::Set, keyPrefix + it.key(), it.value());
|
runQbsConfig(QbsConfigOp::Set, keyPrefix + it.key(), it.value());
|
||||||
|
} else {
|
||||||
|
runQbsConfig(QbsConfigOp::AddProfile, name, data);
|
||||||
|
}
|
||||||
emit qbsProfilesUpdated();
|
emit qbsProfilesUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,6 +232,13 @@ QString QbsProfileManager::runQbsConfig(QbsConfigOp op, const QString &key, cons
|
|||||||
case QbsConfigOp::Unset:
|
case QbsConfigOp::Unset:
|
||||||
args << "--unset" << key;
|
args << "--unset" << key;
|
||||||
break;
|
break;
|
||||||
|
case QbsConfigOp::AddProfile: {
|
||||||
|
args << "--add-profile" << key;
|
||||||
|
const QVariantMap props = value.toMap();
|
||||||
|
for (auto it = props.begin(); it != props.end(); ++it)
|
||||||
|
args << it.key() << toJSLiteral(it.value());
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const Utils::FilePath qbsExe = QbsSettings::qbsExecutableFilePath();
|
const Utils::FilePath qbsExe = QbsSettings::qbsExecutableFilePath();
|
||||||
if (qbsExe.isEmpty() || !qbsExe.exists())
|
if (qbsExe.isEmpty() || !qbsExe.exists())
|
||||||
|
|||||||
@@ -52,7 +52,8 @@ public:
|
|||||||
static QString ensureProfileForKit(const ProjectExplorer::Kit *k);
|
static QString ensureProfileForKit(const ProjectExplorer::Kit *k);
|
||||||
static QString profileNameForKit(const ProjectExplorer::Kit *kit);
|
static QString profileNameForKit(const ProjectExplorer::Kit *kit);
|
||||||
static void updateProfileIfNecessary(const ProjectExplorer::Kit *kit);
|
static void updateProfileIfNecessary(const ProjectExplorer::Kit *kit);
|
||||||
enum class QbsConfigOp { Get, Set, Unset }; static QString runQbsConfig(QbsConfigOp op, const QString &key, const QVariant &value = {});
|
enum class QbsConfigOp { Get, Set, Unset, AddProfile };
|
||||||
|
static QString runQbsConfig(QbsConfigOp op, const QString &key, const QVariant &value = {});
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void qbsProfilesUpdated();
|
void qbsProfilesUpdated();
|
||||||
|
|||||||
Reference in New Issue
Block a user