Commit 2a9ca651 authored by kh1's avatar kh1

Workaround for windows deployment.

SCP chokes on full path names, thus set the wd to the delploy dir.
parent 56ded78d
...@@ -47,6 +47,8 @@ ...@@ -47,6 +47,8 @@
#include <projectexplorer/session.h> #include <projectexplorer/session.h>
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtCore/QPair>
#include <QtCore/QProcess> #include <QtCore/QProcess>
#include <QtCore/QSharedPointer> #include <QtCore/QSharedPointer>
...@@ -104,6 +106,7 @@ public: ...@@ -104,6 +106,7 @@ public:
protected: protected:
void startDeployment(bool forDebugging); void startDeployment(bool forDebugging);
void deploy();
void stopDeployment(); void stopDeployment();
bool isDeploying() const; bool isDeploying() const;
const QString executableOnHost() const; const QString executableOnHost() const;
...@@ -123,14 +126,13 @@ private slots: ...@@ -123,14 +126,13 @@ private slots:
protected: protected:
ErrorDumper dumper; ErrorDumper dumper;
MaemoRunConfiguration *runConfig; // TODO this pointer can be invalid MaemoRunConfiguration *runConfig; // TODO this pointer can be invalid
const MaemoDeviceConfigurations::DeviceConfig devConfig;
private: private:
QProcess deployProcess; QProcess deployProcess;
bool deployingExecutable; bool deployingExecutable;
bool deployingDumperLib; bool deployingDumperLib;
QList<QPair<QString, QString> > deployables;
protected:
const MaemoDeviceConfigurations::DeviceConfig devConfig;
}; };
class MaemoRunControl : public AbstractMaemoRunControl class MaemoRunControl : public AbstractMaemoRunControl
...@@ -405,7 +407,8 @@ const QString MaemoRunConfiguration::cmd(const QString &cmdName) const ...@@ -405,7 +407,8 @@ const QString MaemoRunConfiguration::cmd(const QString &cmdName) const
const MaemoToolChain *MaemoRunConfiguration::toolchain() const const MaemoToolChain *MaemoRunConfiguration::toolchain() const
{ {
Qt4BuildConfiguration *qt4bc = qobject_cast<Qt4BuildConfiguration *>(project()->activeBuildConfiguration()); Qt4BuildConfiguration *qt4bc = qobject_cast<Qt4BuildConfiguration *>
(project()->activeBuildConfiguration());
QTC_ASSERT(qt4bc, return 0); QTC_ASSERT(qt4bc, return 0);
MaemoToolChain *tc = dynamic_cast<MaemoToolChain *>( MaemoToolChain *tc = dynamic_cast<MaemoToolChain *>(
qt4bc->toolChain() ); qt4bc->toolChain() );
...@@ -1033,30 +1036,42 @@ AbstractMaemoRunControl::AbstractMaemoRunControl(RunConfiguration *rc) ...@@ -1033,30 +1036,42 @@ AbstractMaemoRunControl::AbstractMaemoRunControl(RunConfiguration *rc)
void AbstractMaemoRunControl::startDeployment(bool forDebugging) void AbstractMaemoRunControl::startDeployment(bool forDebugging)
{ {
QTC_ASSERT(runConfig, return); QTC_ASSERT(runConfig, return);
if (!devConfig.isValid()) {
deploymentFinished(false); if (devConfig.isValid()) {
return; deployables.clear();
} if (runConfig->currentlyNeedsDeployment()) {
QStringList deployables; deployingExecutable = true;
if (runConfig->currentlyNeedsDeployment()) { deployables.append(qMakePair(executableFileName(),
deployingExecutable = true; QFileInfo(executableOnHost()).canonicalPath()));
deployables << executableFileName(); } else {
} else { deployingExecutable = false;
deployingExecutable = false; }
}
if (forDebugging && runConfig->debuggingHelpersNeedDeployment()) { if (forDebugging && runConfig->debuggingHelpersNeedDeployment()) {
deployables << runConfig->dumperLib(); deployingDumperLib = true;
deployingDumperLib = true; const QFileInfo &info(runConfig->dumperLib());
deployables.append(qMakePair(info.fileName(), info.canonicalPath()));
} else {
deployingDumperLib = false;
}
deploy();
} else { } else {
deployingDumperLib = false; deploymentFinished(false);
} }
}
void AbstractMaemoRunControl::deploy()
{
if (!deployables.isEmpty()) { if (!deployables.isEmpty()) {
emit addToOutputWindow(this, tr("Files to deploy: %1.") QPair<QString, QString> pair = deployables.at(0);
.arg(deployables.join(" "))); emit addToOutputWindow(this, tr("File to deploy: %1.").arg(pair.first));
QStringList cmdArgs; QStringList cmdArgs;
cmdArgs << "-P" << port() << options() << deployables cmdArgs << "-P" << port() << options() << pair.first << (devConfig.uname
<< (devConfig.uname + "@" + devConfig.host + ":" + remoteDir()); + "@" + devConfig.host + ":" + remoteDir());
deployProcess.setWorkingDirectory(QFileInfo(executableOnHost()).absolutePath()); deployProcess.setWorkingDirectory(QFileInfo(pair.second).absolutePath());
deployProcess.start(runConfig->scpCmd(), cmdArgs); deployProcess.start(runConfig->scpCmd(), cmdArgs);
if (!deployProcess.waitForStarted()) { if (!deployProcess.waitForStarted()) {
emit error(this, tr("Could not start scp. Deployment failed.")); emit error(this, tr("Could not start scp. Deployment failed."));
...@@ -1089,11 +1104,15 @@ void AbstractMaemoRunControl::deployProcessFinished() ...@@ -1089,11 +1104,15 @@ void AbstractMaemoRunControl::deployProcessFinished()
runConfig->wasDeployed(); runConfig->wasDeployed();
if (deployingDumperLib) if (deployingDumperLib)
runConfig->debuggingHelpersDeployed(); runConfig->debuggingHelpersDeployed();
deployables.removeFirst();
} else { } else {
emit error(this, tr("Deployment failed.")); emit error(this, tr("Deployment failed."));
success = false; success = false;
} }
deploymentFinished(success); if (deployables.isEmpty() || !success)
deploymentFinished(success);
else
deploy();
} }
const QString AbstractMaemoRunControl::executableOnHost() const const QString AbstractMaemoRunControl::executableOnHost() const
...@@ -1146,7 +1165,8 @@ const QString AbstractMaemoRunControl::targetCmdLinePrefix() const ...@@ -1146,7 +1165,8 @@ const QString AbstractMaemoRunControl::targetCmdLinePrefix() const
bool AbstractMaemoRunControl::setProcessEnvironment(QProcess &process) bool AbstractMaemoRunControl::setProcessEnvironment(QProcess &process)
{ {
QTC_ASSERT(runConfig, return false); QTC_ASSERT(runConfig, return false);
Qt4BuildConfiguration *qt4bc = qobject_cast<Qt4BuildConfiguration *>(runConfig->project()->activeBuildConfiguration()); Qt4BuildConfiguration *qt4bc = qobject_cast<Qt4BuildConfiguration*>
(runConfig->project()->activeBuildConfiguration());
QTC_ASSERT(qt4bc, return false); QTC_ASSERT(qt4bc, return false);
Environment env = Environment::systemEnvironment(); Environment env = Environment::systemEnvironment();
qt4bc->toolChain()->addToEnvironment(env); qt4bc->toolChain()->addToEnvironment(env);
......
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