forked from qt-creator/qt-creator
Maemo: Don't hold a reference to a run config in a run control.
Save all relevant information at run control creation time, so we can re-run even without a project. Task-number: https://projects.maemo.org/bugzilla/show_bug.cgi?id=203698
This commit is contained in:
@@ -83,7 +83,8 @@ RunControl *MaemoDebugSupport::createDebugRunControl(MaemoRunConfiguration *runC
|
|||||||
params.executable = runConfig->remoteExecutableFilePath();
|
params.executable = runConfig->remoteExecutableFilePath();
|
||||||
params.debuggerCommand
|
params.debuggerCommand
|
||||||
= MaemoGlobal::remoteCommandPrefix(runConfig->remoteExecutableFilePath())
|
= MaemoGlobal::remoteCommandPrefix(runConfig->remoteExecutableFilePath())
|
||||||
+ environment(runConfig) + QLatin1String(" /usr/bin/gdb");
|
+ environment(runConfig->debuggingType(), runConfig->userEnvironmentChanges())
|
||||||
|
+ QLatin1String(" /usr/bin/gdb");
|
||||||
params.connParams = devConf.server;
|
params.connParams = devConf.server;
|
||||||
params.localMountDir = runConfig->localDirToMountForRemoteGdb();
|
params.localMountDir = runConfig->localDirToMountForRemoteGdb();
|
||||||
params.remoteMountPoint
|
params.remoteMountPoint
|
||||||
@@ -116,9 +117,9 @@ RunControl *MaemoDebugSupport::createDebugRunControl(MaemoRunConfiguration *runC
|
|||||||
MaemoDebugSupport::MaemoDebugSupport(MaemoRunConfiguration *runConfig,
|
MaemoDebugSupport::MaemoDebugSupport(MaemoRunConfiguration *runConfig,
|
||||||
DebuggerRunControl *runControl)
|
DebuggerRunControl *runControl)
|
||||||
: QObject(runControl), m_runControl(runControl), m_runConfig(runConfig),
|
: QObject(runControl), m_runControl(runControl), m_runConfig(runConfig),
|
||||||
m_deviceConfig(m_runConfig->deviceConfig()),
|
m_runner(new MaemoSshRunner(this, runConfig, true)),
|
||||||
m_runner(new MaemoSshRunner(this, m_runConfig, true)),
|
m_debuggingType(runConfig->debuggingType()),
|
||||||
m_debuggingType(m_runConfig->debuggingType()),
|
m_dumperLib(runConfig->dumperLib()),
|
||||||
m_state(Inactive), m_gdbServerPort(-1), m_qmlPort(-1)
|
m_state(Inactive), m_gdbServerPort(-1), m_qmlPort(-1)
|
||||||
{
|
{
|
||||||
connect(m_runControl, SIGNAL(engineRequestSetup()), this,
|
connect(m_runControl, SIGNAL(engineRequestSetup()), this,
|
||||||
@@ -136,10 +137,6 @@ void MaemoDebugSupport::handleAdapterSetupRequested()
|
|||||||
{
|
{
|
||||||
ASSERT_STATE(Inactive);
|
ASSERT_STATE(Inactive);
|
||||||
|
|
||||||
if (!m_deviceConfig.isValid()) {
|
|
||||||
handleAdapterSetupFailed(tr("No device configuration set for run configuration."));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setState(StartingRunner);
|
setState(StartingRunner);
|
||||||
m_runControl->showMessage(tr("Preparing remote side ..."), AppStuff);
|
m_runControl->showMessage(tr("Preparing remote side ..."), AppStuff);
|
||||||
disconnect(m_runner, 0, this, 0);
|
disconnect(m_runner, 0, this, 0);
|
||||||
@@ -178,11 +175,11 @@ void MaemoDebugSupport::startExecution()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &dumperLib = m_runConfig->dumperLib();
|
|
||||||
if (m_debuggingType != MaemoRunConfiguration::DebugQmlOnly
|
if (m_debuggingType != MaemoRunConfiguration::DebugQmlOnly
|
||||||
&& !dumperLib.isEmpty()
|
&& !m_dumperLib.isEmpty()
|
||||||
&& m_runConfig->deployStep()->currentlyNeedsDeployment(m_deviceConfig.server.host,
|
&& m_runConfig
|
||||||
MaemoDeployable(dumperLib, uploadDir(m_deviceConfig)))) {
|
&& m_runConfig->deployStep()->currentlyNeedsDeployment(m_runner->deviceConfig().server.host,
|
||||||
|
MaemoDeployable(m_dumperLib, uploadDir(m_runner->deviceConfig())))) {
|
||||||
setState(InitializingUploader);
|
setState(InitializingUploader);
|
||||||
m_uploader = m_runner->connection()->createSftpChannel();
|
m_uploader = m_runner->connection()->createSftpChannel();
|
||||||
connect(m_uploader.data(), SIGNAL(initialized()), this,
|
connect(m_uploader.data(), SIGNAL(initialized()), this,
|
||||||
@@ -205,18 +202,18 @@ void MaemoDebugSupport::handleSftpChannelInitialized()
|
|||||||
|
|
||||||
ASSERT_STATE(InitializingUploader);
|
ASSERT_STATE(InitializingUploader);
|
||||||
|
|
||||||
const QString dumperLib = m_runConfig->dumperLib();
|
const QString fileName = QFileInfo(m_dumperLib).fileName();
|
||||||
const QString fileName = QFileInfo(dumperLib).fileName();
|
const QString remoteFilePath
|
||||||
const QString remoteFilePath = uploadDir(m_deviceConfig) + '/' + fileName;
|
= uploadDir(m_runner->deviceConfig()) + '/' + fileName;
|
||||||
m_uploadJob = m_uploader->uploadFile(dumperLib, remoteFilePath,
|
m_uploadJob = m_uploader->uploadFile(m_dumperLib, remoteFilePath,
|
||||||
SftpOverwriteExisting);
|
SftpOverwriteExisting);
|
||||||
if (m_uploadJob == SftpInvalidJob) {
|
if (m_uploadJob == SftpInvalidJob) {
|
||||||
handleAdapterSetupFailed(tr("Upload failed: Could not open file '%1'")
|
handleAdapterSetupFailed(tr("Upload failed: Could not open file '%1'")
|
||||||
.arg(dumperLib));
|
.arg(m_dumperLib));
|
||||||
} else {
|
} else {
|
||||||
setState(UploadingDumpers);
|
setState(UploadingDumpers);
|
||||||
m_runControl->showMessage(tr("Started uploading debugging helpers ('%1').")
|
m_runControl->showMessage(tr("Started uploading debugging helpers ('%1').")
|
||||||
.arg(dumperLib), AppStuff);
|
.arg(m_dumperLib), AppStuff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,8 +243,10 @@ void MaemoDebugSupport::handleSftpJobFinished(Core::SftpJobId job,
|
|||||||
.arg(error));
|
.arg(error));
|
||||||
} else {
|
} else {
|
||||||
setState(DumpersUploaded);
|
setState(DumpersUploaded);
|
||||||
m_runConfig->deployStep()->setDeployed(m_deviceConfig.server.host,
|
if (m_runConfig) {
|
||||||
MaemoDeployable(m_runConfig->dumperLib(), uploadDir(m_deviceConfig)));
|
m_runConfig->deployStep()->setDeployed(m_runner->deviceConfig().server.host,
|
||||||
|
MaemoDeployable(m_dumperLib, uploadDir(m_runner->deviceConfig())));
|
||||||
|
}
|
||||||
m_runControl->showMessage(tr("Finished uploading debugging helpers."), AppStuff);
|
m_runControl->showMessage(tr("Finished uploading debugging helpers."), AppStuff);
|
||||||
startDebugging();
|
startDebugging();
|
||||||
}
|
}
|
||||||
@@ -267,10 +266,11 @@ void MaemoDebugSupport::startDebugging()
|
|||||||
SLOT(handleRemoteErrorOutput(QByteArray)));
|
SLOT(handleRemoteErrorOutput(QByteArray)));
|
||||||
connect(m_runner, SIGNAL(remoteOutput(QByteArray)), this,
|
connect(m_runner, SIGNAL(remoteOutput(QByteArray)), this,
|
||||||
SLOT(handleRemoteOutput(QByteArray)));
|
SLOT(handleRemoteOutput(QByteArray)));
|
||||||
const QString &remoteExe = m_runConfig->remoteExecutableFilePath();
|
const QString &remoteExe = m_runner->remoteExecutable();
|
||||||
const QString cmdPrefix = MaemoGlobal::remoteCommandPrefix(remoteExe);
|
const QString cmdPrefix = MaemoGlobal::remoteCommandPrefix(remoteExe);
|
||||||
const QString env = environment(m_runConfig);
|
const QString env
|
||||||
const QString args = m_runConfig->arguments().join(QLatin1String(" "));
|
= environment(m_debuggingType, m_runner->userEnvChanges());
|
||||||
|
const QString args = m_runner->arguments().join(QLatin1String(" "));
|
||||||
const QString remoteCommandLine
|
const QString remoteCommandLine
|
||||||
= m_debuggingType == MaemoRunConfiguration::DebugQmlOnly
|
= m_debuggingType == MaemoRunConfiguration::DebugQmlOnly
|
||||||
? QString::fromLocal8Bit("%1 %2 %3 %4").arg(cmdPrefix).arg(env)
|
? QString::fromLocal8Bit("%1 %2 %3 %4").arg(cmdPrefix).arg(env)
|
||||||
@@ -344,15 +344,15 @@ void MaemoDebugSupport::setState(State newState)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MaemoDebugSupport::environment(const MaemoRunConfiguration *rc)
|
QString MaemoDebugSupport::environment(MaemoRunConfiguration::DebuggingType debuggingType,
|
||||||
|
const QList<Utils::EnvironmentItem> &userEnvChanges)
|
||||||
{
|
{
|
||||||
QList<Utils::EnvironmentItem> env = rc->userEnvironmentChanges();
|
|
||||||
// FIXME: this must use command line argument instead: -qmljsdebugger=port:1234.
|
// FIXME: this must use command line argument instead: -qmljsdebugger=port:1234.
|
||||||
if (rc->debuggingType() != MaemoRunConfiguration::DebugCppOnly) {
|
if (debuggingType != MaemoRunConfiguration::DebugCppOnly) {
|
||||||
// env << Utils::EnvironmentItem(QLatin1String(Debugger::Constants::E_QML_DEBUG_SERVER_PORT),
|
// env << Utils::EnvironmentItem(QLatin1String(Debugger::Constants::E_QML_DEBUG_SERVER_PORT),
|
||||||
// QString::number(qmlServerPort(rc)));
|
// QString::number(qmlServerPort(rc)));
|
||||||
}
|
}
|
||||||
return MaemoGlobal::remoteEnvironment(env);
|
return MaemoGlobal::remoteEnvironment(userEnvChanges);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MaemoDebugSupport::uploadDir(const MaemoDeviceConfig &devConf)
|
QString MaemoDebugSupport::uploadDir(const MaemoDeviceConfig &devConf)
|
||||||
|
|||||||
@@ -35,10 +35,10 @@
|
|||||||
#ifndef MAEMODEBUGSUPPORT_H
|
#ifndef MAEMODEBUGSUPPORT_H
|
||||||
#define MAEMODEBUGSUPPORT_H
|
#define MAEMODEBUGSUPPORT_H
|
||||||
|
|
||||||
#include "maemodeviceconfigurations.h"
|
|
||||||
#include "maemorunconfiguration.h"
|
#include "maemorunconfiguration.h"
|
||||||
|
|
||||||
#include <coreplugin/ssh/sftpdefs.h>
|
#include <coreplugin/ssh/sftpdefs.h>
|
||||||
|
#include <utils/environment.h>
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QPointer>
|
#include <QtCore/QPointer>
|
||||||
@@ -88,7 +88,8 @@ private:
|
|||||||
DumpersUploaded, StartingRemoteProcess, Debugging
|
DumpersUploaded, StartingRemoteProcess, Debugging
|
||||||
};
|
};
|
||||||
|
|
||||||
static QString environment(const MaemoRunConfiguration *rc);
|
static QString environment(MaemoRunConfiguration::DebuggingType debuggingType,
|
||||||
|
const QList<Utils::EnvironmentItem> &userEnvChanges);
|
||||||
|
|
||||||
void handleAdapterSetupFailed(const QString &error);
|
void handleAdapterSetupFailed(const QString &error);
|
||||||
void handleAdapterSetupDone();
|
void handleAdapterSetupDone();
|
||||||
@@ -98,10 +99,10 @@ private:
|
|||||||
bool setPort(int &port);
|
bool setPort(int &port);
|
||||||
|
|
||||||
const QPointer<Debugger::DebuggerRunControl> m_runControl;
|
const QPointer<Debugger::DebuggerRunControl> m_runControl;
|
||||||
MaemoRunConfiguration * const m_runConfig;
|
const QPointer<MaemoRunConfiguration> m_runConfig;
|
||||||
const MaemoDeviceConfig m_deviceConfig;
|
|
||||||
MaemoSshRunner * const m_runner;
|
MaemoSshRunner * const m_runner;
|
||||||
const MaemoRunConfiguration::DebuggingType m_debuggingType;
|
const MaemoRunConfiguration::DebuggingType m_debuggingType;
|
||||||
|
const QString m_dumperLib;
|
||||||
|
|
||||||
QSharedPointer<Core::SftpChannel> m_uploader;
|
QSharedPointer<Core::SftpChannel> m_uploader;
|
||||||
Core::SftpJobId m_uploadJob;
|
Core::SftpJobId m_uploadJob;
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace Qt4ProjectManager {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
MaemoRemoteMounter::MaemoRemoteMounter(QObject *parent)
|
MaemoRemoteMounter::MaemoRemoteMounter(QObject *parent)
|
||||||
: QObject(parent), m_toolChain(0), m_utfsServerTimer(new QTimer(this)),
|
: QObject(parent), m_utfsServerTimer(new QTimer(this)),
|
||||||
m_uploadJobId(SftpInvalidJob), m_state(Inactive)
|
m_uploadJobId(SftpInvalidJob), m_state(Inactive)
|
||||||
{
|
{
|
||||||
connect(m_utfsServerTimer, SIGNAL(timeout()), this,
|
connect(m_utfsServerTimer, SIGNAL(timeout()), this,
|
||||||
@@ -60,20 +60,25 @@ MaemoRemoteMounter::~MaemoRemoteMounter()
|
|||||||
killAllUtfsServers();
|
killAllUtfsServers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoRemoteMounter::setConnection(const Core::SshConnection::Ptr &connection)
|
void MaemoRemoteMounter::setConnection(const SshConnection::Ptr &connection)
|
||||||
{
|
{
|
||||||
ASSERT_STATE(Inactive);
|
ASSERT_STATE(Inactive);
|
||||||
|
|
||||||
m_connection = connection;
|
m_connection = connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MaemoRemoteMounter::setToolchain(const MaemoToolChain *toolChain)
|
||||||
|
{
|
||||||
|
ASSERT_STATE(Inactive);
|
||||||
|
m_remoteMountsAllowed = toolChain->allowsRemoteMounts();
|
||||||
|
m_maddeRoot = toolChain->maddeRoot();
|
||||||
|
}
|
||||||
|
|
||||||
void MaemoRemoteMounter::addMountSpecification(const MaemoMountSpecification &mountSpec,
|
void MaemoRemoteMounter::addMountSpecification(const MaemoMountSpecification &mountSpec,
|
||||||
bool mountAsRoot)
|
bool mountAsRoot)
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_toolChain);
|
|
||||||
ASSERT_STATE(Inactive);
|
ASSERT_STATE(Inactive);
|
||||||
|
|
||||||
if (m_toolChain->allowsRemoteMounts() && mountSpec.isValid())
|
if (m_remoteMountsAllowed && mountSpec.isValid())
|
||||||
m_mountSpecs << MountInfo(mountSpec, mountAsRoot);
|
m_mountSpecs << MountInfo(mountSpec, mountAsRoot);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,7 +209,7 @@ void MaemoRemoteMounter::handleUploaderInitialized()
|
|||||||
SIGNAL(finished(Core::SftpJobId, QString)), this,
|
SIGNAL(finished(Core::SftpJobId, QString)), this,
|
||||||
SLOT(handleUploadFinished(Core::SftpJobId, QString)));
|
SLOT(handleUploadFinished(Core::SftpJobId, QString)));
|
||||||
const QString localFile
|
const QString localFile
|
||||||
= m_toolChain->maddeRoot() + QLatin1String("/madlib/armel/utfs-client");
|
= m_maddeRoot + QLatin1String("/madlib/armel/utfs-client");
|
||||||
m_uploadJobId = m_utfsClientUploader->uploadFile(localFile,
|
m_uploadJobId = m_utfsClientUploader->uploadFile(localFile,
|
||||||
utfsClientOnDevice(), SftpOverwriteExisting);
|
utfsClientOnDevice(), SftpOverwriteExisting);
|
||||||
if (m_uploadJobId == SftpInvalidJob) {
|
if (m_uploadJobId == SftpInvalidJob) {
|
||||||
@@ -405,7 +410,7 @@ QString MaemoRemoteMounter::utfsClientOnDevice() const
|
|||||||
|
|
||||||
QString MaemoRemoteMounter::utfsServer() const
|
QString MaemoRemoteMounter::utfsServer() const
|
||||||
{
|
{
|
||||||
return m_toolChain->maddeRoot() + QLatin1String("/madlib/utfs-server");
|
return m_maddeRoot + QLatin1String("/madlib/utfs-server");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoRemoteMounter::killAllUtfsServers()
|
void MaemoRemoteMounter::killAllUtfsServers()
|
||||||
|
|||||||
@@ -60,7 +60,11 @@ class MaemoRemoteMounter : public QObject
|
|||||||
public:
|
public:
|
||||||
MaemoRemoteMounter(QObject *parent);
|
MaemoRemoteMounter(QObject *parent);
|
||||||
~MaemoRemoteMounter();
|
~MaemoRemoteMounter();
|
||||||
void setToolchain(const MaemoToolChain *toolchain) { m_toolChain = toolchain; }
|
|
||||||
|
// Must already be connected.
|
||||||
|
void setConnection(const QSharedPointer<Core::SshConnection> &connection);
|
||||||
|
|
||||||
|
void setToolchain(const MaemoToolChain *toolChain);
|
||||||
void addMountSpecification(const MaemoMountSpecification &mountSpec,
|
void addMountSpecification(const MaemoMountSpecification &mountSpec,
|
||||||
bool mountAsRoot);
|
bool mountAsRoot);
|
||||||
bool hasValidMountSpecifications() const;
|
bool hasValidMountSpecifications() const;
|
||||||
@@ -70,9 +74,6 @@ public:
|
|||||||
void unmount();
|
void unmount();
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
// Must be connected already.
|
|
||||||
void setConnection(const QSharedPointer<Core::SshConnection> &connection);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void mounted();
|
void mounted();
|
||||||
void unmounted();
|
void unmounted();
|
||||||
@@ -111,7 +112,6 @@ private:
|
|||||||
QString utfsClientOnDevice() const;
|
QString utfsClientOnDevice() const;
|
||||||
QString utfsServer() const;
|
QString utfsServer() const;
|
||||||
|
|
||||||
const MaemoToolChain *m_toolChain;
|
|
||||||
QTimer * const m_utfsServerTimer;
|
QTimer * const m_utfsServerTimer;
|
||||||
|
|
||||||
struct MountInfo {
|
struct MountInfo {
|
||||||
@@ -136,6 +136,8 @@ private:
|
|||||||
QByteArray m_umountStderr;
|
QByteArray m_umountStderr;
|
||||||
MaemoPortList *m_freePorts;
|
MaemoPortList *m_freePorts;
|
||||||
const MaemoUsedPortsGatherer *m_portsGatherer;
|
const MaemoUsedPortsGatherer *m_portsGatherer;
|
||||||
|
bool m_remoteMountsAllowed;
|
||||||
|
QString m_maddeRoot;
|
||||||
|
|
||||||
State m_state;
|
State m_state;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ public:
|
|||||||
int validMountSpecificationCount() const;
|
int validMountSpecificationCount() const;
|
||||||
MaemoMountSpecification mountSpecificationAt(int pos) const { return m_mountSpecs.at(pos); }
|
MaemoMountSpecification mountSpecificationAt(int pos) const { return m_mountSpecs.at(pos); }
|
||||||
bool hasValidMountSpecifications() const;
|
bool hasValidMountSpecifications() const;
|
||||||
|
const QList<MaemoMountSpecification> &mountSpecs() const { return m_mountSpecs; }
|
||||||
|
|
||||||
void addMountSpecification(const QString &localDir);
|
void addMountSpecification(const QString &localDir);
|
||||||
void removeMountSpecificationAt(int pos);
|
void removeMountSpecificationAt(int pos);
|
||||||
|
|||||||
@@ -53,9 +53,7 @@ using ProjectExplorer::RunConfiguration;
|
|||||||
|
|
||||||
MaemoRunControl::MaemoRunControl(RunConfiguration *rc)
|
MaemoRunControl::MaemoRunControl(RunConfiguration *rc)
|
||||||
: RunControl(rc, ProjectExplorer::Constants::RUNMODE)
|
: RunControl(rc, ProjectExplorer::Constants::RUNMODE)
|
||||||
, m_runConfig(qobject_cast<MaemoRunConfiguration *>(rc))
|
, m_runner(new MaemoSshRunner(this, qobject_cast<MaemoRunConfiguration *>(rc), false))
|
||||||
, m_devConfig(m_runConfig ? m_runConfig->deviceConfig() : MaemoDeviceConfig())
|
|
||||||
, m_runner(new MaemoSshRunner(this, m_runConfig, false))
|
|
||||||
, m_running(false)
|
, m_running(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -67,32 +65,24 @@ MaemoRunControl::~MaemoRunControl()
|
|||||||
|
|
||||||
void MaemoRunControl::start()
|
void MaemoRunControl::start()
|
||||||
{
|
{
|
||||||
if (!m_devConfig.isValid()) {
|
m_running = true;
|
||||||
handleError(tr("No device configuration set for run configuration."));
|
emit started();
|
||||||
} else if (!m_runConfig) {
|
disconnect(m_runner, 0, this, 0);
|
||||||
handleError(tr("Run configuration no longer available."));
|
connect(m_runner, SIGNAL(error(QString)), SLOT(handleSshError(QString)));
|
||||||
} else {
|
connect(m_runner, SIGNAL(readyForExecution()), SLOT(startExecution()));
|
||||||
m_running = true;
|
connect(m_runner, SIGNAL(remoteErrorOutput(QByteArray)),
|
||||||
emit started();
|
SLOT(handleRemoteErrorOutput(QByteArray)));
|
||||||
disconnect(m_runner, 0, this, 0);
|
connect(m_runner, SIGNAL(remoteOutput(QByteArray)),
|
||||||
connect(m_runner, SIGNAL(error(QString)), this,
|
SLOT(handleRemoteOutput(QByteArray)));
|
||||||
SLOT(handleSshError(QString)));
|
connect(m_runner, SIGNAL(remoteProcessStarted()),
|
||||||
connect(m_runner, SIGNAL(readyForExecution()), this,
|
SLOT(handleRemoteProcessStarted()));
|
||||||
SLOT(startExecution()));
|
connect(m_runner, SIGNAL(remoteProcessFinished(qint64)),
|
||||||
connect(m_runner, SIGNAL(remoteErrorOutput(QByteArray)), this,
|
SLOT(handleRemoteProcessFinished(qint64)));
|
||||||
SLOT(handleRemoteErrorOutput(QByteArray)));
|
connect(m_runner, SIGNAL(reportProgress(QString)),
|
||||||
connect(m_runner, SIGNAL(remoteOutput(QByteArray)), this,
|
SLOT(handleProgressReport(QString)));
|
||||||
SLOT(handleRemoteOutput(QByteArray)));
|
connect(m_runner, SIGNAL(mountDebugOutput(QString)),
|
||||||
connect(m_runner, SIGNAL(remoteProcessStarted()), this,
|
SLOT(handleMountDebugOutput(QString)));
|
||||||
SLOT(handleRemoteProcessStarted()));
|
m_runner->start();
|
||||||
connect(m_runner, SIGNAL(remoteProcessFinished(qint64)), this,
|
|
||||||
SLOT(handleRemoteProcessFinished(qint64)));
|
|
||||||
connect(m_runner, SIGNAL(reportProgress(QString)), this,
|
|
||||||
SLOT(handleProgressReport(QString)));
|
|
||||||
connect(m_runner, SIGNAL(mountDebugOutput(QString)), this,
|
|
||||||
SLOT(handleMountDebugOutput(QString)));
|
|
||||||
m_runner->start();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::RunControl::StopResult MaemoRunControl::stop()
|
ProjectExplorer::RunControl::StopResult MaemoRunControl::stop()
|
||||||
@@ -110,12 +100,11 @@ void MaemoRunControl::handleSshError(const QString &error)
|
|||||||
void MaemoRunControl::startExecution()
|
void MaemoRunControl::startExecution()
|
||||||
{
|
{
|
||||||
emit appendMessage(this, tr("Starting remote process ..."), false);
|
emit appendMessage(this, tr("Starting remote process ..."), false);
|
||||||
const QString &remoteExe = m_runConfig->remoteExecutableFilePath();
|
|
||||||
m_runner->startExecution(QString::fromLocal8Bit("%1 %2 %3 %4")
|
m_runner->startExecution(QString::fromLocal8Bit("%1 %2 %3 %4")
|
||||||
.arg(MaemoGlobal::remoteCommandPrefix(remoteExe))
|
.arg(MaemoGlobal::remoteCommandPrefix(m_runner->remoteExecutable()))
|
||||||
.arg(MaemoGlobal::remoteEnvironment(m_runConfig->userEnvironmentChanges()))
|
.arg(MaemoGlobal::remoteEnvironment(m_runner->userEnvChanges()))
|
||||||
.arg(remoteExe)
|
.arg(m_runner->remoteExecutable())
|
||||||
.arg(m_runConfig->arguments().join(QLatin1String(" "))).toUtf8());
|
.arg(m_runner->arguments().join(QLatin1String(" "))).toUtf8());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoRunControl::handleRemoteProcessFinished(qint64 exitCode)
|
void MaemoRunControl::handleRemoteProcessFinished(qint64 exitCode)
|
||||||
|
|||||||
@@ -35,11 +35,8 @@
|
|||||||
#ifndef MAEMORUNCONTROL_H
|
#ifndef MAEMORUNCONTROL_H
|
||||||
#define MAEMORUNCONTROL_H
|
#define MAEMORUNCONTROL_H
|
||||||
|
|
||||||
#include "maemodeviceconfigurations.h"
|
|
||||||
|
|
||||||
#include <projectexplorer/runconfiguration.h>
|
#include <projectexplorer/runconfiguration.h>
|
||||||
|
|
||||||
#include <QtCore/QPointer>
|
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
|
|
||||||
namespace Qt4ProjectManager {
|
namespace Qt4ProjectManager {
|
||||||
@@ -72,8 +69,6 @@ private:
|
|||||||
void setFinished();
|
void setFinished();
|
||||||
void handleError(const QString &errString);
|
void handleError(const QString &errString);
|
||||||
|
|
||||||
QPointer<MaemoRunConfiguration> m_runConfig;
|
|
||||||
const MaemoDeviceConfig m_devConfig;
|
|
||||||
MaemoSshRunner * const m_runner;
|
MaemoSshRunner * const m_runner;
|
||||||
bool m_running;
|
bool m_running;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -58,14 +58,25 @@ namespace Internal {
|
|||||||
|
|
||||||
MaemoSshRunner::MaemoSshRunner(QObject *parent,
|
MaemoSshRunner::MaemoSshRunner(QObject *parent,
|
||||||
MaemoRunConfiguration *runConfig, bool debugging)
|
MaemoRunConfiguration *runConfig, bool debugging)
|
||||||
: QObject(parent), m_runConfig(runConfig),
|
: QObject(parent),
|
||||||
m_mounter(new MaemoRemoteMounter(this)),
|
m_mounter(new MaemoRemoteMounter(this)),
|
||||||
m_portsGatherer(new MaemoUsedPortsGatherer(this)),
|
m_portsGatherer(new MaemoUsedPortsGatherer(this)),
|
||||||
m_devConfig(runConfig->deviceConfig()),
|
m_devConfig(runConfig->deviceConfig()),
|
||||||
m_freePorts(runConfig->freePorts()),
|
m_remoteExecutable(runConfig->remoteExecutableFilePath()),
|
||||||
m_debugging(debugging), m_state(Inactive)
|
m_appArguments(runConfig->arguments()),
|
||||||
|
m_userEnvChanges(runConfig->userEnvironmentChanges()),
|
||||||
|
m_initialFreePorts(runConfig->freePorts()),
|
||||||
|
m_mountSpecs(runConfig->remoteMounts()->mountSpecs()),
|
||||||
|
m_state(Inactive)
|
||||||
{
|
{
|
||||||
m_procsToKill << QFileInfo(m_runConfig->localExecutableFilePath()).fileName();
|
m_connection = runConfig->deployStep()->sshConnection();
|
||||||
|
m_mounter->setToolchain(runConfig->toolchain());
|
||||||
|
if (debugging && runConfig->useRemoteGdb()) {
|
||||||
|
m_mountSpecs << MaemoMountSpecification(runConfig->localDirToMountForRemoteGdb(),
|
||||||
|
runConfig->remoteProjectSourcesMountPoint());
|
||||||
|
}
|
||||||
|
|
||||||
|
m_procsToKill << QFileInfo(m_remoteExecutable).fileName();
|
||||||
connect(m_mounter, SIGNAL(mounted()), this, SLOT(handleMounted()));
|
connect(m_mounter, SIGNAL(mounted()), this, SLOT(handleMounted()));
|
||||||
connect(m_mounter, SIGNAL(unmounted()), this, SLOT(handleUnmounted()));
|
connect(m_mounter, SIGNAL(unmounted()), this, SLOT(handleUnmounted()));
|
||||||
connect(m_mounter, SIGNAL(error(QString)), this,
|
connect(m_mounter, SIGNAL(error(QString)), this,
|
||||||
@@ -86,11 +97,20 @@ void MaemoSshRunner::start()
|
|||||||
{
|
{
|
||||||
ASSERT_STATE(QList<State>() << Inactive << StopRequested);
|
ASSERT_STATE(QList<State>() << Inactive << StopRequested);
|
||||||
|
|
||||||
|
if (m_remoteExecutable.isEmpty()) {
|
||||||
|
emitError(tr("Cannot run: No remote executable set."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!m_devConfig.isValid()) {
|
||||||
|
emitError(tr("Cannot run: No device configuration set."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setState(Connecting);
|
setState(Connecting);
|
||||||
m_exitStatus = -1;
|
m_exitStatus = -1;
|
||||||
|
m_freePorts = m_initialFreePorts;
|
||||||
if (m_connection)
|
if (m_connection)
|
||||||
disconnect(m_connection.data(), 0, this, 0);
|
disconnect(m_connection.data(), 0, this, 0);
|
||||||
m_connection = m_runConfig->deployStep()->sshConnection();
|
|
||||||
const bool reUse = isConnectionUsable();
|
const bool reUse = isConnectionUsable();
|
||||||
if (!reUse)
|
if (!reUse)
|
||||||
m_connection = SshConnection::create();
|
m_connection = SshConnection::create();
|
||||||
@@ -193,17 +213,8 @@ void MaemoSshRunner::handleUnmounted()
|
|||||||
|
|
||||||
switch (m_state) {
|
switch (m_state) {
|
||||||
case PreRunCleaning: {
|
case PreRunCleaning: {
|
||||||
m_mounter->resetMountSpecifications();
|
for (int i = 0; i < m_mountSpecs.count(); ++i)
|
||||||
m_mounter->setToolchain(m_runConfig->toolchain());
|
m_mounter->addMountSpecification(m_mountSpecs.at(i), false);
|
||||||
const MaemoRemoteMountsModel * const remoteMounts
|
|
||||||
= m_runConfig->remoteMounts();
|
|
||||||
for (int i = 0; i < remoteMounts->mountSpecificationCount(); ++i)
|
|
||||||
m_mounter->addMountSpecification(remoteMounts->mountSpecificationAt(i), false);
|
|
||||||
if (m_debugging && m_runConfig->useRemoteGdb()) {
|
|
||||||
m_mounter->addMountSpecification(MaemoMountSpecification(
|
|
||||||
m_runConfig->localDirToMountForRemoteGdb(),
|
|
||||||
m_runConfig->remoteProjectSourcesMountPoint()), false);
|
|
||||||
}
|
|
||||||
setState(PreMountUnmounting);
|
setState(PreMountUnmounting);
|
||||||
unmount();
|
unmount();
|
||||||
break;
|
break;
|
||||||
@@ -253,11 +264,6 @@ void MaemoSshRunner::startExecution(const QByteArray &remoteCall)
|
|||||||
{
|
{
|
||||||
ASSERT_STATE(ReadyForExecution);
|
ASSERT_STATE(ReadyForExecution);
|
||||||
|
|
||||||
if (m_runConfig->remoteExecutableFilePath().isEmpty()) {
|
|
||||||
emitError(tr("Cannot run: No remote executable set."));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_runner = m_connection->createRemoteProcess(remoteCall);
|
m_runner = m_connection->createRemoteProcess(remoteCall);
|
||||||
connect(m_runner.data(), SIGNAL(started()), this,
|
connect(m_runner.data(), SIGNAL(started()), this,
|
||||||
SIGNAL(remoteProcessStarted()));
|
SIGNAL(remoteProcessStarted()));
|
||||||
|
|||||||
@@ -38,6 +38,8 @@
|
|||||||
#include "maemodeviceconfigurations.h"
|
#include "maemodeviceconfigurations.h"
|
||||||
#include "maemomountspecification.h"
|
#include "maemomountspecification.h"
|
||||||
|
|
||||||
|
#include <utils/environment.h>
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QSharedPointer>
|
#include <QtCore/QSharedPointer>
|
||||||
#include <QtCore/QStringList>
|
#include <QtCore/QStringList>
|
||||||
@@ -70,6 +72,10 @@ public:
|
|||||||
|
|
||||||
const MaemoUsedPortsGatherer *usedPortsGatherer() const { return m_portsGatherer; }
|
const MaemoUsedPortsGatherer *usedPortsGatherer() const { return m_portsGatherer; }
|
||||||
MaemoPortList *freePorts() { return &m_freePorts; }
|
MaemoPortList *freePorts() { return &m_freePorts; }
|
||||||
|
MaemoDeviceConfig deviceConfig() const { return m_devConfig; }
|
||||||
|
QString remoteExecutable() const { return m_remoteExecutable; }
|
||||||
|
QStringList arguments() const { return m_appArguments; }
|
||||||
|
QList<Utils::EnvironmentItem> userEnvChanges() const { return m_userEnvChanges; }
|
||||||
|
|
||||||
static const qint64 InvalidExitCode;
|
static const qint64 InvalidExitCode;
|
||||||
|
|
||||||
@@ -108,10 +114,14 @@ private:
|
|||||||
void mount();
|
void mount();
|
||||||
void unmount();
|
void unmount();
|
||||||
|
|
||||||
MaemoRunConfiguration * const m_runConfig; // TODO this pointer can be invalid
|
|
||||||
MaemoRemoteMounter * const m_mounter;
|
MaemoRemoteMounter * const m_mounter;
|
||||||
MaemoUsedPortsGatherer * const m_portsGatherer;
|
MaemoUsedPortsGatherer * const m_portsGatherer;
|
||||||
const MaemoDeviceConfig m_devConfig;
|
const MaemoDeviceConfig m_devConfig;
|
||||||
|
const QString m_remoteExecutable;
|
||||||
|
const QStringList m_appArguments;
|
||||||
|
const QList<Utils::EnvironmentItem> m_userEnvChanges;
|
||||||
|
const MaemoPortList m_initialFreePorts;
|
||||||
|
QList<MaemoMountSpecification> m_mountSpecs;
|
||||||
|
|
||||||
QSharedPointer<Core::SshConnection> m_connection;
|
QSharedPointer<Core::SshConnection> m_connection;
|
||||||
QSharedPointer<Core::SshRemoteProcess> m_runner;
|
QSharedPointer<Core::SshRemoteProcess> m_runner;
|
||||||
@@ -120,7 +130,6 @@ private:
|
|||||||
MaemoPortList m_freePorts;
|
MaemoPortList m_freePorts;
|
||||||
|
|
||||||
int m_exitStatus;
|
int m_exitStatus;
|
||||||
const bool m_debugging;
|
|
||||||
State m_state;
|
State m_state;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user