forked from qt-creator/qt-creator
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: Mitch Curtis <mitch.curtis@theqtcompany.com> Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user