Commit bc32c380 authored by Vikas Pachdha's avatar Vikas Pachdha
Browse files

Android: Remove python support checking for the NDK's GDB



The check and the warning was for the super old NDKs which are
not supported anymore

Change-Id: I13cb0d3aa1deb3e5cff284ac4e4960e4d23950b4
Reviewed-by: default avatarBogDan Vatra <bogdan@kdab.com>
Reviewed-by: Riitta-Leena Miettinen's avatarLeena Miettinen <riitta-leena.miettinen@qt.io>
parent 02738381
......@@ -134,9 +134,6 @@ AndroidSettingsWidget::AndroidSettingsWidget(QWidget *parent)
{
m_ui->setupUi(this);
connect(&m_checkGdbWatcher, &QFutureWatcherBase::finished,
this, &AndroidSettingsWidget::checkGdbFinished);
m_ui->SDKLocationPathChooser->setFileName(m_androidConfig.sdkLocation());
m_ui->SDKLocationPathChooser->setPromptDialogTitle(tr("Select Android SDK folder"));
m_ui->NDKLocationPathChooser->setFileName(m_androidConfig.ndkLocation());
......@@ -158,12 +155,8 @@ AndroidSettingsWidget::AndroidSettingsWidget(QWidget *parent)
const QPixmap errorPixmap = Utils::Icons::CRITICAL.pixmap();
m_ui->sdkWarningIconLabel->setPixmap(errorPixmap);
m_ui->gdbWarningIconLabel->setPixmap(errorPixmap);
m_ui->ndkWarningIconLabel->setPixmap(errorPixmap);
connect(m_ui->gdbWarningLabel, &QLabel::linkActivated,
this, &AndroidSettingsWidget::showGdbWarningDialog);
connect(&m_virtualDevicesWatcher, &QFutureWatcherBase::finished,
this, &AndroidSettingsWidget::updateAvds);
......@@ -209,50 +202,6 @@ AndroidSettingsWidget::~AndroidSettingsWidget()
m_futureWatcher.waitForFinished();
}
// NOTE: Will be run via QFuture
static QPair<QStringList, bool> checkGdbForBrokenPython(const QStringList &paths)
{
foreach (const QString &path, paths) {
QTime timer;
timer.start();
QProcess proc;
proc.setProcessChannelMode(QProcess::MergedChannels);
proc.start(path);
proc.waitForStarted();
QByteArray output;
while (proc.waitForReadyRead(300)) {
output += proc.readAll();
if (output.contains("(gdb)"))
break;
if (timer.elapsed() > 7 * 1000)
return qMakePair(paths, true); // Took too long, abort
}
output.clear();
proc.write("python import string\n");
proc.write("python print(string.ascii_uppercase)\n");
proc.write("python import struct\n");
proc.write("quit\n");
while (proc.waitForFinished(300)) {
if (timer.elapsed() > 9 * 1000)
return qMakePair(paths, true); // Took too long, abort
}
proc.waitForFinished();
output = proc.readAll();
bool error = output.contains("_PyObject_Free")
|| output.contains("_PyExc_IOError")
|| output.contains("_sysconfigdata_nd ")
|| !output.contains("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
if (error)
return qMakePair(paths, error);
}
return qMakePair(paths, false);
}
void AndroidSettingsWidget::check(AndroidSettingsWidget::Mode mode)
{
if (mode & Sdk) {
......@@ -264,8 +213,6 @@ void AndroidSettingsWidget::check(AndroidSettingsWidget::Mode mode)
Utils::FileName platformPath = m_androidConfig.ndkLocation();
Utils::FileName toolChainPath = m_androidConfig.ndkLocation();
Utils::FileName sourcesPath = m_androidConfig.ndkLocation();
m_ui->gdbWarningIconLabel->setVisible(false);
m_ui->gdbWarningLabel->setVisible(false);
if (m_androidConfig.ndkLocation().isEmpty()) {
m_ndkState = NotSet;
} else if (!platformPath.appendPath(QLatin1String("platforms")).exists()
......@@ -282,24 +229,6 @@ void AndroidSettingsWidget::check(AndroidSettingsWidget::Mode mode)
= AndroidToolChainFactory::toolchainPathsForNdk(m_androidConfig.ndkLocation());
m_ndkCompilerCount = compilerPaths.count();
// Check for a gdb with a broken python
QStringList gdbPaths;
foreach (const AndroidToolChainFactory::AndroidToolChainInformation &ati, compilerPaths) {
if (ati.language == Core::Id(ProjectExplorer::Constants::C_LANGUAGE_ID))
continue;
// we only check the arm gdbs, that's indicative enough
if (ati.abi.architecture() != ProjectExplorer::Abi::ArmArchitecture)
continue;
Utils::FileName gdbPath = m_androidConfig.gdbPath(ati.abi, ati.version);
if (gdbPath.exists())
gdbPaths << gdbPath.toString();
}
if (!gdbPaths.isEmpty()) {
m_checkGdbWatcher.setFuture(Utils::runAsync(&checkGdbForBrokenPython, gdbPaths));
m_gdbCheckPaths = gdbPaths;
}
// See if we have qt versions for those toolchains
QSet<ProjectExplorer::Abi> toolchainsForAbi;
foreach (const AndroidToolChainFactory::AndroidToolChainInformation &ati, compilerPaths) {
......@@ -591,25 +520,6 @@ void AndroidSettingsWidget::createKitToggled()
m_androidConfig.setAutomaticKitCreation(m_ui->CreateKitCheckBox->isChecked());
}
void AndroidSettingsWidget::checkGdbFinished()
{
QPair<QStringList, bool> result = m_checkGdbWatcher.future().result();
if (result.first != m_gdbCheckPaths) // no longer relevant
return;
m_ui->gdbWarningIconLabel->setVisible(result.second);
m_ui->gdbWarningLabel->setVisible(result.second);
}
void AndroidSettingsWidget::showGdbWarningDialog()
{
QMessageBox::warning(this,
tr("Unsupported GDB"),
tr("The GDB inside this NDK seems to not support Python. "
"The Qt Project offers fixed GDB builds at: "
"<a href=\"http://download.qt.io/official_releases/gdb/\">"
"http://download.qt.io/official_releases/gdb/</a>"));
}
void AndroidSettingsWidget::manageAVD()
{
if (m_avdManager->avdManagerUiToolAvailable()) {
......
......@@ -88,8 +88,6 @@ private:
void manageAVD();
void createKitToggled();
void checkGdbFinished();
void showGdbWarningDialog();
void updateAvds();
private:
......@@ -114,8 +112,6 @@ private:
AndroidConfig m_androidConfig;
AvdModel m_AVDModel;
QFutureWatcher<AndroidConfig::CreateAvdInfo> m_futureWatcher;
QFutureWatcher<QPair<QStringList, bool>> m_checkGdbWatcher;
QStringList m_gdbCheckPaths;
QFutureWatcher<AndroidDeviceInfoList> m_virtualDevicesWatcher;
QString m_lastAddedAvd;
......
......@@ -14,16 +14,7 @@
<string>Android Configuration</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="4" column="1">
<widget class="Utils::PathChooser" name="NDKLocationPathChooser" native="true"/>
</item>
<item row="2" column="1">
<widget class="Utils::PathChooser" name="SDKLocationPathChooser" native="true"/>
</item>
<item row="0" column="1">
<widget class="Utils::PathChooser" name="OpenJDKLocationPathChooser" native="true"/>
</item>
<item row="10" column="0" colspan="2">
<item row="9" column="0" colspan="2">
<widget class="QFrame" name="AVDManagerFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
......@@ -142,6 +133,15 @@
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="Utils::PathChooser" name="OpenJDKLocationPathChooser" native="true"/>
</item>
<item row="2" column="1">
<widget class="Utils::PathChooser" name="SDKLocationPathChooser" native="true"/>
</item>
<item row="4" column="1">
<widget class="Utils::PathChooser" name="NDKLocationPathChooser" native="true"/>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
......@@ -186,62 +186,51 @@
</property>
</widget>
</item>
<item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="sdkWarningIconLabel">
<item row="2" column="0">
<widget class="QLabel" name="SDKLocationLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
<string>Android SDK location:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="sdkWarningLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
<item row="0" column="2">
<widget class="QToolButton" name="downloadOpenJDKToolButton">
<property name="toolTip">
<string>Download JDK</string>
</property>
<property name="wordWrap">
<bool>true</bool>
<property name="icon">
<iconset resource="android.qrc">
<normaloff>:/android/images/download.png</normaloff>:/android/images/download.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QLabel" name="OpenJDKLocationLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>JDK location:</string>
<item row="2" column="2">
<widget class="QToolButton" name="downloadSDKToolButton">
<property name="toolTip">
<string>Download Android SDK</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<property name="icon">
<iconset resource="android.qrc">
<normaloff>:/android/images/download.png</normaloff>:/android/images/download.png</iconset>
</property>
</widget>
</item>
<item row="6" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item row="8" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>2</number>
</property>
<item>
<widget class="QLabel" name="ndkWarningIconLabel">
<widget class="QLabel" name="kitWarningIconLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
......@@ -254,22 +243,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="toolchainFoundLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0">
<widget class="QLabel" name="NDKLocationLabel">
<widget class="QLabel" name="kitWarningLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
......@@ -277,25 +251,16 @@
</sizepolicy>
</property>
<property name="text">
<string>Android NDK location:</string>
<string/>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QToolButton" name="downloadSDKToolButton">
<property name="toolTip">
<string>Download Android SDK</string>
</property>
<property name="icon">
<iconset resource="android.qrc">
<normaloff>:/android/images/download.png</normaloff>:/android/images/download.png</iconset>
</property>
</widget>
</layout>
</item>
<item row="8" column="1">
<item row="7" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_8">
<property name="spacing">
<number>2</number>
......@@ -321,13 +286,29 @@
</item>
</layout>
</item>
<item row="9" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item row="4" column="0">
<widget class="QLabel" name="NDKLocationLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Android NDK location:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="5" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>2</number>
</property>
<item>
<widget class="QLabel" name="kitWarningIconLabel">
<widget class="QLabel" name="ndkWarningIconLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
......@@ -340,9 +321,9 @@
</widget>
</item>
<item>
<widget class="QLabel" name="kitWarningLabel">
<widget class="QLabel" name="toolchainFoundLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
......@@ -350,20 +331,14 @@
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<property name="spacing">
<number>2</number>
</property>
<item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="gdbWarningIconLabel">
<widget class="QLabel" name="sdkWarningIconLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
......@@ -376,41 +351,33 @@
</widget>
</item>
<item>
<widget class="QLabel" name="gdbWarningLabel">
<widget class="QLabel" name="sdkWarningLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;a href=&quot;xx&quot;&gt;The GDB in the NDK appears to have broken python support.&lt;/a&gt;</string>
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="downloadOpenJDKToolButton">
<property name="toolTip">
<string>Download JDK</string>
</property>
<property name="icon">
<iconset resource="android.qrc">
<normaloff>:/android/images/download.png</normaloff>:/android/images/download.png</iconset>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="SDKLocationLabel">
<item row="0" column="0">
<widget class="QLabel" name="OpenJDKLocationLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Android SDK location:</string>
<string>JDK location:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
......
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