Commit 8d936b8a authored by Tobias Hunger's avatar Tobias Hunger

AndroidDeployQtStep: Keep data requested from user around

Reuse the data for the following AndroidDeployQtSteps that
are in the same batch submitted to the BuildManager.

This should fix Qt Creator asking for the device multiple times
when building projects that depend on other projects.

Task-number: QTCREATORBUG-15338
Change-Id: I4fbb04d4d8e492f6a766461bca3e6f9683824def
Reviewed-by: default avatarMitch Curtis <mitch.curtis@theqtcompany.com>
Reviewed-by: default avatarNiels Weber <niels.weber@theqtcompany.com>
parent f996f05b
......@@ -52,6 +52,7 @@
#include <qtsupport/qtkitinformation.h>
#include <utils/algorithm.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
......@@ -166,6 +167,13 @@ void AndroidDeployQtStep::ctor()
this, &AndroidDeployQtStep::slotSetSerialNumber);
}
static AndroidDeviceInfo earlierDeviceInfo(QList<const ProjectExplorer::BuildStep *> &earlierSteps, Core::Id id)
{
const ProjectExplorer::BuildStep *bs
= Utils::findOrDefault(earlierSteps, Utils::equal(&ProjectExplorer::BuildStep::id, id));
return bs ? static_cast<const AndroidDeployQtStep *>(bs)->deviceInfo() : AndroidDeviceInfo();
}
bool AndroidDeployQtStep::init(QList<const BuildStep *> &earlierSteps)
{
Q_UNUSED(earlierSteps);
......@@ -191,8 +199,13 @@ bool AndroidDeployQtStep::init(QList<const BuildStep *> &earlierSteps)
AndroidConfigurations::Options options = AndroidConfigurations::None;
if (androidBuildApkStep->deployAction() == AndroidBuildApkStep::DebugDeployment)
options = AndroidConfigurations::FilterAndroid5;
AndroidDeviceInfo info = AndroidConfigurations::showDeviceDialog(project(), deviceAPILevel, m_targetArch, options);
if (info.serialNumber.isEmpty() && info.avdname.isEmpty()) // aborted
AndroidDeviceInfo info = earlierDeviceInfo(earlierSteps, Id);
if (!info.isValid()) {
info = AndroidConfigurations::showDeviceDialog(project(), deviceAPILevel, m_targetArch, options);
m_deviceInfo = info; // Keep around for later steps
}
if (!info.isValid()) // aborted
return false;
m_avdName = info.avdname;
......@@ -479,6 +492,11 @@ void AndroidDeployQtStep::runCommand(const QString &program, const QStringList &
}
}
AndroidDeviceInfo AndroidDeployQtStep::deviceInfo() const
{
return m_deviceInfo;
}
ProjectExplorer::BuildStepConfigWidget *AndroidDeployQtStep::createConfigWidget()
{
return new AndroidDeployQtWidget(this);
......
......@@ -90,6 +90,8 @@ public:
UninstallType uninstallPreviousPackage();
AndroidDeviceInfo deviceInfo() const;
public slots:
void setUninstallPreviousPackage(bool uninstall);
......@@ -141,6 +143,7 @@ private:
QString m_workingDirectory;
Utils::Environment m_environment;
Utils::QtcProcess *m_process;
AndroidDeviceInfo m_deviceInfo;
};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment