forked from qt-creator/qt-creator
iOS: Adapt to introduction of ProjectExplorer::ToolRunner
Change-Id: I53201edb58485c697c8c56db68ddefd3cf107193 Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -34,15 +34,14 @@ using namespace ProjectExplorer;
|
||||
namespace Ios {
|
||||
namespace Internal {
|
||||
|
||||
IosAnalyzeSupport::IosAnalyzeSupport(IosRunConfiguration *runConfig,
|
||||
AnalyzerRunControl *runControl, bool cppDebug, bool qmlDebug)
|
||||
: QObject(runControl), m_runControl(runControl),
|
||||
m_runner(new IosRunner(this, runConfig, cppDebug, qmlDebug ? QmlDebug::QmlProfilerServices :
|
||||
IosAnalyzeSupport::IosAnalyzeSupport(RunControl *runControl, bool cppDebug, bool qmlDebug)
|
||||
: ToolRunner(runControl),
|
||||
m_runner(new IosRunner(this, runControl, cppDebug, qmlDebug ? QmlDebug::QmlProfilerServices :
|
||||
QmlDebug::NoQmlDebugServices))
|
||||
{
|
||||
connect(m_runControl, &AnalyzerRunControl::starting,
|
||||
connect(runControl, &RunControl::starting,
|
||||
m_runner, &IosRunner::start);
|
||||
connect(m_runControl, &RunControl::finished,
|
||||
connect(runControl, &RunControl::finished,
|
||||
m_runner, &IosRunner::stop);
|
||||
connect(&m_outputParser, &QmlDebug::QmlOutputParser::waitingForConnectionOnPort,
|
||||
this, &IosAnalyzeSupport::qmlServerReady);
|
||||
@@ -60,13 +59,9 @@ IosAnalyzeSupport::IosAnalyzeSupport(IosRunConfiguration *runConfig,
|
||||
this, &IosAnalyzeSupport::handleRemoteOutput);
|
||||
}
|
||||
|
||||
IosAnalyzeSupport::~IosAnalyzeSupport()
|
||||
{
|
||||
}
|
||||
|
||||
void IosAnalyzeSupport::qmlServerReady()
|
||||
{
|
||||
m_runControl->notifyRemoteSetupDone(m_qmlPort);
|
||||
runControl()->notifyRemoteSetupDone(m_qmlPort);
|
||||
}
|
||||
|
||||
void IosAnalyzeSupport::handleServerPorts(Utils::Port gdbServerPort, Utils::Port qmlPort)
|
||||
@@ -83,29 +78,28 @@ void IosAnalyzeSupport::handleGotInferiorPid(qint64 pid, Utils::Port qmlPort)
|
||||
|
||||
void IosAnalyzeSupport::handleRemoteProcessFinished(bool cleanEnd)
|
||||
{
|
||||
if (m_runControl) {
|
||||
if (!cleanEnd)
|
||||
m_runControl->appendMessage(tr("Run ended with error."), Utils::ErrorMessageFormat);
|
||||
runControl()->appendMessage(tr("Run ended with error."), Utils::ErrorMessageFormat);
|
||||
else
|
||||
m_runControl->appendMessage(tr("Run ended."), Utils::NormalMessageFormat);
|
||||
m_runControl->notifyRemoteFinished();
|
||||
}
|
||||
appendMessage(tr("Run ended."), Utils::NormalMessageFormat);
|
||||
runControl()->notifyRemoteFinished();
|
||||
}
|
||||
|
||||
void IosAnalyzeSupport::handleRemoteOutput(const QString &output)
|
||||
{
|
||||
if (m_runControl) {
|
||||
m_runControl->appendMessage(output, Utils::StdOutFormat);
|
||||
appendMessage(output, Utils::StdOutFormat);
|
||||
m_outputParser.processOutput(output);
|
||||
}
|
||||
}
|
||||
|
||||
void IosAnalyzeSupport::handleRemoteErrorOutput(const QString &output)
|
||||
{
|
||||
if (m_runControl) {
|
||||
m_runControl->appendMessage(output, Utils::StdErrFormat);
|
||||
appendMessage(output, Utils::StdErrFormat);
|
||||
m_outputParser.processOutput(output);
|
||||
}
|
||||
|
||||
AnalyzerRunControl *IosAnalyzeSupport::runControl()
|
||||
{
|
||||
return qobject_cast<AnalyzerRunControl *>(ToolRunner::runControl());
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -26,9 +26,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <qmldebug/qmloutputparser.h>
|
||||
#include <utils/port.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
|
||||
#include <utils/port.h>
|
||||
|
||||
namespace Debugger { class AnalyzerRunControl; }
|
||||
|
||||
@@ -38,14 +39,12 @@ namespace Internal {
|
||||
class IosRunConfiguration;
|
||||
class IosRunner;
|
||||
|
||||
class IosAnalyzeSupport : public QObject
|
||||
class IosAnalyzeSupport : public ProjectExplorer::ToolRunner
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
IosAnalyzeSupport(IosRunConfiguration *runConfig,
|
||||
Debugger::AnalyzerRunControl *runControl, bool cppDebug, bool qmlDebug);
|
||||
~IosAnalyzeSupport();
|
||||
IosAnalyzeSupport(ProjectExplorer::RunControl *runControl, bool cppDebug, bool qmlDebug);
|
||||
|
||||
private:
|
||||
void qmlServerReady();
|
||||
@@ -56,7 +55,7 @@ private:
|
||||
void handleRemoteOutput(const QString &output);
|
||||
void handleRemoteErrorOutput(const QString &output);
|
||||
|
||||
Debugger::AnalyzerRunControl *m_runControl;
|
||||
Debugger::AnalyzerRunControl *runControl();
|
||||
IosRunner * const m_runner;
|
||||
QmlDebug::QmlOutputParser m_outputParser;
|
||||
Utils::Port m_qmlPort;
|
||||
|
||||
@@ -60,7 +60,7 @@ using namespace ProjectExplorer;
|
||||
namespace Ios {
|
||||
namespace Internal {
|
||||
|
||||
RunControl *IosDebugSupport::createDebugRunControl(IosRunConfiguration *runConfig,
|
||||
RunControl *IosDebugSupport::createDebugRunControl(RunConfiguration *runConfig,
|
||||
QString *errorMessage)
|
||||
{
|
||||
Target *target = runConfig->target();
|
||||
@@ -104,7 +104,9 @@ RunControl *IosDebugSupport::createDebugRunControl(IosRunConfiguration *runConfi
|
||||
params.startMode = AttachExternal;
|
||||
params.platform = QLatin1String("ios-simulator");
|
||||
}
|
||||
params.displayName = runConfig->applicationName();
|
||||
|
||||
auto iosRunConfig = qobject_cast<IosRunConfiguration *>(runConfig);
|
||||
params.displayName = iosRunConfig->applicationName();
|
||||
params.remoteSetupNeeded = true;
|
||||
params.continueAfterAttach = true;
|
||||
|
||||
@@ -112,7 +114,7 @@ RunControl *IosDebugSupport::createDebugRunControl(IosRunConfiguration *runConfi
|
||||
bool cppDebug = aspect->useCppDebugger();
|
||||
bool qmlDebug = aspect->useQmlDebugger();
|
||||
if (cppDebug) {
|
||||
params.inferior.executable = runConfig->localExecutable().toString();
|
||||
params.inferior.executable = iosRunConfig->localExecutable().toString();
|
||||
params.remoteChannel = QLatin1String("connect://localhost:0");
|
||||
|
||||
Utils::FileName xcodeInfo = IosConfigurations::developerPath().parentDir()
|
||||
@@ -125,7 +127,7 @@ RunControl *IosDebugSupport::createDebugRunControl(IosRunConfiguration *runConfi
|
||||
if (version.value(0).toInt() == 5 && version.value(1, QString::number(1)).toInt() == 0)
|
||||
buggyLldb = true;
|
||||
}
|
||||
QString bundlePath = runConfig->bundleDirectory().toString();
|
||||
QString bundlePath = iosRunConfig->bundleDirectory().toString();
|
||||
bundlePath.chop(4);
|
||||
Utils::FileName dsymPath = Utils::FileName::fromString(
|
||||
bundlePath.append(QLatin1String(".dSYM")));
|
||||
@@ -136,7 +138,7 @@ RunControl *IosDebugSupport::createDebugRunControl(IosRunConfiguration *runConfi
|
||||
"To create one, add a dsymutil deploystep."),
|
||||
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
|
||||
} else if (dsymPath.toFileInfo().lastModified()
|
||||
< QFileInfo(runConfig->localExecutable().toUserOutput()).lastModified()) {
|
||||
< QFileInfo(iosRunConfig->localExecutable().toUserOutput()).lastModified()) {
|
||||
TaskHub::addTask(Task::Warning,
|
||||
tr("The dSYM %1 seems to be outdated, it might confuse the debugger.")
|
||||
.arg(dsymPath.toUserOutput()),
|
||||
@@ -153,21 +155,20 @@ RunControl *IosDebugSupport::createDebugRunControl(IosRunConfiguration *runConfi
|
||||
params.startMode = AttachToRemoteServer;
|
||||
}
|
||||
|
||||
DebuggerRunControl *debuggerRunControl = createDebuggerRunControl(params, runConfig, errorMessage);
|
||||
if (debuggerRunControl)
|
||||
new IosDebugSupport(runConfig, debuggerRunControl, cppDebug, qmlDebug);
|
||||
return debuggerRunControl;
|
||||
RunControl *runControl = createDebuggerRunControl(params, runConfig, errorMessage);
|
||||
if (runControl)
|
||||
new IosDebugSupport(runControl, cppDebug, qmlDebug);
|
||||
return runControl;
|
||||
}
|
||||
|
||||
IosDebugSupport::IosDebugSupport(IosRunConfiguration *runConfig,
|
||||
DebuggerRunControl *runControl, bool cppDebug, bool qmlDebug)
|
||||
: QObject(runControl), m_runControl(runControl),
|
||||
m_runner(new IosRunner(this, runConfig, cppDebug, qmlDebug ? QmlDebug::QmlDebuggerServices :
|
||||
QmlDebug::NoQmlDebugServices))
|
||||
IosDebugSupport::IosDebugSupport(RunControl *runControl, bool cppDebug, bool qmlDebug)
|
||||
: ToolRunner(runControl),
|
||||
m_runner(new IosRunner(this, runControl, cppDebug,
|
||||
qmlDebug ? QmlDebug::QmlDebuggerServices : QmlDebug::NoQmlDebugServices))
|
||||
{
|
||||
connect(m_runControl, &DebuggerRunControl::requestRemoteSetup,
|
||||
connect(this->runControl(), &DebuggerRunControl::requestRemoteSetup,
|
||||
m_runner, &IosRunner::start);
|
||||
connect(m_runControl, &RunControl::finished,
|
||||
connect(runControl, &RunControl::finished,
|
||||
m_runner, &IosRunner::stop);
|
||||
|
||||
connect(m_runner, &IosRunner::gotServerPorts,
|
||||
@@ -183,10 +184,6 @@ IosDebugSupport::IosDebugSupport(IosRunConfiguration *runConfig,
|
||||
this, &IosDebugSupport::handleRemoteOutput);
|
||||
}
|
||||
|
||||
IosDebugSupport::~IosDebugSupport()
|
||||
{
|
||||
}
|
||||
|
||||
void IosDebugSupport::handleServerPorts(Utils::Port gdbServerPort, Utils::Port qmlPort)
|
||||
{
|
||||
RemoteSetupResult result;
|
||||
@@ -196,7 +193,7 @@ void IosDebugSupport::handleServerPorts(Utils::Port gdbServerPort, Utils::Port q
|
||||
|| (m_runner && !m_runner->cppDebug() && qmlPort.isValid());
|
||||
if (!result.success)
|
||||
result.reason = tr("Could not get debug server file descriptor.");
|
||||
m_runControl->notifyEngineRemoteSetupFinished(result);
|
||||
runControl()->notifyEngineRemoteSetupFinished(result);
|
||||
}
|
||||
|
||||
void IosDebugSupport::handleGotInferiorPid(qint64 pid, Utils::Port qmlPort)
|
||||
@@ -207,30 +204,31 @@ void IosDebugSupport::handleGotInferiorPid(qint64 pid, Utils::Port qmlPort)
|
||||
result.success = pid > 0;
|
||||
if (!result.success)
|
||||
result.reason = tr("Got an invalid process id.");
|
||||
m_runControl->notifyEngineRemoteSetupFinished(result);
|
||||
runControl()->notifyEngineRemoteSetupFinished(result);
|
||||
}
|
||||
|
||||
void IosDebugSupport::handleRemoteProcessFinished(bool cleanEnd)
|
||||
{
|
||||
if (m_runControl) {
|
||||
if (!cleanEnd)
|
||||
m_runControl->appendMessage(tr("Run ended with error."), Utils::DebugFormat);
|
||||
appendMessage(tr("Run ended with error."), Utils::DebugFormat);
|
||||
else
|
||||
m_runControl->appendMessage(tr("Run ended."), Utils::DebugFormat);
|
||||
m_runControl->abortDebugger();
|
||||
}
|
||||
appendMessage(tr("Run ended."), Utils::DebugFormat);
|
||||
runControl()->abortDebugger();
|
||||
}
|
||||
|
||||
void IosDebugSupport::handleRemoteOutput(const QString &output)
|
||||
{
|
||||
if (m_runControl)
|
||||
m_runControl->showMessage(output, AppOutput);
|
||||
runControl()->showMessage(output, AppOutput);
|
||||
}
|
||||
|
||||
void IosDebugSupport::handleRemoteErrorOutput(const QString &output)
|
||||
{
|
||||
if (m_runControl)
|
||||
m_runControl->showMessage(output, AppError);
|
||||
runControl()->showMessage(output, AppError);
|
||||
}
|
||||
|
||||
DebuggerRunControl *IosDebugSupport::runControl()
|
||||
{
|
||||
return qobject_cast<DebuggerRunControl *>(ToolRunner::runControl()) ;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "iosrunconfiguration.h"
|
||||
#include <QProcess>
|
||||
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
|
||||
namespace Debugger { class DebuggerRunControl; }
|
||||
namespace ProjectExplorer { class RunControl; }
|
||||
@@ -37,17 +38,15 @@ namespace Internal {
|
||||
class IosRunConfiguration;
|
||||
class IosRunner;
|
||||
|
||||
class IosDebugSupport : public QObject
|
||||
class IosDebugSupport : public ProjectExplorer::ToolRunner
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static ProjectExplorer::RunControl *createDebugRunControl(IosRunConfiguration *runConfig,
|
||||
static ProjectExplorer::RunControl *createDebugRunControl(ProjectExplorer::RunConfiguration *runConfig,
|
||||
QString *errorMessage);
|
||||
|
||||
IosDebugSupport(IosRunConfiguration *runConfig,
|
||||
Debugger::DebuggerRunControl *runControl, bool cppDebug, bool qmlDebug);
|
||||
~IosDebugSupport();
|
||||
IosDebugSupport(ProjectExplorer::RunControl *runControl, bool cppDebug, bool qmlDebug);
|
||||
|
||||
private:
|
||||
void handleServerPorts(Utils::Port gdbServerPort, Utils::Port qmlPort);
|
||||
@@ -57,7 +56,8 @@ private:
|
||||
void handleRemoteOutput(const QString &output);
|
||||
void handleRemoteErrorOutput(const QString &output);
|
||||
|
||||
Debugger::DebuggerRunControl *m_runControl;
|
||||
Debugger::DebuggerRunControl *runControl();
|
||||
|
||||
IosRunner * const m_runner;
|
||||
const QString m_dumperLib;
|
||||
};
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Internal {
|
||||
|
||||
IosRunControl::IosRunControl(IosRunConfiguration *rc)
|
||||
: RunControl(rc, ProjectExplorer::Constants::NORMAL_RUN_MODE)
|
||||
, m_runner(new IosRunner(this, rc, false, QmlDebug::NoQmlDebugServices))
|
||||
, m_runner(new IosRunner(this, this, false, QmlDebug::NoQmlDebugServices))
|
||||
{
|
||||
setIcon(Utils::Icons::RUN_SMALL_TOOLBAR);
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ RunControl *IosRunControlFactory::create(RunConfiguration *runConfig,
|
||||
runControl->setRunnable(runnable);
|
||||
runControl->setConnection(connection);
|
||||
runControl->setDisplayName(iosRunConfig->applicationName());
|
||||
(void) new IosAnalyzeSupport(iosRunConfig, runControl, false, true);
|
||||
(void) new IosAnalyzeSupport(runControl, false, true);
|
||||
return runControl;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -51,14 +51,15 @@ using namespace ProjectExplorer;
|
||||
namespace Ios {
|
||||
namespace Internal {
|
||||
|
||||
IosRunner::IosRunner(QObject *parent, IosRunConfiguration *runConfig, bool cppDebug,
|
||||
IosRunner::IosRunner(QObject *parent, RunControl *runControl, bool cppDebug,
|
||||
QmlDebug::QmlDebugServicesPreset qmlDebugServices)
|
||||
: QObject(parent), m_toolHandler(0), m_bundleDir(runConfig->bundleDirectory().toString()),
|
||||
m_arguments(runConfig->commandLineArguments()),
|
||||
m_device(DeviceKitInformation::device(runConfig->target()->kit())),
|
||||
m_cppDebug(cppDebug), m_qmlDebugServices(qmlDebugServices), m_cleanExit(false),
|
||||
m_pid(0)
|
||||
: QObject(parent),
|
||||
m_cppDebug(cppDebug), m_qmlDebugServices(qmlDebugServices)
|
||||
{
|
||||
auto runConfig = qobject_cast<IosRunConfiguration *>(runControl->runConfiguration());
|
||||
m_bundleDir = runConfig->bundleDirectory().toString();
|
||||
m_arguments = QStringList(runConfig->commandLineArguments());
|
||||
m_device = DeviceKitInformation::device(runConfig->target()->kit());
|
||||
m_deviceType = runConfig->deviceType();
|
||||
}
|
||||
|
||||
|
||||
@@ -30,10 +30,12 @@
|
||||
#include "iossimulator.h"
|
||||
|
||||
#include <debugger/debuggerconstants.h>
|
||||
|
||||
#include <projectexplorer/devicesupport/idevice.h>
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
|
||||
#include <qmldebug/qmldebugcommandlinearguments.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QTimer>
|
||||
#include <QThread>
|
||||
#include <QProcess>
|
||||
@@ -42,14 +44,13 @@
|
||||
namespace Ios {
|
||||
namespace Internal {
|
||||
|
||||
class IosRunConfiguration;
|
||||
|
||||
class IosRunner : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
IosRunner(QObject *parent, IosRunConfiguration *runConfig, bool cppDebug,
|
||||
IosRunner(QObject *parent, ProjectExplorer::RunControl *runControl,
|
||||
bool cppDebug,
|
||||
QmlDebug::QmlDebugServicesPreset qmlDebugServices);
|
||||
~IosRunner();
|
||||
|
||||
@@ -85,7 +86,7 @@ private:
|
||||
void handleToolExited(Ios::IosToolHandler *handler, int code);
|
||||
void handleFinished(Ios::IosToolHandler *handler);
|
||||
|
||||
IosToolHandler *m_toolHandler;
|
||||
IosToolHandler *m_toolHandler = nullptr;
|
||||
QString m_bundleDir;
|
||||
QStringList m_arguments;
|
||||
ProjectExplorer::IDevice::ConstPtr m_device;
|
||||
@@ -93,9 +94,9 @@ private:
|
||||
bool m_cppDebug;
|
||||
QmlDebug::QmlDebugServicesPreset m_qmlDebugServices;
|
||||
|
||||
bool m_cleanExit;
|
||||
bool m_cleanExit = false;
|
||||
Utils::Port m_qmlPort;
|
||||
qint64 m_pid;
|
||||
qint64 m_pid = 0;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user