forked from qt-creator/qt-creator
Android: FilePath-ify RunnerWorker
Change-Id: If8e8c2ba94047bbb48a2ae5fee68d4c12d952fd6 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -29,9 +29,6 @@
|
|||||||
#include <utils/url.h>
|
#include <utils/url.h>
|
||||||
|
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
#include <QDir>
|
|
||||||
#include <QDirIterator>
|
|
||||||
#include <QFileInfo>
|
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
#include <QScopeGuard>
|
#include <QScopeGuard>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
@@ -172,14 +169,18 @@ static FilePath debugServer(bool useLldb, const Target *target)
|
|||||||
// The new, built-in LLDB.
|
// The new, built-in LLDB.
|
||||||
const QDir::Filters dirFilter = HostOsInfo::isWindowsHost() ? QDir::Files
|
const QDir::Filters dirFilter = HostOsInfo::isWindowsHost() ? QDir::Files
|
||||||
: QDir::Files|QDir::Executable;
|
: QDir::Files|QDir::Executable;
|
||||||
QDirIterator it(prebuilt.toString(), dirFilter, QDirIterator::Subdirectories);
|
FilePath lldbServer;
|
||||||
while (it.hasNext()) {
|
const auto handleLldbServerCandidate = [&abiNeedle, &lldbServer] (const FilePath &path) {
|
||||||
it.next();
|
if (path.parentDir().fileName() == abiNeedle) {
|
||||||
const QString filePath = it.filePath();
|
lldbServer = path;
|
||||||
if (filePath.endsWith(abiNeedle + "/lldb-server")) {
|
return false;
|
||||||
return FilePath::fromString(filePath);
|
|
||||||
}
|
}
|
||||||
}
|
return true;
|
||||||
|
};
|
||||||
|
prebuilt.iterateDirectory(handleLldbServerCandidate,
|
||||||
|
{{"lldb-server"}, dirFilter, QDirIterator::Subdirectories});
|
||||||
|
if (!lldbServer.isEmpty())
|
||||||
|
return lldbServer;
|
||||||
|
|
||||||
// Older: Find LLDB version. sdk_definitions.json contains something like "lldb;3.1". Use that.
|
// Older: Find LLDB version. sdk_definitions.json contains something like "lldb;3.1". Use that.
|
||||||
const QStringList packages = config.defaultEssentials();
|
const QStringList packages = config.defaultEssentials();
|
||||||
@@ -281,7 +282,7 @@ AndroidRunnerWorker::AndroidRunnerWorker(RunWorker *runner, const QString &packa
|
|||||||
for (const QString &shellCmd : postFinishCmdList.toStringList())
|
for (const QString &shellCmd : postFinishCmdList.toStringList())
|
||||||
m_afterFinishAdbCommands.append(QString("shell %1").arg(shellCmd));
|
m_afterFinishAdbCommands.append(QString("shell %1").arg(shellCmd));
|
||||||
|
|
||||||
m_debugServerPath = debugServer(m_useLldb, target).toString();
|
m_debugServerPath = debugServer(m_useLldb, target);
|
||||||
qCDebug(androidRunWorkerLog).noquote() << "Device Serial:" << m_deviceSerialNumber
|
qCDebug(androidRunWorkerLog).noquote() << "Device Serial:" << m_deviceSerialNumber
|
||||||
<< ", API level:" << m_apiLevel
|
<< ", API level:" << m_apiLevel
|
||||||
<< ", Extra Start Args:" << m_amStartExtraArgs
|
<< ", Extra Start Args:" << m_amStartExtraArgs
|
||||||
@@ -339,7 +340,7 @@ bool AndroidRunnerWorker::uploadDebugServer(const QString &debugServerFileName)
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Copy gdbserver to temp location
|
// Copy gdbserver to temp location
|
||||||
if (!runAdb({"push", m_debugServerPath , tempDebugServerPath})) {
|
if (!runAdb({"push", m_debugServerPath.toString(), tempDebugServerPath})) {
|
||||||
qCDebug(androidRunWorkerLog) << "Debug server upload to temp directory failed";
|
qCDebug(androidRunWorkerLog) << "Debug server upload to temp directory failed";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -545,7 +546,7 @@ void AndroidRunnerWorker::asyncStartHelper()
|
|||||||
// e.g. on Android 8 with NDK 10e
|
// e.g. on Android 8 with NDK 10e
|
||||||
runAdb({"shell", "run-as", m_packageName, "chmod", "a+x", packageDir.trimmed()});
|
runAdb({"shell", "run-as", m_packageName, "chmod", "a+x", packageDir.trimmed()});
|
||||||
|
|
||||||
if (!QFileInfo::exists(m_debugServerPath)) {
|
if (!m_debugServerPath.exists()) {
|
||||||
QString msg = Tr::tr("Cannot find C++ debug server in NDK installation.");
|
QString msg = Tr::tr("Cannot find C++ debug server in NDK installation.");
|
||||||
if (m_useLldb)
|
if (m_useLldb)
|
||||||
msg += "\n" + Tr::tr("The lldb-server binary has not been found.");
|
msg += "\n" + Tr::tr("The lldb-server binary has not been found.");
|
||||||
|
@@ -15,6 +15,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
class QProcess;
|
class QProcess;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
namespace Utils { class FilePath; }
|
||||||
namespace ProjectExplorer { class RunWorker; }
|
namespace ProjectExplorer { class RunWorker; }
|
||||||
|
|
||||||
namespace Android {
|
namespace Android {
|
||||||
@@ -100,7 +101,7 @@ private:
|
|||||||
int m_apiLevel = -1;
|
int m_apiLevel = -1;
|
||||||
QString m_extraAppParams;
|
QString m_extraAppParams;
|
||||||
Utils::Environment m_extraEnvVars;
|
Utils::Environment m_extraEnvVars;
|
||||||
QString m_debugServerPath;
|
Utils::FilePath m_debugServerPath; // On build device, typically as part of ndk
|
||||||
bool m_useAppParamsForQmlDebugger = false;
|
bool m_useAppParamsForQmlDebugger = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user