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 <vikas.pachdha@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
BogDan Vatra
2017-02-28 14:03:20 +02:00
parent 598100c765
commit 750f25d9e6
5 changed files with 59 additions and 9 deletions

View File

@@ -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 bool AndroidBuildApkStep::verboseOutput() const
{ {
return m_verbose; return m_verbose;

View File

@@ -73,6 +73,9 @@ public:
bool useGradle() const; bool useGradle() const;
void setUseGradle(bool b); void setUseGradle(bool b);
bool addDebugger() const;
void setAddDebugger(bool debug);
QString buildTargetSdk() const; QString buildTargetSdk() const;
void setBuildTargetSdk(const QString &sdk); void setBuildTargetSdk(const QString &sdk);
@@ -102,6 +105,7 @@ protected:
bool m_useGradle = false; bool m_useGradle = false;
bool m_openPackageLocation = false; bool m_openPackageLocation = false;
bool m_openPackageLocationForRun = false; bool m_openPackageLocationForRun = false;
bool m_addDebugger = true;
QString m_buildTargetSdk; QString m_buildTargetSdk;
Utils::FileName m_keystorePath; Utils::FileName m_keystorePath;

View File

@@ -94,6 +94,7 @@ AndroidBuildApkWidget::AndroidBuildApkWidget(AndroidBuildApkStep *step)
m_ui->useGradleCheckBox->setChecked(m_step->useGradle()); m_ui->useGradleCheckBox->setChecked(m_step->useGradle());
m_ui->verboseOutputCheckBox->setChecked(m_step->verboseOutput()); m_ui->verboseOutputCheckBox->setChecked(m_step->verboseOutput());
m_ui->openPackageLocationCheckBox->setChecked(m_step->openPackageLocation()); m_ui->openPackageLocationCheckBox->setChecked(m_step->openPackageLocation());
m_ui->addDebuggerCheckBox->setChecked(m_step->addDebugger());
// target sdk // target sdk
connect(m_ui->targetSDKComboBox, connect(m_ui->targetSDKComboBox,
@@ -120,6 +121,8 @@ AndroidBuildApkWidget::AndroidBuildApkWidget(AndroidBuildApkStep *step)
this, &AndroidBuildApkWidget::openPackageLocationCheckBoxToggled); this, &AndroidBuildApkWidget::openPackageLocationCheckBoxToggled);
connect(m_ui->verboseOutputCheckBox, &QAbstractButton::toggled, connect(m_ui->verboseOutputCheckBox, &QAbstractButton::toggled,
this, &AndroidBuildApkWidget::verboseOutputCheckBoxToggled); this, &AndroidBuildApkWidget::verboseOutputCheckBoxToggled);
connect(m_ui->addDebuggerCheckBox, &QAbstractButton::toggled,
m_step, &AndroidBuildApkStep::setAddDebugger);
//signing //signing
connect(m_ui->signPackageCheckBox, &QAbstractButton::toggled, connect(m_ui->signPackageCheckBox, &QAbstractButton::toggled,
@@ -185,6 +188,7 @@ void AndroidBuildApkWidget::signPackageCheckBoxToggled(bool checked)
{ {
m_ui->certificatesAliasComboBox->setEnabled(checked); m_ui->certificatesAliasComboBox->setEnabled(checked);
m_step->setSignPackage(checked); m_step->setSignPackage(checked);
m_ui->addDebuggerCheckBox->setChecked(!checked);
updateSigningWarning(); updateSigningWarning();
if (!checked) if (!checked)
return; return;

View File

@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>819</width> <width>819</width>
<height>390</height> <height>478</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@@ -197,6 +197,19 @@ Deploying local Qt libraries is incompatible with Android 5.</string>
</property> </property>
</widget> </widget>
</item> </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> </layout>
</widget> </widget>
</item> </item>
@@ -254,5 +267,22 @@ The APK will not be usable on any other device.</string>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources/> <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> </ui>

View File

@@ -182,13 +182,6 @@ bool QmakeAndroidBuildApkStep::init(QList<const BuildStep *> &earlierSteps)
QStringList argumentsPasswordConcealed = arguments; 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) { if (m_signPackage) {
arguments << QLatin1String("--sign") arguments << QLatin1String("--sign")
<< m_keystorePath.toString() << 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(); ProjectExplorer::ProcessParameters *pp = processParameters();
setupProcessParameters(pp, bc, arguments, command); setupProcessParameters(pp, bc, arguments, command);