diff options
Diffstat (limited to 'src/plugins')
8 files changed, 69 insertions, 15 deletions
diff --git a/src/plugins/qbsprojectmanager/qbsbuildconfiguration.cpp b/src/plugins/qbsprojectmanager/qbsbuildconfiguration.cpp index 33ab5efe22..f35c0740f5 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildconfiguration.cpp +++ b/src/plugins/qbsprojectmanager/qbsbuildconfiguration.cpp @@ -56,6 +56,8 @@ using namespace ProjectExplorer; namespace QbsProjectManager { namespace Internal { +static QString configNameKey() { return "Qbs.configName"; } + const char QBS_BC_ID[] = "Qbs.QbsBuildConfiguration"; // --------------------------------------------------------------------------- @@ -81,6 +83,7 @@ QbsBuildConfiguration::QbsBuildConfiguration(Target *target, Core::Id id) : QbsBuildConfiguration::QbsBuildConfiguration(Target *target, QbsBuildConfiguration *source) : BuildConfiguration(target, source) { + m_configurationName = source->configurationName(); cloneSteps(source); } @@ -89,6 +92,13 @@ bool QbsBuildConfiguration::fromMap(const QVariantMap &map) if (!BuildConfiguration::fromMap(map)) return false; + m_configurationName = map.value(configNameKey()).toString(); + if (m_configurationName.isEmpty()) { // pre-4.4 backwards compatibility + const QString profileName = QbsManager::instance()->profileForKit(target()->kit()); + const QString buildVariant = qbsConfiguration() + .value(QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY)).toString(); + m_configurationName = profileName + QLatin1Char('-') + buildVariant; + } BuildStepList *bsl = stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD); // Fix up the existing build steps: for (int i = 0; i < bsl->count(); ++i) { @@ -100,6 +110,13 @@ bool QbsBuildConfiguration::fromMap(const QVariantMap &map) return true; } +QVariantMap QbsBuildConfiguration::toMap() const +{ + QVariantMap map = BuildConfiguration::toMap(); + map.insert(configNameKey(), m_configurationName); + return map; +} + void QbsBuildConfiguration::buildStepInserted(int pos) { QbsBuildStep *step = qobject_cast<QbsBuildStep *>(stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD)->at(pos)); @@ -201,12 +218,17 @@ void QbsBuildConfiguration::emitBuildTypeChanged() emit buildTypeChanged(); } +void QbsBuildConfiguration::setConfigurationName(const QString &configName) +{ + if (m_configurationName == configName) + return; + m_configurationName = configName; + emit buildDirectoryChanged(); +} + QString QbsBuildConfiguration::configurationName() const { - const QString profileName = QbsManager::instance()->profileForKit(target()->kit()); - const QString buildVariant = qbsConfiguration() - .value(QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY)).toString(); - return profileName + QLatin1Char('-') + buildVariant; + return m_configurationName; } class StepProxy @@ -351,10 +373,17 @@ QbsBuildConfiguration *QbsBuildConfiguration::setup(Target *t, bc->setDefaultDisplayName(defaultDisplayName); bc->setDisplayName(displayName); bc->setBuildDirectory(directory); + QVariantMap bd = buildData; + QString configName = bd.take("configName").toString(); + if (configName.isEmpty()) { + configName = "qtc_" + t->kit()->fileSystemFriendlyName() + QLatin1Char('_') + + Utils::FileUtils::fileSystemFriendlyName(displayName); + } + bc->setConfigurationName(configName); BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD); QbsBuildStep *bs = new QbsBuildStep(buildSteps); - bs->setQbsConfiguration(buildData); + bs->setQbsConfiguration(bd); buildSteps->insertStep(0, bs); BuildStepList *cleanSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN); diff --git a/src/plugins/qbsprojectmanager/qbsbuildconfiguration.h b/src/plugins/qbsprojectmanager/qbsbuildconfiguration.h index 08313cc396..6df507fde6 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildconfiguration.h +++ b/src/plugins/qbsprojectmanager/qbsbuildconfiguration.h @@ -76,6 +76,7 @@ public: void emitBuildTypeChanged(); + void setConfigurationName(const QString &configName); QString configurationName() const; QString equivalentCommandLine(const ProjectExplorer::BuildStep *buildStep) const; @@ -87,6 +88,7 @@ protected: QbsBuildConfiguration(ProjectExplorer::Target *target, QbsBuildConfiguration *source); QbsBuildConfiguration(ProjectExplorer::Target *target, Core::Id id); bool fromMap(const QVariantMap &map) override; + QVariantMap toMap() const override; private: void buildStepInserted(int pos); @@ -102,6 +104,7 @@ private: QStringList m_changedFiles; QStringList m_activeFileTags; QStringList m_products; + QString m_configurationName; friend class QbsBuildConfigurationFactory; friend class QbsBuildConfigurationWidget; diff --git a/src/plugins/qbsprojectmanager/qbsbuildconfigurationwidget.cpp b/src/plugins/qbsprojectmanager/qbsbuildconfigurationwidget.cpp index 5dfdaaa32e..e87e18752f 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildconfigurationwidget.cpp +++ b/src/plugins/qbsprojectmanager/qbsbuildconfigurationwidget.cpp @@ -34,6 +34,7 @@ #include <QGridLayout> #include <QLabel> +#include <QLineEdit> #include <QWidget> namespace QbsProjectManager { @@ -59,16 +60,22 @@ QbsBuildConfigurationWidget::QbsBuildConfigurationWidget(QbsProjectManager::Inte QGridLayout *layout = new QGridLayout(details); layout->setMargin(0); - layout->addWidget(new QLabel(tr("Build directory:"), 0, 0)); + layout->addWidget(new QLabel(tr("Build directory:")), 0, 0); m_buildDirChooser = new Utils::PathChooser; m_buildDirChooser->setExpectedKind(Utils::PathChooser::Directory); m_buildDirChooser->setBaseFileName(bc->target()->project()->projectDirectory()); m_buildDirChooser->setEnvironment(bc->environment()); layout->addWidget(m_buildDirChooser, 0, 1); + layout->addWidget(new QLabel(tr("Configuration name:")), 1, 0); + m_configNameEdit = new QLineEdit; + m_configNameEdit->setText(m_buildConfiguration->configurationName()); + layout->addWidget(m_configNameEdit, 1, 1); connect(m_buildDirChooser, &Utils::PathChooser::rawPathChanged, this, &QbsBuildConfigurationWidget::buildDirEdited); + connect(m_configNameEdit, &QLineEdit::textEdited, + this, &QbsBuildConfigurationWidget::configNameEdited); buildDirectoryChanged(); } @@ -79,6 +86,12 @@ void QbsBuildConfigurationWidget::buildDirEdited() m_buildConfiguration->setBuildDirectory(m_buildDirChooser->fileName()); } +void QbsBuildConfigurationWidget::configNameEdited() +{ + m_ignoreChange = true; + m_buildConfiguration->setConfigurationName(m_configNameEdit->text()); +} + void QbsBuildConfigurationWidget::buildDirectoryChanged() { if (m_ignoreChange) diff --git a/src/plugins/qbsprojectmanager/qbsbuildconfigurationwidget.h b/src/plugins/qbsprojectmanager/qbsbuildconfigurationwidget.h index bdb6f6352b..48ffaa5fcc 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildconfigurationwidget.h +++ b/src/plugins/qbsprojectmanager/qbsbuildconfigurationwidget.h @@ -32,6 +32,10 @@ class DetailsWidget; class PathChooser; } // namespace Utils +QT_BEGIN_NAMESPACE +class QLineEdit; +QT_END_NAMESPACE + namespace QbsProjectManager { namespace Internal { class QbsBuildConfiguration; @@ -45,6 +49,7 @@ public: private: void buildDirEdited(); + void configNameEdited(); // Changes triggered from creator void buildDirectoryChanged(); @@ -53,6 +58,7 @@ private: private: Internal::QbsBuildConfiguration *m_buildConfiguration; Utils::PathChooser *m_buildDirChooser; + QLineEdit *m_configNameEdit; bool m_ignoreChange; }; diff --git a/src/plugins/qbsprojectmanager/qbsproject.cpp b/src/plugins/qbsprojectmanager/qbsproject.cpp index c6366f9e32..693023ece4 100644 --- a/src/plugins/qbsprojectmanager/qbsproject.cpp +++ b/src/plugins/qbsprojectmanager/qbsproject.cpp @@ -606,7 +606,8 @@ void QbsProject::parseCurrentBuildConfiguration() return; } - parse(bc->qbsConfiguration(), bc->environment(), bc->buildDirectory().toString()); + parse(bc->qbsConfiguration(), bc->environment(), bc->buildDirectory().toString(), + bc->configurationName()); } void QbsProject::cancelParsing() @@ -690,7 +691,8 @@ QString QbsProject::uniqueProductName(const qbs::ProductData &product) return product.name() + QLatin1Char('.') + product.profile(); } -void QbsProject::parse(const QVariantMap &config, const Environment &env, const QString &dir) +void QbsProject::parse(const QVariantMap &config, const Environment &env, const QString &dir, + const QString &configName) { prepareForParsing(); QTC_ASSERT(!m_qbsProjectParser, return); @@ -698,7 +700,7 @@ void QbsProject::parse(const QVariantMap &config, const Environment &env, const registerQbsProjectParser(new QbsProjectParser(this, m_qbsUpdateFutureInterface)); QbsManager::instance()->updateProfileIfNecessary(activeTarget()->kit()); - m_qbsProjectParser->parse(config, env, dir); + m_qbsProjectParser->parse(config, env, dir, configName); emit projectParsingStarted(); } diff --git a/src/plugins/qbsprojectmanager/qbsproject.h b/src/plugins/qbsprojectmanager/qbsproject.h index abf9cdbbf4..017934156d 100644 --- a/src/plugins/qbsprojectmanager/qbsproject.h +++ b/src/plugins/qbsprojectmanager/qbsproject.h @@ -124,7 +124,8 @@ private: RestoreResult fromMap(const QVariantMap &map, QString *errorMessage) override; - void parse(const QVariantMap &config, const Utils::Environment &env, const QString &dir); + void parse(const QVariantMap &config, const Utils::Environment &env, const QString &dir, + const QString &configName); void prepareForParsing(); void updateDocuments(const QSet<QString> &files); diff --git a/src/plugins/qbsprojectmanager/qbsprojectparser.cpp b/src/plugins/qbsprojectmanager/qbsprojectparser.cpp index eeb24d5637..fa5c10b421 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectparser.cpp +++ b/src/plugins/qbsprojectmanager/qbsprojectparser.cpp @@ -74,7 +74,8 @@ QbsProjectParser::~QbsProjectParser() m_fi = 0; // we do not own m_fi, do not delete } -void QbsProjectParser::parse(const QVariantMap &config, const Environment &env, const QString &dir) +void QbsProjectParser::parse(const QVariantMap &config, const Environment &env, const QString &dir, + const QString &configName) { QTC_ASSERT(!m_qbsSetupProjectJob, return); QTC_ASSERT(!dir.isEmpty(), return); @@ -86,9 +87,7 @@ void QbsProjectParser::parse(const QVariantMap &config, const Environment &env, QString specialKey = QLatin1String(Constants::QBS_CONFIG_PROFILE_KEY); const QString profileName = userConfig.take(specialKey).toString(); params.setTopLevelProfile(profileName); - const QString buildVariantKey = QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY); - const QString buildVariant = userConfig.value(buildVariantKey).toString(); - params.setConfigurationName(profileName + QLatin1Char('-') + buildVariant); + params.setConfigurationName(configName); specialKey = QLatin1String(Constants::QBS_FORCE_PROBES_KEY); params.setForceProbeExecution(userConfig.take(specialKey).toBool()); params.setSettingsDirectory(QbsManager::settings()->baseDirectory()); diff --git a/src/plugins/qbsprojectmanager/qbsprojectparser.h b/src/plugins/qbsprojectmanager/qbsprojectparser.h index 0d140233f6..2ae45c8f9c 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectparser.h +++ b/src/plugins/qbsprojectmanager/qbsprojectparser.h @@ -46,7 +46,8 @@ public: QFutureInterface<bool> *fi); ~QbsProjectParser(); - void parse(const QVariantMap &config, const Utils::Environment &env, const QString &dir); + void parse(const QVariantMap &config, const Utils::Environment &env, const QString &dir, + const QString &configName); void startRuleExecution(); void cancel(); |