Commit 750f25d9 authored by BogDan Vatra's avatar BogDan Vatra
Browse files

Fix release builds debugging



Add gdbserver all the time, except when the user signs the package.
Even then the user can "Force debugging" by checking the checkbox.

Change-Id: I274243786f3d6d6b88f41e532bebc24213f5e9db
Reviewed-by: Vikas Pachdha's avatarVikas Pachdha <vikas.pachdha@qt.io>
Reviewed-by: Riitta-Leena Miettinen's avatarLeena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: default avatarhjk <hjk@qt.io>
parent 598100c7
......@@ -342,6 +342,16 @@ void AndroidBuildApkStep::setUseGradle(bool b)
}
}
bool AndroidBuildApkStep::addDebugger() const
{
return m_addDebugger;
}
void AndroidBuildApkStep::setAddDebugger(bool debug)
{
m_addDebugger = debug;
}
bool AndroidBuildApkStep::verboseOutput() const
{
return m_verbose;
......
......@@ -73,6 +73,9 @@ public:
bool useGradle() const;
void setUseGradle(bool b);
bool addDebugger() const;
void setAddDebugger(bool debug);
QString buildTargetSdk() const;
void setBuildTargetSdk(const QString &sdk);
......@@ -102,6 +105,7 @@ protected:
bool m_useGradle = false;
bool m_openPackageLocation = false;
bool m_openPackageLocationForRun = false;
bool m_addDebugger = true;
QString m_buildTargetSdk;
Utils::FileName m_keystorePath;
......
......@@ -94,6 +94,7 @@ AndroidBuildApkWidget::AndroidBuildApkWidget(AndroidBuildApkStep *step)
m_ui->useGradleCheckBox->setChecked(m_step->useGradle());
m_ui->verboseOutputCheckBox->setChecked(m_step->verboseOutput());
m_ui->openPackageLocationCheckBox->setChecked(m_step->openPackageLocation());
m_ui->addDebuggerCheckBox->setChecked(m_step->addDebugger());
// target sdk
connect(m_ui->targetSDKComboBox,
......@@ -120,6 +121,8 @@ AndroidBuildApkWidget::AndroidBuildApkWidget(AndroidBuildApkStep *step)
this, &AndroidBuildApkWidget::openPackageLocationCheckBoxToggled);
connect(m_ui->verboseOutputCheckBox, &QAbstractButton::toggled,
this, &AndroidBuildApkWidget::verboseOutputCheckBoxToggled);
connect(m_ui->addDebuggerCheckBox, &QAbstractButton::toggled,
m_step, &AndroidBuildApkStep::setAddDebugger);
//signing
connect(m_ui->signPackageCheckBox, &QAbstractButton::toggled,
......@@ -185,6 +188,7 @@ void AndroidBuildApkWidget::signPackageCheckBoxToggled(bool checked)
{
m_ui->certificatesAliasComboBox->setEnabled(checked);
m_step->setSignPackage(checked);
m_ui->addDebuggerCheckBox->setChecked(!checked);
updateSigningWarning();
if (!checked)
return;
......
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>819</width>
<height>390</height>
<height>478</height>
</rect>
</property>
<property name="windowTitle">
......@@ -197,6 +197,19 @@ Deploying local Qt libraries is incompatible with Android 5.</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="addDebuggerCheckBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Packages debug server with the APK to enable debugging. For the signed APK this option is unchecked by default.</string>
</property>
<property name="text">
<string>Add debug server</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
......@@ -254,5 +267,22 @@ The APK will not be usable on any other device.</string>
</customwidget>
</customwidgets>
<resources/>
<connections/>
<connections>
<connection>
<sender>signPackageCheckBox</sender>
<signal>clicked(bool)</signal>
<receiver>addDebuggerCheckBox</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>113</x>
<y>178</y>
</hint>
<hint type="destinationlabel">
<x>510</x>
<y>452</y>
</hint>
</hints>
</connection>
</connections>
</ui>
......@@ -182,13 +182,6 @@ bool QmakeAndroidBuildApkStep::init(QList<const BuildStep *> &earlierSteps)
QStringList argumentsPasswordConcealed = arguments;
if (version->qtVersion() >= QtSupport::QtVersionNumber(5, 6, 0)) {
if (bc->buildType() == ProjectExplorer::BuildConfiguration::Debug)
arguments << QLatin1String("--gdbserver");
else
arguments << QLatin1String("--no-gdbserver");
}
if (m_signPackage) {
arguments << QLatin1String("--sign")
<< m_keystorePath.toString()
......@@ -206,6 +199,15 @@ bool QmakeAndroidBuildApkStep::init(QList<const BuildStep *> &earlierSteps)
}
// Must be the last option, otherwise androiddeployqt might use the other
// params (e.g. --sign) to choose not to add gdbserver
if (version->qtVersion() >= QtSupport::QtVersionNumber(5, 6, 0)) {
if (m_addDebugger || bc->buildType() == ProjectExplorer::BuildConfiguration::Debug)
arguments << QLatin1String("--gdbserver");
else
arguments << QLatin1String("--no-gdbserver");
}
ProjectExplorer::ProcessParameters *pp = processParameters();
setupProcessParameters(pp, bc, arguments, command);
......
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