diff options
18 files changed, 179 insertions, 798 deletions
diff --git a/src/plugins/qbsprojectmanager/qbsbuildconfiguration.cpp b/src/plugins/qbsprojectmanager/qbsbuildconfiguration.cpp index e1a21eee3f..4313b062f2 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildconfiguration.cpp +++ b/src/plugins/qbsprojectmanager/qbsbuildconfiguration.cpp @@ -28,7 +28,6 @@ #include "qbsbuildconfigurationwidget.h" #include "qbsbuildstep.h" #include "qbscleanstep.h" -#include "qbsinstallstep.h" #include "qbsproject.h" #include "qbsprojectmanagerconstants.h" #include "qbsprojectmanagersettings.h" @@ -200,38 +199,39 @@ void QbsBuildConfiguration::emitBuildTypeChanged() emit buildTypeChanged(); } +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; +} + class StepProxy { public: StepProxy(const BuildStep *buildStep) : m_qbsBuildStep(qobject_cast<const QbsBuildStep *>(buildStep)) , m_qbsCleanStep(qobject_cast<const QbsCleanStep *>(buildStep)) - , m_qbsInstallStep(qobject_cast<const QbsInstallStep *>(buildStep)) { } QString command() const { if (m_qbsBuildStep) return QLatin1String("build"); - if (m_qbsCleanStep) - return QLatin1String("clean"); - return QLatin1String("install"); + return QLatin1String("clean"); } bool dryRun() const { if (m_qbsBuildStep) return false; - if (m_qbsCleanStep) - return m_qbsCleanStep->dryRun(); - return m_qbsInstallStep->dryRun(); + return m_qbsCleanStep->dryRun(); } bool keepGoing() const { if (m_qbsBuildStep) return m_qbsBuildStep->keepGoing(); - if (m_qbsCleanStep) - return m_qbsCleanStep->keepGoing(); - return m_qbsInstallStep->keepGoing(); + return m_qbsCleanStep->keepGoing(); } bool showCommandLines() const { @@ -245,8 +245,6 @@ public: bool cleanInstallRoot() const { if (m_qbsBuildStep) return m_qbsBuildStep->cleanInstallRoot(); - if (m_qbsInstallStep) - return m_qbsInstallStep->removeFirst(); return false; } @@ -254,17 +252,18 @@ public: return m_qbsBuildStep ? m_qbsBuildStep->maxJobs() : 0; } - QString installRoot() const { - return m_qbsInstallStep ? m_qbsInstallStep->absoluteInstallRoot() : QString(); + Utils::FileName installRoot() const { + if (m_qbsBuildStep && m_qbsBuildStep->hasCustomInstallRoot()) + return m_qbsBuildStep->installRoot(); + return Utils::FileName(); } private: const QbsBuildStep * const m_qbsBuildStep; const QbsCleanStep * const m_qbsCleanStep; - const QbsInstallStep * const m_qbsInstallStep; }; -QString QbsBuildConfiguration::equivalentCommandLine(const BuildStep *buildStep) +QString QbsBuildConfiguration::equivalentCommandLine(const BuildStep *buildStep) const { QString commandLine; const QString qbsInstallDir = QString::fromLocal8Bit(qgetenv("QBS_INSTALL_DIR")); @@ -274,12 +273,8 @@ QString QbsBuildConfiguration::equivalentCommandLine(const BuildStep *buildStep) Utils::QtcProcess::addArg(&commandLine, QDir::toNativeSeparators(qbsFilePath)); const StepProxy stepProxy(buildStep); Utils::QtcProcess::addArg(&commandLine, stepProxy.command()); - const QbsBuildConfiguration * const buildConfig = qobject_cast<QbsBuildConfiguration *>( - buildStep->project()->activeTarget()->activeBuildConfiguration()); - if (buildConfig) { - const QString buildDir = buildConfig->buildDirectory().toUserOutput(); - Utils::QtcProcess::addArgs(&commandLine, QStringList({ "-d", buildDir })); - } + const QString buildDir = buildDirectory().toUserOutput(); + Utils::QtcProcess::addArgs(&commandLine, QStringList({ "-d", buildDir })); Utils::QtcProcess::addArgs(&commandLine, QStringList("-f") << buildStep->project()->projectFilePath().toUserOutput()); if (QbsProjectManagerSettings::useCreatorSettingsDirForQbs()) { @@ -302,19 +297,16 @@ QString QbsBuildConfiguration::equivalentCommandLine(const BuildStep *buildStep) Utils::QtcProcess::addArgs(&commandLine, QStringList({ "--jobs", QString::number(jobCount) })); } - const QString installRoot = stepProxy.installRoot(); - if (!installRoot.isEmpty()) { - Utils::QtcProcess::addArgs(&commandLine, QStringList({ "--install-root", installRoot })); - } - const QString profileName = QbsManager::instance()->profileForKit(buildStep->target()->kit()); - if (buildConfig) { - const QString buildVariant = buildConfig->qbsConfiguration() - .value(QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY)).toString(); - const QString configName = profileName + QLatin1Char('-') + buildVariant; - Utils::QtcProcess::addArg(&commandLine, configName); - Utils::QtcProcess::addArg(&commandLine, QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY) + const QString buildVariant = qbsConfiguration() + .value(QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY)).toString(); + Utils::QtcProcess::addArg(&commandLine, configurationName()); + Utils::QtcProcess::addArg(&commandLine, QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY) + QLatin1Char(':') + buildVariant); + const Utils::FileName installRoot = stepProxy.installRoot(); + if (!installRoot.isEmpty()) { + Utils::QtcProcess::addArg(&commandLine, QLatin1String(Constants::QBS_INSTALL_ROOT_KEY) + + QLatin1Char(':') + installRoot.toUserOutput()); } Utils::QtcProcess::addArg(&commandLine, QLatin1String("profile:") + profileName); diff --git a/src/plugins/qbsprojectmanager/qbsbuildconfiguration.h b/src/plugins/qbsprojectmanager/qbsbuildconfiguration.h index c399e14fff..08313cc396 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildconfiguration.h +++ b/src/plugins/qbsprojectmanager/qbsbuildconfiguration.h @@ -76,7 +76,9 @@ public: void emitBuildTypeChanged(); - static QString equivalentCommandLine(const ProjectExplorer::BuildStep *buildStep); + QString configurationName() const; + + QString equivalentCommandLine(const ProjectExplorer::BuildStep *buildStep) const; signals: void qbsConfigurationChanged(); diff --git a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp index 5e1ffa775a..0627a3b479 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp +++ b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp @@ -82,6 +82,8 @@ private: void changeJobCount(int count); void changeInstall(bool install); void changeCleanInstallRoot(bool clean); + void changeUseDefaultInstallDir(bool useDefault); + void changeInstallDir(const QString &dir); void changeForceProbes(bool forceProbes); void applyCachedProperties(); @@ -259,6 +261,24 @@ bool QbsBuildStep::cleanInstallRoot() const return m_qbsBuildOptions.removeExistingInstallation(); } +bool QbsBuildStep::hasCustomInstallRoot() const +{ + return m_qbsConfiguration.contains(QLatin1String(Constants::QBS_INSTALL_ROOT_KEY)); +} + +Utils::FileName QbsBuildStep::installRoot() const +{ + Utils::FileName root = Utils::FileName::fromString(m_qbsConfiguration + .value(QLatin1String(Constants::QBS_INSTALL_ROOT_KEY)).toString()); + if (root.isNull()) { + const QbsBuildConfiguration * const bc + = static_cast<QbsBuildConfiguration *>(buildConfiguration()); + root = bc->buildDirectory().appendPath(bc->configurationName()) + .appendPath(qbs::InstallOptions::defaultInstallRoot()); + } + return root; +} + int QbsBuildStep::maxJobs() const { if (m_qbsBuildOptions.maxJobCount() > 0) @@ -538,6 +558,7 @@ QbsBuildStepConfigWidget::QbsBuildStepConfigWidget(QbsBuildStep *step) : m_ui = new Ui::QbsBuildStepConfigWidget; m_ui->setupUi(this); + m_ui->installDirChooser->setExpectedKind(Utils::PathChooser::Directory); auto chooser = new Core::VariableChooser(this); chooser->addSupportedWidget(m_ui->propertyEdit); @@ -560,6 +581,10 @@ QbsBuildStepConfigWidget::QbsBuildStepConfigWidget(QbsBuildStep *step) : &QbsBuildStepConfigWidget::changeInstall); connect(m_ui->cleanInstallRootCheckBox, &QCheckBox::toggled, this, &QbsBuildStepConfigWidget::changeCleanInstallRoot); + connect(m_ui->defaultInstallDirCheckBox, &QCheckBox::toggled, this, + &QbsBuildStepConfigWidget::changeUseDefaultInstallDir); + connect(m_ui->installDirChooser, &Utils::PathChooser::rawPathChanged, this, + &QbsBuildStepConfigWidget::changeInstallDir); connect(m_ui->forceProbesCheckBox, &QCheckBox::toggled, this, &QbsBuildStepConfigWidget::changeForceProbes); connect(m_ui->qmlDebuggingLibraryCheckBox, &QAbstractButton::toggled, @@ -595,6 +620,8 @@ void QbsBuildStepConfigWidget::updateState() m_ui->forceProbesCheckBox->setChecked(m_step->forceProbes()); updatePropertyEdit(m_step->qbsConfiguration(QbsBuildStep::PreserveVariables)); m_ui->qmlDebuggingLibraryCheckBox->setChecked(m_step->isQmlDebuggingEnabled()); + m_ui->installDirChooser->setFileName(m_step->installRoot()); + m_ui->defaultInstallDirCheckBox->setChecked(!m_step->hasCustomInstallRoot()); } updateQmlDebuggingOption(); @@ -602,7 +629,8 @@ void QbsBuildStepConfigWidget::updateState() const QString buildVariant = m_step->buildVariant(); const int idx = (buildVariant == QLatin1String(Constants::QBS_VARIANT_DEBUG)) ? 0 : 1; m_ui->buildVariantComboBox->setCurrentIndex(idx); - QString command = QbsBuildConfiguration::equivalentCommandLine(m_step); + QString command = static_cast<QbsBuildConfiguration *>(m_step->buildConfiguration()) + ->equivalentCommandLine(m_step); for (int i = 0; i < m_propertyCache.count(); ++i) { command += QLatin1Char(' ') + m_propertyCache.at(i).name @@ -645,6 +673,7 @@ void QbsBuildStepConfigWidget::updatePropertyEdit(const QVariantMap &data) editable.remove(QLatin1String(Constants::QBS_CONFIG_DECLARATIVE_DEBUG_KEY)); editable.remove(QLatin1String(Constants::QBS_CONFIG_QUICK_DEBUG_KEY)); editable.remove(QLatin1String(Constants::QBS_FORCE_PROBES_KEY)); + editable.remove(QLatin1String(Constants::QBS_INSTALL_ROOT_KEY)); QStringList propertyList; for (QVariantMap::const_iterator i = editable.constBegin(); i != editable.constEnd(); ++i) @@ -700,6 +729,30 @@ void QbsBuildStepConfigWidget::changeCleanInstallRoot(bool clean) m_ignoreChange = false; } +void QbsBuildStepConfigWidget::changeUseDefaultInstallDir(bool useDefault) +{ + m_ignoreChange = true; + QVariantMap config = m_step->qbsConfiguration(QbsBuildStep::PreserveVariables); + m_ui->installDirChooser->setEnabled(!useDefault); + if (useDefault) + config.remove(Constants::QBS_INSTALL_ROOT_KEY); + else + config.insert(Constants::QBS_INSTALL_ROOT_KEY, m_ui->installDirChooser->rawPath()); + m_step->setQbsConfiguration(config); + m_ignoreChange = false; +} + +void QbsBuildStepConfigWidget::changeInstallDir(const QString &dir) +{ + if (!m_step->hasCustomInstallRoot()) + return; + m_ignoreChange = true; + QVariantMap config = m_step->qbsConfiguration(QbsBuildStep::PreserveVariables); + config.insert(Constants::QBS_INSTALL_ROOT_KEY, dir); + m_step->setQbsConfiguration(config); + m_ignoreChange = false; +} + void QbsBuildStepConfigWidget::changeForceProbes(bool forceProbes) { m_ignoreChange = true; diff --git a/src/plugins/qbsprojectmanager/qbsbuildstep.h b/src/plugins/qbsprojectmanager/qbsbuildstep.h index af1cf9ef2e..8682347589 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildstep.h +++ b/src/plugins/qbsprojectmanager/qbsbuildstep.h @@ -71,6 +71,8 @@ public: bool showCommandLines() const; bool install() const; bool cleanInstallRoot() const; + bool hasCustomInstallRoot() const; + Utils::FileName installRoot() const; int maxJobs() const; QString buildVariant() const; diff --git a/src/plugins/qbsprojectmanager/qbsbuildstepconfigwidget.ui b/src/plugins/qbsprojectmanager/qbsbuildstepconfigwidget.ui index 83319a163e..562dcc3e85 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildstepconfigwidget.ui +++ b/src/plugins/qbsprojectmanager/qbsbuildstepconfigwidget.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>730</width> - <height>256</height> + <width>809</width> + <height>416</height> </rect> </property> <layout class="QFormLayout" name="formLayout"> @@ -157,46 +157,28 @@ <item row="4" column="1"> <layout class="QHBoxLayout" name="horizontalLayout_2"> <item> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="0" column="0"> - <widget class="QCheckBox" name="keepGoingCheckBox"> - <property name="toolTip"> - <string>Keep going when errors occur (if at all possible).</string> - </property> - <property name="text"> - <string>Keep going</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QCheckBox" name="showCommandLinesCheckBox"> - <property name="text"> - <string>Show command lines</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QCheckBox" name="installCheckBox"> - <property name="text"> - <string>Install</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QCheckBox" name="cleanInstallRootCheckBox"> - <property name="text"> - <string>Clean install root</string> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QCheckBox" name="forceProbesCheckBox"> - <property name="text"> - <string>Force probes</string> - </property> - </widget> - </item> - </layout> + <widget class="QCheckBox" name="keepGoingCheckBox"> + <property name="toolTip"> + <string>Keep going when errors occur (if at all possible).</string> + </property> + <property name="text"> + <string>Keep going</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="showCommandLinesCheckBox"> + <property name="text"> + <string>Show command lines</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="forceProbesCheckBox"> + <property name="text"> + <string>Force probes</string> + </property> + </widget> </item> <item> <spacer name="checkBoxSpacer"> @@ -214,6 +196,61 @@ </layout> </item> <item row="5" column="0"> + <widget class="QLabel" name="installFlagsLabel"> + <property name="text"> + <string>Installation flags:</string> + </property> + </widget> + </item> + <item row="5" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QCheckBox" name="installCheckBox"> + <property name="text"> + <string>Install</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="cleanInstallRootCheckBox"> + <property name="text"> + <string>Clean install root</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="defaultInstallDirCheckBox"> + <property name="text"> + <string>Use default location</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item row="6" column="0"> + <widget class="QLabel" name="installDirLabel"> + <property name="text"> + <string>Installation directory:</string> + </property> + </widget> + </item> + <item row="6" column="1"> + <widget class="Utils::PathChooser" name="installDirChooser"/> + </item> + <item row="7" column="0"> <widget class="QLabel" name="commandLineKeyLabel"> <property name="text"> <string>Equivalent command line:</string> @@ -223,7 +260,7 @@ </property> </widget> </item> - <item row="5" column="1"> + <item row="7" column="1"> <widget class="QPlainTextEdit" name="commandLineTextEdit"> <property name="undoRedoEnabled"> <bool>false</bool> @@ -248,6 +285,10 @@ <zorder>flagsLabel</zorder> <zorder>jobsLabel</zorder> <zorder>commandLineTextEdit</zorder> + <zorder>installFlagsLabel</zorder> + <zorder>defaultInstallDirCheckBox</zorder> + <zorder>installDirChooser</zorder> + <zorder>installDirLabel</zorder> </widget> <customwidgets> <customwidget> @@ -255,6 +296,11 @@ <extends>QLineEdit</extends> <header location="global">utils/fancylineedit.h</header> </customwidget> + <customwidget> + <class>Utils::PathChooser</class> + <extends>QLineEdit</extends> + <header location="global">utils/pathchooser.h</header> + </customwidget> </customwidgets> <tabstops> <tabstop>buildVariantComboBox</tabstop> diff --git a/src/plugins/qbsprojectmanager/qbscleanstep.cpp b/src/plugins/qbsprojectmanager/qbscleanstep.cpp index 02ae120956..e693a7bcc4 100644 --- a/src/plugins/qbsprojectmanager/qbscleanstep.cpp +++ b/src/plugins/qbsprojectmanager/qbscleanstep.cpp @@ -271,7 +271,8 @@ void QbsCleanStepConfigWidget::updateState() m_ui->dryRunCheckBox->setChecked(m_step->dryRun()); m_ui->keepGoingCheckBox->setChecked(m_step->keepGoing()); - QString command = QbsBuildConfiguration::equivalentCommandLine(m_step); + QString command = static_cast<QbsBuildConfiguration *>(m_step->buildConfiguration()) + ->equivalentCommandLine(m_step); m_ui->commandLineTextEdit->setPlainText(command); QString summary = tr("<b>Qbs:</b> %1").arg(command); diff --git a/src/plugins/qbsprojectmanager/qbsdeployconfigurationfactory.cpp b/src/plugins/qbsprojectmanager/qbsdeployconfigurationfactory.cpp index cbadd8f871..b91ece82db 100644 --- a/src/plugins/qbsprojectmanager/qbsdeployconfigurationfactory.cpp +++ b/src/plugins/qbsprojectmanager/qbsdeployconfigurationfactory.cpp @@ -25,7 +25,6 @@ #include "qbsdeployconfigurationfactory.h" -#include "qbsinstallstep.h" #include "qbsproject.h" #include <projectexplorer/buildsteplist.h> @@ -53,11 +52,6 @@ static Core::Id genericQbsDeployConfigurationId() // QbsDeployConfiguration: // -------------------------------------------------------------------- -QbsInstallStep *QbsDeployConfiguration::qbsInstallStep() const -{ - return stepList()->firstOfType<QbsInstallStep>(); -} - QbsDeployConfiguration::QbsDeployConfiguration(ProjectExplorer::Target *target, Core::Id id) : ProjectExplorer::DeployConfiguration(target, id) { } diff --git a/src/plugins/qbsprojectmanager/qbsdeployconfigurationfactory.h b/src/plugins/qbsprojectmanager/qbsdeployconfigurationfactory.h index 5f12cc2820..91ca997e23 100644 --- a/src/plugins/qbsprojectmanager/qbsdeployconfigurationfactory.h +++ b/src/plugins/qbsprojectmanager/qbsdeployconfigurationfactory.h @@ -33,15 +33,11 @@ namespace QbsProjectManager { namespace Internal { class QbsDeployConfigurationFactory; -class QbsInstallStep; class QbsDeployConfiguration : public ProjectExplorer::DeployConfiguration { Q_OBJECT -public: - QbsInstallStep *qbsInstallStep() const; - private: QbsDeployConfiguration(ProjectExplorer::Target *target, Core::Id id); QbsDeployConfiguration(ProjectExplorer::Target *target, diff --git a/src/plugins/qbsprojectmanager/qbsinstallstep.cpp b/src/plugins/qbsprojectmanager/qbsinstallstep.cpp deleted file mode 100644 index 87e16ead04..0000000000 --- a/src/plugins/qbsprojectmanager/qbsinstallstep.cpp +++ /dev/null @@ -1,388 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "qbsinstallstep.h" - -#include "qbsbuildconfiguration.h" -#include "qbsproject.h" -#include "qbsprojectmanagerconstants.h" - -#include "ui_qbsinstallstepconfigwidget.h" - -#include <coreplugin/icore.h> -#include <projectexplorer/buildsteplist.h> -#include <projectexplorer/deployconfiguration.h> -#include <projectexplorer/kit.h> -#include <projectexplorer/projectexplorerconstants.h> -#include <projectexplorer/target.h> -#include <utils/qtcassert.h> - -#include <QFileInfo> - -// -------------------------------------------------------------------- -// Constants: -// -------------------------------------------------------------------- - -static const char QBS_INSTALL_ROOT[] = "Qbs.InstallRoot"; -static const char QBS_REMOVE_FIRST[] = "Qbs.RemoveFirst"; -static const char QBS_DRY_RUN[] = "Qbs.DryRun"; -static const char QBS_KEEP_GOING[] = "Qbs.DryKeepGoing"; - -namespace QbsProjectManager { -namespace Internal { - -// -------------------------------------------------------------------- -// QbsInstallStep: -// -------------------------------------------------------------------- - -QbsInstallStep::QbsInstallStep(ProjectExplorer::BuildStepList *bsl) : - ProjectExplorer::BuildStep(bsl, Core::Id(Constants::QBS_INSTALLSTEP_ID)), - m_job(0), m_showCompilerOutput(true), m_parser(0) -{ - setDisplayName(tr("Qbs Install")); -} - -QbsInstallStep::QbsInstallStep(ProjectExplorer::BuildStepList *bsl, const QbsInstallStep *other) : - ProjectExplorer::BuildStep(bsl, Core::Id(Constants::QBS_INSTALLSTEP_ID)), - m_qbsInstallOptions(other->m_qbsInstallOptions), m_job(0), - m_showCompilerOutput(other->m_showCompilerOutput), m_parser(0) -{ } - -QbsInstallStep::~QbsInstallStep() -{ - cancel(); - if (m_job) - m_job->deleteLater(); - m_job = 0; -} - -bool QbsInstallStep::init(QList<const BuildStep *> &earlierSteps) -{ - Q_UNUSED(earlierSteps); - QTC_ASSERT(!static_cast<QbsProject *>(project())->isParsing() && !m_job, return false); - return true; -} - -void QbsInstallStep::run(QFutureInterface<bool> &fi) -{ - m_fi = &fi; - - QbsProject *pro = static_cast<QbsProject *>(project()); - m_job = pro->install(m_qbsInstallOptions); - - if (!m_job) { - reportRunResult(*m_fi, false); - return; - } - - m_progressBase = 0; - - connect(m_job, &qbs::AbstractJob::finished, this, &QbsInstallStep::installDone); - connect(m_job, &qbs::AbstractJob::taskStarted, - this, &QbsInstallStep::handleTaskStarted); - connect(m_job, &qbs::AbstractJob::taskProgress, - this, &QbsInstallStep::handleProgress); -} - -ProjectExplorer::BuildStepConfigWidget *QbsInstallStep::createConfigWidget() -{ - return new QbsInstallStepConfigWidget(this); -} - -bool QbsInstallStep::runInGuiThread() const -{ - return true; -} - -void QbsInstallStep::cancel() -{ - if (m_job) - m_job->cancel(); -} - -QString QbsInstallStep::installRoot() const -{ - if (!m_qbsInstallOptions.installRoot().isEmpty()) - return m_qbsInstallOptions.installRoot(); - - return qbs::InstallOptions::defaultInstallRoot(); -} - -QString QbsInstallStep::absoluteInstallRoot() const -{ - const qbs::ProjectData data = static_cast<QbsProject *>(project())->qbsProjectData(); - QString path = installRoot(); - if (data.isValid() && !data.buildDirectory().isEmpty() && !path.isEmpty()) - path = QDir(data.buildDirectory()).absoluteFilePath(path); - return path; -} - -bool QbsInstallStep::removeFirst() const -{ - return m_qbsInstallOptions.removeExistingInstallation(); -} - -bool QbsInstallStep::dryRun() const -{ - return m_qbsInstallOptions.dryRun(); -} - -bool QbsInstallStep::keepGoing() const -{ - return m_qbsInstallOptions.keepGoing(); -} - -bool QbsInstallStep::fromMap(const QVariantMap &map) -{ - if (!ProjectExplorer::BuildStep::fromMap(map)) - return false; - - setInstallRoot(map.value(QLatin1String(QBS_INSTALL_ROOT)).toString()); - m_qbsInstallOptions.setRemoveExistingInstallation(map.value(QLatin1String(QBS_REMOVE_FIRST), false).toBool()); - m_qbsInstallOptions.setDryRun(map.value(QLatin1String(QBS_DRY_RUN), false).toBool()); - m_qbsInstallOptions.setKeepGoing(map.value(QLatin1String(QBS_KEEP_GOING), false).toBool()); - - return true; -} - -QVariantMap QbsInstallStep::toMap() const -{ - QVariantMap map = ProjectExplorer::BuildStep::toMap(); - map.insert(QLatin1String(QBS_INSTALL_ROOT), m_qbsInstallOptions.installRoot()); - map.insert(QLatin1String(QBS_REMOVE_FIRST), m_qbsInstallOptions.removeExistingInstallation()); - map.insert(QLatin1String(QBS_DRY_RUN), m_qbsInstallOptions.dryRun()); - map.insert(QLatin1String(QBS_KEEP_GOING), m_qbsInstallOptions.keepGoing()); - - return map; -} - -qbs::InstallOptions QbsInstallStep::installOptions() const -{ - return m_qbsInstallOptions; -} - -void QbsInstallStep::installDone(bool success) -{ - // Report errors: - foreach (const qbs::ErrorItem &item, m_job->error().items()) { - createTaskAndOutput(ProjectExplorer::Task::Error, item.description(), - item.codeLocation().filePath(), item.codeLocation().line()); - } - - QTC_ASSERT(m_fi, return); - reportRunResult(*m_fi, success); - m_fi = 0; // do not delete, it is not ours - m_job->deleteLater(); - m_job = 0; -} - -void QbsInstallStep::handleTaskStarted(const QString &desciption, int max) -{ - Q_UNUSED(desciption); - QTC_ASSERT(m_fi, return); - m_progressBase = m_fi->progressValue(); - m_fi->setProgressRange(0, m_progressBase + max); -} - -void QbsInstallStep::handleProgress(int value) -{ - QTC_ASSERT(m_fi, return); - m_fi->setProgressValue(m_progressBase + value); -} - -void QbsInstallStep::createTaskAndOutput(ProjectExplorer::Task::TaskType type, - const QString &message, const QString &file, int line) -{ - ProjectExplorer::Task task = ProjectExplorer::Task(type, message, - Utils::FileName::fromString(file), line, - ProjectExplorer::Constants::TASK_CATEGORY_COMPILE); - emit addTask(task, 1); - emit addOutput(message, OutputFormat::Stdout); -} - -void QbsInstallStep::setInstallRoot(const QString &ir) -{ - if (m_qbsInstallOptions.installRoot() == ir) - return; - m_qbsInstallOptions.setInstallRoot(ir); - emit changed(); -} - -void QbsInstallStep::setRemoveFirst(bool rf) -{ - if (m_qbsInstallOptions.removeExistingInstallation() == rf) - return; - m_qbsInstallOptions.setRemoveExistingInstallation(rf); - emit changed(); -} - -void QbsInstallStep::setDryRun(bool dr) -{ - if (m_qbsInstallOptions.dryRun() == dr) - return; - m_qbsInstallOptions.setDryRun(dr); - emit changed(); -} - -void QbsInstallStep::setKeepGoing(bool kg) -{ - if (m_qbsInstallOptions.keepGoing() == kg) - return; - m_qbsInstallOptions.setKeepGoing(kg); - emit changed(); -} - -// -------------------------------------------------------------------- -// QbsInstallStepConfigWidget: -// -------------------------------------------------------------------- - -QbsInstallStepConfigWidget::QbsInstallStepConfigWidget(QbsInstallStep *step) : - m_step(step), m_ignoreChange(false) -{ - connect(m_step, &ProjectExplorer::ProjectConfiguration::displayNameChanged, - this, &QbsInstallStepConfigWidget::updateState); - connect(m_step, &QbsInstallStep::changed, - this, &QbsInstallStepConfigWidget::updateState); - - setContentsMargins(0, 0, 0, 0); - - QbsProject *project = static_cast<QbsProject *>(m_step->project()); - - m_ui = new Ui::QbsInstallStepConfigWidget; - m_ui->setupUi(this); - - m_ui->installRootChooser->setPromptDialogTitle(tr("Qbs Install Prefix")); - m_ui->installRootChooser->setExpectedKind(Utils::PathChooser::Directory); - m_ui->installRootChooser->setHistoryCompleter(QLatin1String("Qbs.InstallRoot.History")); - - connect(m_ui->installRootChooser, &Utils::PathChooser::rawPathChanged, this, - &QbsInstallStepConfigWidget::changeInstallRoot); - connect(m_ui->removeFirstCheckBox, &QAbstractButton::toggled, - this, &QbsInstallStepConfigWidget::changeRemoveFirst); - connect(m_ui->dryRunCheckBox, &QAbstractButton::toggled, - this, &QbsInstallStepConfigWidget::changeDryRun); - connect(m_ui->keepGoingCheckBox, &QAbstractButton::toggled, - this, &QbsInstallStepConfigWidget::changeKeepGoing); - - connect(project, &QbsProject::projectParsingDone, - this, &QbsInstallStepConfigWidget::updateState); - - updateState(); -} - -QbsInstallStepConfigWidget::~QbsInstallStepConfigWidget() -{ - delete m_ui; -} - -QString QbsInstallStepConfigWidget::summaryText() const -{ - return m_summary; -} - -QString QbsInstallStepConfigWidget::displayName() const -{ - return m_step->displayName(); -} - -void QbsInstallStepConfigWidget::updateState() -{ - if (!m_ignoreChange) { - m_ui->installRootChooser->setPath(m_step->installRoot()); - m_ui->removeFirstCheckBox->setChecked(m_step->removeFirst()); - m_ui->dryRunCheckBox->setChecked(m_step->dryRun()); - m_ui->keepGoingCheckBox->setChecked(m_step->keepGoing()); - } - - m_ui->installRootChooser->setBaseFileName(m_step->target()->activeBuildConfiguration()->buildDirectory()); - - QString command = QbsBuildConfiguration::equivalentCommandLine(m_step); - m_ui->commandLineTextEdit->setPlainText(command); - - QString summary = tr("<b>Qbs:</b> %1").arg(command); - if (m_summary != summary) { - m_summary = summary; - emit updateSummary(); - } -} - -void QbsInstallStepConfigWidget::changeInstallRoot() -{ - const QString path = m_ui->installRootChooser->path(); - if (m_step->installRoot() == path) - return; - - m_ignoreChange = true; - m_step->setInstallRoot(path); - m_ignoreChange = false; -} - -void QbsInstallStepConfigWidget::changeRemoveFirst(bool rf) -{ - m_step->setRemoveFirst(rf); -} - -void QbsInstallStepConfigWidget::changeDryRun(bool dr) -{ - m_step->setDryRun(dr); -} - -void QbsInstallStepConfigWidget::changeKeepGoing(bool kg) -{ - m_step->setKeepGoing(kg); -} - -// -------------------------------------------------------------------- -// QbsInstallStepFactory: -// -------------------------------------------------------------------- - -QbsInstallStepFactory::QbsInstallStepFactory(QObject *parent) : - ProjectExplorer::IBuildStepFactory(parent) -{ } - -QList<ProjectExplorer::BuildStepInfo> QbsInstallStepFactory::availableSteps(ProjectExplorer::BuildStepList *parent) const -{ - if (parent->id() == ProjectExplorer::Constants::BUILDSTEPS_DEPLOY - && qobject_cast<ProjectExplorer::DeployConfiguration *>(parent->parent()) - && qobject_cast<QbsProject *>(parent->target()->project())) - return {{ Constants::QBS_INSTALLSTEP_ID, tr("Qbs Install") }}; - return {}; -} - -ProjectExplorer::BuildStep *QbsInstallStepFactory::create(ProjectExplorer::BuildStepList *parent, - const Core::Id id) -{ - Q_UNUSED(id); - return new QbsInstallStep(parent); -} - -ProjectExplorer::BuildStep *QbsInstallStepFactory::clone(ProjectExplorer::BuildStepList *parent, - ProjectExplorer::BuildStep *product) -{ - return new QbsInstallStep(parent, static_cast<QbsInstallStep *>(product)); -} - -} // namespace Internal -} // namespace QbsProjectManager diff --git a/src/plugins/qbsprojectmanager/qbsinstallstep.h b/src/plugins/qbsprojectmanager/qbsinstallstep.h deleted file mode 100644 index 609a2099dc..0000000000 --- a/src/plugins/qbsprojectmanager/qbsinstallstep.h +++ /dev/null @@ -1,137 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include "qbsbuildconfiguration.h" - -#include <projectexplorer/buildstep.h> -#include <projectexplorer/task.h> - -#include <qbs.h> - -namespace QbsProjectManager { -namespace Internal { - -class QbsInstallStepConfigWidget; - -class QbsInstallStep : public ProjectExplorer::BuildStep -{ - Q_OBJECT - -public: - explicit QbsInstallStep(ProjectExplorer::BuildStepList *bsl); - QbsInstallStep(ProjectExplorer::BuildStepList *bsl, const QbsInstallStep *other); - ~QbsInstallStep() override; - - bool init(QList<const BuildStep *> &earlierSteps) override; - - void run(QFutureInterface<bool> &fi) override; - - ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override; - - bool runInGuiThread() const override; - void cancel() override; - - bool fromMap(const QVariantMap &map) override; - QVariantMap toMap() const override; - - qbs::InstallOptions installOptions() const; - QString installRoot() const; - QString absoluteInstallRoot() const; - bool removeFirst() const; - bool dryRun() const; - bool keepGoing() const; - -signals: - void changed(); - -private: - void installDone(bool success); - void handleTaskStarted(const QString &desciption, int max); - void handleProgress(int value); - - void createTaskAndOutput(ProjectExplorer::Task::TaskType type, - const QString &message, const QString &file, int line); - - void setInstallRoot(const QString &ir); - void setRemoveFirst(bool rf); - void setDryRun(bool dr); - void setKeepGoing(bool kg); - - qbs::InstallOptions m_qbsInstallOptions; - - QFutureInterface<bool> *m_fi; - qbs::InstallJob *m_job; - int m_progressBase; - bool m_showCompilerOutput; - ProjectExplorer::IOutputParser *m_parser; - - friend class QbsInstallStepConfigWidget; -}; - -namespace Ui { class QbsInstallStepConfigWidget; } - -class QbsInstallStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget -{ - Q_OBJECT -public: - QbsInstallStepConfigWidget(QbsInstallStep *step); - ~QbsInstallStepConfigWidget(); - QString summaryText() const; - QString displayName() const; - -private: - void updateState(); - - void changeInstallRoot(); - void changeRemoveFirst(bool rf); - void changeDryRun(bool dr); - void changeKeepGoing(bool kg); - -private: - Ui::QbsInstallStepConfigWidget *m_ui; - - QbsInstallStep *m_step; - QString m_summary; - bool m_ignoreChange; -}; - -class QbsInstallStepFactory : public ProjectExplorer::IBuildStepFactory -{ - Q_OBJECT - -public: - explicit QbsInstallStepFactory(QObject *parent = 0); - - QList<ProjectExplorer::BuildStepInfo> - availableSteps(ProjectExplorer::BuildStepList *parent) const override; - - ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id) override; - ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) override; -}; - -} // namespace Internal -} // namespace QbsProjectManager diff --git a/src/plugins/qbsprojectmanager/qbsinstallstepconfigwidget.ui b/src/plugins/qbsprojectmanager/qbsinstallstepconfigwidget.ui deleted file mode 100644 index c44a727643..0000000000 --- a/src/plugins/qbsprojectmanager/qbsinstallstepconfigwidget.ui +++ /dev/null @@ -1,128 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>QbsProjectManager::Internal::QbsInstallStepConfigWidget</class> - <widget class="QWidget" name="QbsProjectManager::Internal::QbsInstallStepConfigWidget"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>474</width> - <height>146</height> - </rect> - </property> - <layout class="QFormLayout" name="formLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="installRootLabel"> - <property name="text"> - <string>Install root:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="Utils::PathChooser" name="installRootChooser"> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="flagsLabel"> - <property name="text"> - <string>Flags:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QCheckBox" name="dryRunCheckBox"> - <property name="text"> - <string>Dry run</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="keepGoingCheckBox"> - <property name="text"> - <string>Keep going</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="removeFirstCheckBox"> - <property name="text"> - <string>Remove first</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="commandLineKeyLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Equivalent command line:</string> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QPlainTextEdit" name="commandLineTextEdit"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="readOnly"> - <bool>true</bool> - </property> - <property name="plainText"> - <string notr="true"/> - </property> - <property name="textInteractionFlags"> - <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> - </property> - </widget> - </item> - </layout> - </widget> - <customwidgets> - <customwidget> - <class>Utils::PathChooser</class> - <extends>QLineEdit</extends> - <header location="global">utils/pathchooser.h</header> - </customwidget> - </customwidgets> - <tabstops> - <tabstop>dryRunCheckBox</tabstop> - <tabstop>keepGoingCheckBox</tabstop> - <tabstop>removeFirstCheckBox</tabstop> - <tabstop>commandLineTextEdit</tabstop> - </tabstops> - <resources/> - <connections/> -</ui> diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanager.pro b/src/plugins/qbsprojectmanager/qbsprojectmanager.pro index 94afeae5a7..1c82b79e7e 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanager.pro +++ b/src/plugins/qbsprojectmanager/qbsprojectmanager.pro @@ -27,7 +27,6 @@ HEADERS = \ qbscleanstep.h \ qbsdeployconfigurationfactory.h \ qbsinfopage.h \ - qbsinstallstep.h \ qbslogsink.h \ qbsnodes.h \ qbsparser.h \ @@ -52,7 +51,6 @@ SOURCES = \ qbscleanstep.cpp \ qbsdeployconfigurationfactory.cpp \ qbsinfopage.cpp \ - qbsinstallstep.cpp \ qbslogsink.cpp \ qbsnodes.cpp \ qbsparser.cpp \ @@ -71,7 +69,6 @@ FORMS = \ qbsbuildstepconfigwidget.ui \ qbscleanstepconfigwidget.ui \ qbsinfowidget.ui \ - qbsinstallstepconfigwidget.ui \ qbsprofilessettingswidget.ui RESOURCES += \ diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs b/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs index 98ce172aa1..d833515490 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs +++ b/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs @@ -80,9 +80,6 @@ QtcPlugin { "qbsinfopage.cpp", "qbsinfopage.h", "qbsinfowidget.ui", - "qbsinstallstep.cpp", - "qbsinstallstep.h", - "qbsinstallstepconfigwidget.ui", "qbslogsink.cpp", "qbslogsink.h", "qbsnodes.cpp", diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanagerconstants.h b/src/plugins/qbsprojectmanager/qbsprojectmanagerconstants.h index 8952a1d194..1e545fc7b5 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanagerconstants.h +++ b/src/plugins/qbsprojectmanager/qbsprojectmanagerconstants.h @@ -57,6 +57,7 @@ static const char QBS_VARIANT_RELEASE[] = "release"; static const char QBS_CONFIG_VARIANT_KEY[] = "qbs.buildVariant"; static const char QBS_CONFIG_PROFILE_KEY[] = "qbs.profile"; +static const char QBS_INSTALL_ROOT_KEY[] = "qbs.installRoot"; static const char QBS_CONFIG_DECLARATIVE_DEBUG_KEY[] = "Qt.declarative.qmlDebugging"; static const char QBS_CONFIG_QUICK_DEBUG_KEY[] = "Qt.quick.qmlDebugging"; const char QBS_FORCE_PROBES_KEY[] = "qbspm.forceProbes"; diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp index e7a59efb5d..df10290121 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp +++ b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp @@ -30,7 +30,6 @@ #include "qbscleanstep.h" #include "qbsdeployconfigurationfactory.h" #include "qbsinfopage.h" -#include "qbsinstallstep.h" #include "qbsnodes.h" #include "qbsprofilessettingspage.h" #include "qbsproject.h" @@ -101,7 +100,6 @@ bool QbsProjectManagerPlugin::initialize(const QStringList &arguments, QString * addAutoReleasedObject(new QbsBuildConfigurationFactory); addAutoReleasedObject(new QbsBuildStepFactory); addAutoReleasedObject(new QbsCleanStepFactory); - addAutoReleasedObject(new QbsInstallStepFactory); addAutoReleasedObject(new QbsDeployConfigurationFactory); addAutoReleasedObject(new QbsRunConfigurationFactory); addAutoReleasedObject(new QbsProfilesSettingsPage); diff --git a/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp b/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp index 49cf0a7f4f..4b85e79f93 100644 --- a/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp +++ b/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp @@ -26,7 +26,6 @@ #include "qbsrunconfiguration.h" #include "qbsdeployconfigurationfactory.h" -#include "qbsinstallstep.h" #include "qbsproject.h" #include <coreplugin/messagemanager.h> @@ -111,7 +110,6 @@ const qbs::ProductData findProduct(const qbs::ProjectData &pro, const QString &u QbsRunConfiguration::QbsRunConfiguration(Target *parent, Core::Id id) : RunConfiguration(parent, id), m_uniqueProductName(uniqueProductNameFromId(id)), - m_currentInstallStep(0), m_currentBuildStepList(0) { addExtraAspect(new LocalEnvironmentAspect(this, [](RunConfiguration *rc, Environment &env) { @@ -130,7 +128,6 @@ QbsRunConfiguration::QbsRunConfiguration(Target *parent, Core::Id id) : QbsRunConfiguration::QbsRunConfiguration(Target *parent, QbsRunConfiguration *source) : RunConfiguration(parent, source), m_uniqueProductName(source->m_uniqueProductName), - m_currentInstallStep(0), // no need to copy this, we will get if from the DC anyway. m_currentBuildStepList(0) // ditto { ctor(); @@ -184,10 +181,6 @@ QWidget *QbsRunConfiguration::createConfigurationWidget() void QbsRunConfiguration::installStepChanged() { - if (m_currentInstallStep) - disconnect(m_currentInstallStep, &QbsInstallStep::changed, - this, &QbsRunConfiguration::targetInformationChanged); - if (m_currentBuildStepList) { disconnect(m_currentBuildStepList, &BuildStepList::stepInserted, this, &QbsRunConfiguration::installStepChanged); @@ -199,17 +192,10 @@ void QbsRunConfiguration::installStepChanged() QbsDeployConfiguration *activeDc = qobject_cast<QbsDeployConfiguration *>(target()->activeDeployConfiguration()); m_currentBuildStepList = activeDc ? activeDc->stepList() : 0; - m_currentInstallStep = activeDc ? activeDc->qbsInstallStep() : 0; - - if (m_currentInstallStep) - connect(m_currentInstallStep, &QbsInstallStep::changed, - this, &QbsRunConfiguration::targetInformationChanged); if (m_currentBuildStepList) { connect(m_currentBuildStepList, &BuildStepList::stepInserted, this, &QbsRunConfiguration::installStepChanged); - connect(m_currentBuildStepList, &BuildStepList::aboutToRemoveStep, this, - &QbsRunConfiguration::installStepToBeRemoved); connect(m_currentBuildStepList, &BuildStepList::stepRemoved, this, &QbsRunConfiguration::installStepChanged); connect(m_currentBuildStepList, &BuildStepList::stepMoved, @@ -219,18 +205,6 @@ void QbsRunConfiguration::installStepChanged() emit targetInformationChanged(); } -void QbsRunConfiguration::installStepToBeRemoved(int pos) -{ - QTC_ASSERT(m_currentBuildStepList, return); - // TODO: Our logic is rather broken. Users can create as many qbs install steps as they want, - // but we ignore all but the first one. - if (m_currentBuildStepList->steps().at(pos) != m_currentInstallStep) - return; - disconnect(m_currentInstallStep, &QbsInstallStep::changed, - this, &QbsRunConfiguration::targetInformationChanged); - m_currentInstallStep = 0; -} - Runnable QbsRunConfiguration::runnable() const { StandardRunnable r; @@ -276,8 +250,8 @@ void QbsRunConfiguration::addToBaseEnvironment(Utils::Environment &env) const if (product.isValid()) { QProcessEnvironment procEnv = env.toProcessEnvironment(); procEnv.insert(QLatin1String("QBS_RUN_FILE_PATH"), executable()); - qbs::RunEnvironment qbsRunEnv = project->qbsProject().getRunEnvironment(product, installOptions(), - procEnv, QbsManager::settings()); + qbs::RunEnvironment qbsRunEnv = project->qbsProject().getRunEnvironment(product, + qbs::InstallOptions(), procEnv, QbsManager::settings()); qbs::ErrorInfo error; procEnv = qbsRunEnv.runEnvironment(&error); if (error.hasError()) { @@ -310,20 +284,6 @@ QString QbsRunConfiguration::defaultDisplayName() return defaultName; } -qbs::InstallOptions QbsRunConfiguration::installOptions() const -{ - if (m_currentInstallStep) - return m_currentInstallStep->installOptions(); - return qbs::InstallOptions(); -} - -QString QbsRunConfiguration::installRoot() const -{ - if (m_currentInstallStep) - return m_currentInstallStep->absoluteInstallRoot(); - return QString(); -} - Utils::OutputFormatter *QbsRunConfiguration::createOutputFormatter() const { return new QtSupport::QtOutputFormatter(target()->project()); diff --git a/src/plugins/qbsprojectmanager/qbsrunconfiguration.h b/src/plugins/qbsprojectmanager/qbsrunconfiguration.h index 5fab929aa0..92273e5f4e 100644 --- a/src/plugins/qbsprojectmanager/qbsrunconfiguration.h +++ b/src/plugins/qbsprojectmanager/qbsrunconfiguration.h @@ -50,7 +50,6 @@ class QbsProject; namespace Internal { -class QbsInstallStep; class QbsRunConfigurationFactory; class QbsRunConfiguration : public ProjectExplorer::RunConfiguration @@ -87,11 +86,8 @@ protected: private: void installStepChanged(); - void installStepToBeRemoved(int pos); QString baseWorkingDirectory() const; QString defaultDisplayName(); - qbs::InstallOptions installOptions() const; - QString installRoot() const; void ctor(); @@ -101,7 +97,6 @@ private: // Cached startup sub project information - QbsInstallStep *m_currentInstallStep; // We do not take ownership! ProjectExplorer::BuildStepList *m_currentBuildStepList; // We do not take ownership! }; diff --git a/src/shared/qbs b/src/shared/qbs -Subproject a1633aba4e6b0c17651b0a4938efc3f50767bd7 +Subproject 08c5bfa1a860cf33ed4da951a543d434045e834 |