diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp index 9f754d61b858327e4eabc277a0db7c5aa0b70a0b..2ebe03ef7b4cb3b8f42fd2c3e0d51d30b9139e4d 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp @@ -80,16 +80,19 @@ const int PROGRESS_MAX = 400; enum { debug = 0 }; // Format information about a file -QString lsFile(const QString &f) +static inline QString msgListFile(const QString &f) { QString rc; const QFileInfo fi(f); QTextStream str(&rc); - str << fi.size() << ' ' << fi.lastModified().toString(Qt::ISODate) << ' ' << QDir::toNativeSeparators(fi.absoluteFilePath()); + if (fi.exists()) { + str << fi.size() << ' ' << fi.lastModified().toString(Qt::ISODate) << ' ' << QDir::toNativeSeparators(fi.absoluteFilePath()); + } else { + str << "<non-existent> " << QDir::toNativeSeparators(fi.absoluteFilePath()); + } return rc; } - QString pathFromId(const QString &id) { if (!id.startsWith(QLatin1String(S60_DEVICE_RC_PREFIX))) @@ -337,6 +340,14 @@ static inline QString executableFromPackageUnix(const QString &packageFileName) return QString(); } +const QtVersion *S60DeviceRunConfiguration::qtVersion() const +{ + if (const BuildConfiguration *bc = target()->activeBuildConfiguration()) + if (const Qt4BuildConfiguration *qt4bc = qobject_cast<const Qt4BuildConfiguration *>(bc)) + return qt4bc->qtVersion(); + return 0; +} + QString S60DeviceRunConfiguration::localExecutableFileName() const { QString localExecutable; @@ -346,8 +357,9 @@ QString S60DeviceRunConfiguration::localExecutableFileName() const localExecutable = executableFromPackageUnix(packageTemplateFileName()); break; default: { - const Qt4BuildConfiguration *qt4bc = qobject_cast<Qt4BuildConfiguration *>(target()->activeBuildConfiguration()); - const S60Devices::Device device = S60Manager::instance()->deviceForQtVersion(qt4bc->qtVersion()); + const QtVersion *qtv = qtVersion(); + QTC_ASSERT(qtv, return QString()); + const S60Devices::Device device = S60Manager::instance()->deviceForQtVersion(qtv); QTextStream(&localExecutable) << device.epocRoot << "/epoc32/release/" << symbianPlatform() << '/' << symbianTarget() << '/' << targetName() << ".exe"; @@ -567,17 +579,21 @@ S60DeviceRunControlBase::S60DeviceRunControlBase(RunConfiguration *runConfigurat m_useCustomSignature = (s60runConfig->signingMode() == S60DeviceRunConfiguration::SignCustom); m_customSignaturePath = s60runConfig->customSignaturePath(); m_customKeyPath = s60runConfig->customKeyPath(); - + if (const QtVersion *qtv = s60runConfig->qtVersion()) + m_qtBinPath = qtv->versionInfo().value(QLatin1String("QT_INSTALL_BINS")); + QTC_ASSERT(!m_qtBinPath.isEmpty(), return); const S60Devices::Device device = S60Manager::instance()->deviceForQtVersion(activeBuildConf->qtVersion()); switch (m_toolChain) { case ProjectExplorer::ToolChain::GCCE_GNUPOC: case ProjectExplorer::ToolChain::RVCT_ARMV5_GNUPOC: { // 'sis' is a make target here. Set up with correct environment + // Also add $QTDIR/bin, since it needs to find 'createpackage'. ProjectExplorer::ToolChain *toolchain = activeBuildConf->toolChain(); m_makesisTool = toolchain->makeCommand(); m_toolsDirectory = device.epocRoot + QLatin1String("/epoc32/tools"); ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment(); toolchain->addToEnvironment(env); + env.prependOrSetPath(m_qtBinPath); m_makesisProcess->setEnvironment(env.toStringList()); } break; @@ -641,7 +657,7 @@ void S60DeviceRunControlBase::start() } emit addToOutputWindow(this, tr("Creating %1 ...").arg(m_signedPackage)); - emit addToOutputWindow(this, tr("Executable file: %1").arg(lsFile(m_executableFileName))); + emit addToOutputWindow(this, tr("Executable file: %1").arg(msgListFile(m_executableFileName))); QString errorMessage; QString settingsCategory; @@ -752,10 +768,11 @@ void S60DeviceRunControlBase::makesisProcessFailed() processFailed(m_makesisTool, m_makesisProcess->error()); } - static inline bool renameFile(const QString &sourceName, const QString &targetName, QString *errorMessage) { + if (sourceName == targetName) + return true; QFile target(targetName); if (target.exists() && !target.remove()) { *errorMessage = S60DeviceRunControlBase::tr("Unable to remove existing file '%1': %2").arg(targetName, target.errorString()); @@ -779,25 +796,32 @@ void S60DeviceRunControlBase::makesisProcessFinished() return; } m_deployProgress->setProgressValue(PROGRESS_PACKAGECREATED); + QString errorMessage; + bool ok = false; switch (m_toolChain) { case ProjectExplorer::ToolChain::GCCE_GNUPOC: - case ProjectExplorer::ToolChain::RVCT_ARMV5_GNUPOC: - startDeployment(); + case ProjectExplorer::ToolChain::RVCT_ARMV5_GNUPOC: { + // 'make sis' creates 'targetname.sis'. Rename to full name + // 'targetname_armX_udeb.sis'. + const QString oldName = m_workingDirectory + QLatin1Char('/') + m_targetName + QLatin1String(".sis"); + ok = renameFile(oldName, m_signedPackage, &errorMessage); + if (ok) + startDeployment(); + } break; default: - // makesis.exe derives the sis file name from the package, + // makesis.exe derives the sis file name from the '.pkg'-file, // it thus needs to renamed to '_unsigned.sis'. - QString errorMessage; - if (renameFile(m_signedPackage, m_unsignedPackage, &errorMessage)) { + ok = renameFile(m_signedPackage, m_unsignedPackage, &errorMessage); + if (ok) startSigning(); - } else { - error(this, errorMessage); - stop(); - emit finished(); - return; - } break; } + if (!ok) { + error(this, errorMessage); + stop(); + emit finished(); + } } QString S60DeviceRunControlBase::signSisKey() const @@ -880,7 +904,7 @@ void S60DeviceRunControlBase::startDeployment() m_launcher->setCopyFileName(m_signedPackage, copyDst); m_launcher->setInstallFileName(copyDst); initLauncher(runFileName, m_launcher); - emit addToOutputWindow(this, tr("Package: %1\nDeploying application to '%2'...").arg(lsFile(m_signedPackage), m_serialPortFriendlyName)); + emit addToOutputWindow(this, tr("Package: %1\nDeploying application to '%2'...").arg(msgListFile(m_signedPackage), m_serialPortFriendlyName)); // Prompt the user to start up the Blue tooth connection const trk::PromptStartCommunicationResult src = S60RunConfigBluetoothStarter::startCommunication(m_launcher->trkDevice(), diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h index abba4ee1c8051061939c98c7e4b744369366cba8..3d9aa7cdf723c5c0425c773323b2dee1dc766ebe 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h +++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h @@ -52,6 +52,7 @@ class SymbianDevice; } namespace Qt4ProjectManager { +class QtVersion; namespace Internal { class Qt4ProFileNode; @@ -96,6 +97,7 @@ public: QString localExecutableFileName() const; QString unsignedPackage() const; QString signedPackage() const; + const QtVersion *qtVersion() const; QStringList commandLineArguments() const; void setCommandLineArguments(const QStringList &args); @@ -239,6 +241,7 @@ private: QProcess *m_signsisProcess; QString m_makesisTool; QString m_packageFile; + QString m_qtBinPath; bool m_releaseDeviceAfterLauncherFinish; bool m_handleDeviceRemoval; QFutureInterface<void> *m_deployProgress;