Commit 4b185ee2 authored by con's avatar con
Browse files

Remove package creation step from symbian run configurations.

parent 5a2c91ce
......@@ -64,8 +64,8 @@ class S60CreatePackageStep : public MakeStep {
friend class S60CreatePackageStepFactory;
public:
enum SigningMode {
SignSelf,
SignCustom
SignSelf = 0,
SignCustom = 1
};
explicit S60CreatePackageStep(ProjectExplorer::BuildConfiguration *bc);
......
......@@ -65,19 +65,14 @@ const char * const S60_DEVICE_RC_ID("Qt4ProjectManager.S60DeviceRunConfiguration
const char * const S60_DEVICE_RC_PREFIX("Qt4ProjectManager.S60DeviceRunConfiguration.");
const char * const PRO_FILE_KEY("Qt4ProjectManager.S60DeviceRunConfiguration.ProFile");
const char * const SIGNING_MODE_KEY("Qt4ProjectManager.S60DeviceRunConfiguration.SigningMode");
const char * const CUSTOM_SIGNATURE_PATH_KEY("Qt4ProjectManager.S60DeviceRunConfiguration.CustomSignaturePath");
const char * const CUSTOM_KEY_PATH_KEY("Qt4ProjectManager.S60DeviceRunConfiguration.CustomKeyPath");
const char * const SERIAL_PORT_NAME_KEY("Qt4ProjectManager.S60DeviceRunConfiguration.SerialPortName");
const char * const COMMUNICATION_TYPE_KEY("Qt4ProjectManager.S60DeviceRunConfiguration.CommunicationType");
const char * const COMMAND_LINE_ARGUMENTS_KEY("Qt4ProjectManager.S60DeviceRunConfiguration.CommandLineArguments");
const int PROGRESS_PACKAGECREATED = 100;
const int PROGRESS_PACKAGESIGNED = 200;
const int PROGRESS_DEPLOYBASE = 200;
const int PROGRESS_PACKAGEDEPLOYED = 300;
const int PROGRESS_PACKAGEINSTALLED = 400;
const int PROGRESS_MAX = 400;
const int PROGRESS_DEPLOYBASE = 0;
const int PROGRESS_PACKAGEDEPLOYED = 100;
const int PROGRESS_PACKAGEINSTALLED = 200;
const int PROGRESS_MAX = 200;
enum { debug = 0 };
......@@ -115,11 +110,10 @@ S60DeviceRunConfiguration::S60DeviceRunConfiguration(Target *parent, const QStri
RunConfiguration(parent, QLatin1String(S60_DEVICE_RC_ID)),
m_proFilePath(proFilePath),
#ifdef Q_OS_WIN
m_serialPortName(QLatin1String("COM5")),
m_serialPortName(QLatin1String("COM5"))
#else
m_serialPortName(QLatin1String(SymbianUtils::SymbianDeviceManager::linuxBlueToothDeviceRootC) + QLatin1Char('0')),
m_serialPortName(QLatin1String(SymbianUtils::SymbianDeviceManager::linuxBlueToothDeviceRootC) + QLatin1Char('0'))
#endif
m_signingMode(SignSelf)
{
ctor();
}
......@@ -127,10 +121,7 @@ S60DeviceRunConfiguration::S60DeviceRunConfiguration(Target *parent, const QStri
S60DeviceRunConfiguration::S60DeviceRunConfiguration(Target *target, S60DeviceRunConfiguration *source) :
RunConfiguration(target, source),
m_proFilePath(source->m_proFilePath),
m_serialPortName(source->m_serialPortName),
m_signingMode(source->m_signingMode),
m_customSignaturePath(source->m_customSignaturePath),
m_customKeyPath(source->m_customKeyPath)
m_serialPortName(source->m_serialPortName)
{
ctor();
}
......@@ -204,9 +195,6 @@ QVariantMap S60DeviceRunConfiguration::toMap() const
const QDir projectDir = QDir(target()->project()->projectDirectory());
map.insert(QLatin1String(PRO_FILE_KEY), projectDir.relativeFilePath(m_proFilePath));
map.insert(QLatin1String(SIGNING_MODE_KEY), (int)m_signingMode);
map.insert(QLatin1String(CUSTOM_SIGNATURE_PATH_KEY), m_customSignaturePath);
map.insert(QLatin1String(CUSTOM_KEY_PATH_KEY), m_customKeyPath);
map.insert(QLatin1String(SERIAL_PORT_NAME_KEY), m_serialPortName);
map.insert(QLatin1String(COMMAND_LINE_ARGUMENTS_KEY), m_commandLineArguments);
......@@ -218,9 +206,6 @@ bool S60DeviceRunConfiguration::fromMap(const QVariantMap &map)
const QDir projectDir = QDir(target()->project()->projectDirectory());
m_proFilePath = projectDir.filePath(map.value(QLatin1String(PRO_FILE_KEY)).toString());
m_signingMode = static_cast<SigningMode>(map.value(QLatin1String(SIGNING_MODE_KEY)).toInt());
m_customSignaturePath = map.value(QLatin1String(CUSTOM_SIGNATURE_PATH_KEY)).toString();
m_customKeyPath = map.value(QLatin1String(CUSTOM_KEY_PATH_KEY)).toString();
m_serialPortName = map.value(QLatin1String(SERIAL_PORT_NAME_KEY)).toString().trimmed();
m_commandLineArguments = map.value(QLatin1String(COMMAND_LINE_ARGUMENTS_KEY)).toStringList();
......@@ -303,36 +288,6 @@ QString S60DeviceRunConfiguration::packageTemplateFileName() const
return ti.workingDir + QLatin1Char('/') + ti.target + QLatin1String("_template.pkg");
}
S60DeviceRunConfiguration::SigningMode S60DeviceRunConfiguration::signingMode() const
{
return m_signingMode;
}
void S60DeviceRunConfiguration::setSigningMode(SigningMode mode)
{
m_signingMode = mode;
}
QString S60DeviceRunConfiguration::customSignaturePath() const
{
return m_customSignaturePath;
}
void S60DeviceRunConfiguration::setCustomSignaturePath(const QString &path)
{
m_customSignaturePath = path;
}
QString S60DeviceRunConfiguration::customKeyPath() const
{
return m_customKeyPath;
}
void S60DeviceRunConfiguration::setCustomKeyPath(const QString &path)
{
m_customKeyPath = path;
}
QString S60DeviceRunConfiguration::packageFileName() const
{
QString rc = basePackageFilePath();
......@@ -505,7 +460,6 @@ RunConfiguration *S60DeviceRunConfigurationFactory::clone(Target *parent, RunCon
S60DeviceRunControlBase::S60DeviceRunControlBase(RunConfiguration *runConfiguration) :
RunControl(runConfiguration),
m_toolChain(ProjectExplorer::ToolChain::INVALID),
m_makesisProcess(new QProcess(this)),
m_releaseDeviceAfterLauncherFinish(false),
m_handleDeviceRemoval(true),
m_launcher(0)
......@@ -513,15 +467,6 @@ S60DeviceRunControlBase::S60DeviceRunControlBase(RunConfiguration *runConfigurat
// connect for automatically reporting the "finished deploy" state to the progress manager
connect(this, SIGNAL(finished()), this, SLOT(reportDeployFinished()));
connect(m_makesisProcess, SIGNAL(readyReadStandardError()),
this, SLOT(readStandardError()));
connect(m_makesisProcess, SIGNAL(readyReadStandardOutput()),
this, SLOT(readStandardOutput()));
connect(m_makesisProcess, SIGNAL(error(QProcess::ProcessError)),
this, SLOT(makesisProcessFailed()));
connect(m_makesisProcess, SIGNAL(finished(int,QProcess::ExitStatus)),
this, SLOT(makesisProcessFinished()));
S60DeviceRunConfiguration *s60runConfig = qobject_cast<S60DeviceRunConfiguration *>(runConfiguration);
const Qt4BuildConfiguration *activeBuildConf = s60runConfig->qt4Target()->activeBuildConfiguration();
......@@ -535,22 +480,9 @@ S60DeviceRunControlBase::S60DeviceRunControlBase(RunConfiguration *runConfigurat
m_commandLineArguments = s60runConfig->commandLineArguments();
m_workingDirectory = QFileInfo(m_baseFileName).absolutePath();
m_qtDir = activeBuildConf->qtVersion()->versionInfo().value("QT_INSTALL_DATA");
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());
// 'sis' is a make target. Set up with correct environment
// Also add $QTDIR/bin, since it needs to find 'createpackage'.
ProjectExplorer::ToolChain *toolchain = activeBuildConf->toolChain();
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment();
toolchain->addToEnvironment(env);
env.prependOrSetPath(m_qtBinPath);
// Windows: Use the make.exe from epoc32\tools
m_makeTool = env.searchInPath(toolchain->makeCommand());
m_makesisProcess->setEnvironment(env.toStringList());
m_executableFileName = s60runConfig->localExecutableFileName();
m_packageFilePath = s60runConfig->packageFileName();
m_packageFile = QFileInfo(m_packageFilePath).fileName();
......@@ -572,27 +504,6 @@ void S60DeviceRunControlBase::setReleaseDeviceAfterLauncherFinish(bool v)
m_releaseDeviceAfterLauncherFinish = v;
}
QString S60DeviceRunControlBase::signSisKey() const
{
const QString key = m_useCustomSignature ? m_customKeyPath:
m_qtDir + QLatin1String("/src/s60installs/selfsigned.key");
return QDir::toNativeSeparators(key);
}
QString S60DeviceRunControlBase::signSisCertificate() const
{
const QString cert = m_useCustomSignature ? m_customSignaturePath :
m_qtDir + QLatin1String("/src/s60installs/selfsigned.cer");
return QDir::toNativeSeparators(cert);
}
// Format a message with command line
static inline QString msgRun(const QString &cmd, const QStringList &args)
{
const QChar blank = QLatin1Char(' ');
return QDir::toNativeSeparators(cmd) + blank + args.join(QString(blank));
}
static inline bool ensureDeleteFile(const QString &fileName, QString *errorMessage)
{
QFile file(fileName);
......@@ -603,6 +514,22 @@ static inline bool ensureDeleteFile(const QString &fileName, QString *errorMessa
return true;
}
static inline bool renameFile(const QString &sourceName, const QString &targetName,
QString *errorMessage)
{
if (sourceName == targetName)
return true;
if (!ensureDeleteFile(targetName, errorMessage))
return false;
QFile source(sourceName);
if (!source.rename(targetName)) {
*errorMessage = S60DeviceRunControlBase::tr("Unable to rename file '%1' to '%2': %3")
.arg(sourceName, targetName, source.errorString());
return false;
}
return true;
}
void S60DeviceRunControlBase::start()
{
m_deployProgress = new QFutureInterface<void>;
......@@ -614,18 +541,19 @@ void S60DeviceRunControlBase::start()
m_deployProgress->reportStarted();
emit started();
if (m_serialPortName.isEmpty()) {
m_deployProgress->reportCanceled();
error(this, tr("There is no device plugged in."));
emit finished();
return;
}
emit addToOutputWindow(this, tr("Creating %1 ...").arg(m_signedPackage));
emit addToOutputWindow(this, tr("Executable file: %1").arg(msgListFile(m_executableFileName)));
QString errorMessage;
QString settingsCategory;
QString settingsPage;
if (!checkConfiguration(&errorMessage, &settingsCategory, &settingsPage)) {
m_deployProgress->reportCanceled();
error(this, errorMessage);
emit finished();
Core::ICore::instance()->showWarningWithOptions(tr("Debugger for Symbian Platform"),
......@@ -635,94 +563,13 @@ void S60DeviceRunControlBase::start()
}
// Be sure to delete old files
if (!ensureDeleteFile(m_signedPackage, &errorMessage)) {
m_deployProgress->reportCanceled();
error(this, errorMessage);
emit finished();
}
QStringList makeSisArgs;
makeSisArgs << QLatin1String("sis")
<< (QLatin1String("QT_SIS_CERTIFICATE=") + signSisCertificate())
<< (QLatin1String("QT_SIS_KEY=") + signSisKey());
m_makesisProcess->setWorkingDirectory(m_workingDirectory);
emit addToOutputWindow(this, msgRun(m_makeTool, makeSisArgs));
if (debug)
qDebug() << m_makeTool << makeSisArgs << m_workingDirectory;
m_makesisProcess->start(m_makeTool, makeSisArgs, QIODevice::ReadOnly);
m_makesisProcess->closeWriteChannel();
}
static inline void stopProcess(QProcess *p)
{
const int timeOutMS = 200;
if (p->state() != QProcess::Running)
return;
p->terminate();
if (p->waitForFinished(timeOutMS))
return;
p->kill();
}
void S60DeviceRunControlBase::stop()
{
if (m_makesisProcess)
stopProcess(m_makesisProcess);
if (m_launcher)
m_launcher->terminate();
}
bool S60DeviceRunControlBase::isRunning() const
{
return m_makesisProcess->state() != QProcess::NotRunning;
}
void S60DeviceRunControlBase::readStandardError()
{
QProcess *process = static_cast<QProcess *>(sender());
QByteArray data = process->readAllStandardError();
emit addToOutputWindowInline(this, QString::fromLocal8Bit(data.constData(), data.length()));
}
void S60DeviceRunControlBase::readStandardOutput()
{
QProcess *process = static_cast<QProcess *>(sender());
QByteArray data = process->readAllStandardOutput();
emit addToOutputWindowInline(this, QString::fromLocal8Bit(data.constData(), data.length()));
}
void S60DeviceRunControlBase::makesisProcessFailed()
{
processFailed(m_makeTool, m_makesisProcess->error(), m_makesisProcess->errorString());
}
static inline bool renameFile(const QString &sourceName, const QString &targetName,
QString *errorMessage)
{
if (sourceName == targetName)
return true;
if (!ensureDeleteFile(targetName, errorMessage))
return false;
QFile source(sourceName);
if (!source.rename(targetName)) {
*errorMessage = S60DeviceRunControlBase::tr("Unable to rename file '%1' to '%2': %3")
.arg(sourceName, targetName, source.errorString());
return false;
}
return true;
}
void S60DeviceRunControlBase::makesisProcessFinished()
{
if (m_makesisProcess->exitCode() != 0) {
m_deployProgress->reportCanceled();
error(this, tr("An error occurred while creating the package."));
stop();
emit finished();
return;
}
m_deployProgress->setProgressValue(PROGRESS_PACKAGECREATED);
QString errorMessage;
bool ok = false;
// TODO reconsider
do {
// ABLD up to 4.6.1: Check on file 'targetname_armX_udeb.sis'.
if (QFileInfo(m_signedPackage).isFile()) {
......@@ -745,6 +592,29 @@ void S60DeviceRunControlBase::makesisProcessFinished()
}
}
static inline void stopProcess(QProcess *p)
{
const int timeOutMS = 200;
if (p->state() != QProcess::Running)
return;
p->terminate();
if (p->waitForFinished(timeOutMS))
return;
p->kill();
}
void S60DeviceRunControlBase::stop()
{
if (m_launcher)
m_launcher->terminate();
}
bool S60DeviceRunControlBase::isRunning() const
{
//TODO !!!
return false;
}
void S60DeviceRunControlBase::startDeployment()
{
QString errorMessage;
......@@ -911,26 +781,6 @@ void S60DeviceRunControlBase::slotWaitingForTrkClosed()
}
}
void S60DeviceRunControlBase::processFailed(const QString &program,
QProcess::ProcessError errorCode,
const QString &msg)
{
QString errorString;
switch (errorCode) {
case QProcess::FailedToStart:
errorString = tr("Failed to start %1: %2").arg(program, msg);
break;
case QProcess::Crashed:
errorString = tr("%1 has unexpectedly finished: %2").arg(program, msg);
break;
default:
errorString = tr("An error has occurred while running %1: %2").arg(program, msg);
}
error(this, errorString);
stop();
emit finished();
}
void S60DeviceRunControlBase::printApplicationOutput(const QString &output)
{
emit addToOutputWindowInline(this, output);
......
......@@ -65,11 +65,6 @@ class S60DeviceRunConfiguration : public ProjectExplorer::RunConfiguration
friend class S60DeviceRunConfigurationFactory;
public:
enum SigningMode {
SignSelf,
SignCustom
};
S60DeviceRunConfiguration(ProjectExplorer::Target *parent, const QString &proFilePath);
virtual ~S60DeviceRunConfiguration();
......@@ -87,12 +82,6 @@ public:
QString symbianTarget() const;
bool isDebug() const;
QString packageTemplateFileName() const;
SigningMode signingMode() const;
void setSigningMode(SigningMode mode);
QString customSignaturePath() const;
void setCustomSignaturePath(const QString &path);
QString customKeyPath() const;
void setCustomKeyPath(const QString &path);
QString packageFileName() const;
QString localExecutableFileName() const;
......@@ -123,9 +112,6 @@ private:
QString m_proFilePath;
QString m_serialPortName;
SigningMode m_signingMode;
QString m_customSignaturePath;
QString m_customKeyPath;
QStringList m_commandLineArguments;
};
......@@ -170,9 +156,6 @@ public:
protected:
virtual void initLauncher(const QString &executable, trk::Launcher *) = 0;
virtual void handleLauncherFinished() = 0;
void processFailed(const QString &program, QProcess::ProcessError errorCode,
const QString &msg);
virtual bool checkConfiguration(QString *errorMessage,
QString *settingsCategory,
QString *settingsPage) const;
......@@ -184,10 +167,6 @@ protected slots:
private slots:
void processStopped(uint pc, uint pid, uint tid, const QString& reason);
void readStandardError();
void readStandardOutput();
void makesisProcessFailed();
void makesisProcessFinished();
void printConnectFailed(const QString &errorMessage);
void printCopyingNotice();
void printCreateFileFailed(const QString &filename, const QString &errorMessage);
......@@ -204,8 +183,6 @@ private slots:
private:
void startDeployment();
QString signSisKey() const;
QString signSisCertificate() const;
ProjectExplorer::ToolChain::ToolChainType m_toolChain;
QString m_serialPortName;
......@@ -218,11 +195,6 @@ private:
QString m_executableFileName;
QString m_qtDir;
QString m_signedPackage;
bool m_useCustomSignature;
QString m_customSignaturePath;
QString m_customKeyPath;
QProcess *m_makesisProcess;
QString m_makeTool;
QString m_packageFile;
QString m_qtBinPath;
bool m_releaseDeviceAfterLauncherFinish;
......
......@@ -121,58 +121,12 @@ S60DeviceRunConfigurationWidget::S60DeviceRunConfigurationWidget(
connect(m_deviceInfoButton, SIGNAL(clicked()), this, SLOT(updateDeviceInfo()));
formLayout->addRow(m_deviceInfoDescriptionLabel, infoHBoxLayout);
// Signature/certificate stuff.
QWidget *signatureWidget = new QWidget();
QVBoxLayout *layout = new QVBoxLayout();
signatureWidget->setLayout(layout);
detailsBoxLayout->addWidget(signatureWidget);
QRadioButton *selfSign = new QRadioButton(tr("Self-signed certificate"));
QHBoxLayout *customHBox = new QHBoxLayout();
customHBox->setMargin(0);
QVBoxLayout *radioLayout = new QVBoxLayout();
QRadioButton *customSignature = new QRadioButton();
radioLayout->addWidget(customSignature);
radioLayout->addStretch(10);
customHBox->addLayout(radioLayout);
QFormLayout *customLayout = new QFormLayout();
customLayout->setMargin(0);
customLayout->setLabelAlignment(Qt::AlignRight);
Utils::PathChooser *signaturePath = new Utils::PathChooser();
signaturePath->setExpectedKind(Utils::PathChooser::File);
signaturePath->setPromptDialogTitle(tr("Choose certificate file (.cer)"));
customLayout->addRow(new QLabel(tr("Custom certificate:")), signaturePath);
Utils::PathChooser *keyPath = new Utils::PathChooser();
keyPath->setExpectedKind(Utils::PathChooser::File);
keyPath->setPromptDialogTitle(tr("Choose key file (.key / .pem)"));
customLayout->addRow(new QLabel(tr("Key file:")), keyPath);
customHBox->addLayout(customLayout);
customHBox->addStretch(10);
layout->addWidget(selfSign);
layout->addLayout(customHBox);
layout->addStretch(10);
switch (m_runConfiguration->signingMode()) {
case S60DeviceRunConfiguration::SignSelf:
selfSign->setChecked(true);
break;
case S60DeviceRunConfiguration::SignCustom:
customSignature->setChecked(true);
break;
}
signaturePath->setPath(m_runConfiguration->customSignaturePath());
keyPath->setPath(m_runConfiguration->customKeyPath());
connect(m_nameLineEdit, SIGNAL(textEdited(QString)),
this, SLOT(displayNameEdited(QString)));
connect(m_argumentsLineEdit, SIGNAL(textEdited(QString)),
this, SLOT(argumentsEdited(QString)));
connect(m_runConfiguration, SIGNAL(targetInformationChanged()),
this, SLOT(updateTargetInformation()));
connect(selfSign, SIGNAL(toggled(bool)), this, SLOT(selfSignToggled(bool)));
connect(customSignature, SIGNAL(toggled(bool)), this, SLOT(customSignatureToggled(bool)));
connect(signaturePath, SIGNAL(changed(QString)), this, SLOT(signaturePathChanged(QString)));
connect(keyPath, SIGNAL(changed(QString)), this, SLOT(keyPathChanged(QString)));
}
void S60DeviceRunConfigurationWidget::updateSerialDevices()
......@@ -247,28 +201,6 @@ void S60DeviceRunConfigurationWidget::setSerialPort(int index)
clearDeviceInfo();
}
void S60DeviceRunConfigurationWidget::selfSignToggled(bool toggle)
{
if (toggle)
m_runConfiguration->setSigningMode(S60DeviceRunConfiguration::SignSelf);
}
void S60DeviceRunConfigurationWidget::customSignatureToggled(bool toggle)
{
if (toggle)
m_runConfiguration->setSigningMode(S60DeviceRunConfiguration::SignCustom);
}
void S60DeviceRunConfigurationWidget::signaturePathChanged(const QString &path)
{
m_runConfiguration->setCustomSignaturePath(path);
}
void S60DeviceRunConfigurationWidget::keyPathChanged(const QString &path)
{
m_runConfiguration->setCustomKeyPath(path);
}
void S60DeviceRunConfigurationWidget::clearDeviceInfo()
{
// Restore text & color
......
......@@ -74,10 +74,6 @@ private slots:
void updateTargetInformation();
void updateSerialDevices();
void setSerialPort(int index);
void selfSignToggled(bool toggle);
void customSignatureToggled(bool toggle);
void signaturePathChanged(const QString &path);
void keyPathChanged(const QString &path);
void updateDeviceInfo();
void clearDeviceInfo();
void slotLauncherStateChanged(int);
......
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