Commit aababf0c authored by Christian Kandeler's avatar Christian Kandeler

Maemo: Make more generic.

We can now deploy and remotely run/debug any Linux target.
parent d135e33a
......@@ -42,6 +42,7 @@
#include <debugger/debuggerrunner.h>
#include <debugger/debuggerengine.h>
#include <projectexplorer/abi.h>
#include <projectexplorer/toolchain.h>
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
......@@ -96,10 +97,13 @@ RunControl *MaemoDebugSupport::createDebugRunControl(MaemoRunConfiguration *runC
params.remoteChannel
= devConf->sshParameters().host + QLatin1String(":-1");
params.useServerStartScript = true;
const AbstractQt4MaemoTarget::DebugArchitecture &debugArch
= runConfig->maemoTarget()->debugArchitecture();
params.remoteArchitecture = debugArch.architecture;
params.gnuTarget = debugArch.gnuTarget;
// TODO: This functionality should be inside the debugger.
const ProjectExplorer::Abi &abi = runConfig->target()
->activeBuildConfiguration()->toolChain()->targetAbi();
params.remoteArchitecture = abi.toString();
params.gnuTarget = QLatin1String(abi.architecture() == ProjectExplorer::Abi::ArmArchitecture
? "arm-none-linux-gnueabi": "i386-unknown-linux-gnu");
}
} else {
params.startMode = AttachToRemote;
......
......@@ -33,7 +33,6 @@
#include "maemodeployablelistmodel.h"
#include "maemoglobal.h"
#include "qt4maemotarget.h"
#include <coreplugin/icore.h>
#include <coreplugin/filemanager.h>
......@@ -331,8 +330,8 @@ const BaseQtVersion *MaemoDeployableListModel::qtVersion() const
const ProjectExplorer::Project *const activeProject
= ProjectExplorer::ProjectExplorerPlugin::instance()->session()->startupProject();
QTC_ASSERT(activeProject, return 0);
const AbstractQt4MaemoTarget *const activeTarget
= qobject_cast<AbstractQt4MaemoTarget *>(activeProject->activeTarget());
const Qt4BaseTarget *const activeTarget
= qobject_cast<Qt4BaseTarget *>(activeProject->activeTarget());
QTC_ASSERT(activeTarget, return 0);
const Qt4BuildConfiguration *const bc
= activeTarget->activeBuildConfiguration();
......
......@@ -63,13 +63,14 @@ MaemoDeployStepFactory::MaemoDeployStepFactory(QObject *parent)
QStringList MaemoDeployStepFactory::availableCreationIds(BuildStepList *parent) const
{
if (!qobject_cast<Qt4MaemoDeployConfiguration *>(parent->parent()))
return QStringList();
QStringList ids;
if (qobject_cast<AbstractQt4MaemoTarget *>(parent->target()))
AbstractQt4MaemoTarget * const maemoTarget
= qobject_cast<AbstractQt4MaemoTarget *>(parent->target());
if (maemoTarget)
ids << MaemoMakeInstallToSysrootStep::Id;
if (!qobject_cast<Qt4HarmattanTarget *>(parent->target()))
else if (MaemoGlobal::hasLinuxQt(parent->target()))
ids << MaemoUploadAndInstallTarPackageStep::Id;
if (maemoTarget && !qobject_cast<Qt4HarmattanTarget *>(parent->target()))
ids << MaemoUploadAndInstallTarPackageStep::Id;
if (qobject_cast<AbstractDebBasedQt4MaemoTarget *>(parent->target())) {
ids << MaemoInstallDebianPackageToSysrootStep::Id;
......
......@@ -40,6 +40,7 @@
#include <utils/ssh/sshconnection.h>
#include <qt4projectmanager/qt4projectmanagerconstants.h>
#include <qt4projectmanager/qtversionmanager.h>
#include <qt4projectmanager/qt4target.h>
#include <utils/environment.h>
#include <QtCore/QDateTime>
......@@ -91,6 +92,29 @@ bool MaemoGlobal::isValidMeegoQtVersion(const QString &qmakePath)
return isValidMaemoQtVersion(qmakePath, MaemoDeviceConfig::Meego);
}
bool MaemoGlobal::isLinuxQt(const BaseQtVersion *qtVersion)
{
if (!qtVersion)
return false;
const QList<ProjectExplorer::Abi> &abis = qtVersion->qtAbis();
foreach (const ProjectExplorer::Abi &abi, abis) {
if (abi.os() == ProjectExplorer::Abi::LinuxOS)
return true;
}
return false;
}
bool MaemoGlobal::hasLinuxQt(const ProjectExplorer::Target *target)
{
const Qt4BaseTarget * const qtTarget
= qobject_cast<const Qt4BaseTarget *>(target);
if (!qtTarget)
return false;
const Qt4BuildConfiguration * const bc
= qtTarget->activeBuildConfiguration();
return bc && isLinuxQt(bc->qtVersion());
}
bool MaemoGlobal::isValidMaemoQtVersion(const QString &qmakePath,
MaemoDeviceConfig::OsVersion maemoVersion)
{
......@@ -143,7 +167,7 @@ QString MaemoGlobal::remoteSudo(MaemoDeviceConfig::OsVersion osVersion,
case MaemoDeviceConfig::Meego:
return devrootshPath();
default:
return QLatin1String("sudo");
return QString(); // Using sudo would open a can of worms.
}
}
......@@ -254,7 +278,7 @@ MaemoDeviceConfig::OsVersion MaemoGlobal::version(const QString &qmakePath)
return MaemoDeviceConfig::Maemo6;
if (name.startsWith(QLatin1String("meego")))
return MaemoDeviceConfig::Meego;
return static_cast<MaemoDeviceConfig::OsVersion>(-1);
return MaemoDeviceConfig::GenericLinux;
}
QString MaemoGlobal::architecture(const QString &qmakePath)
......
......@@ -73,6 +73,9 @@ public:
static bool isValidHarmattanQtVersion(const QString &qmakePath);
static bool isValidMeegoQtVersion(const QString &qmakePath);
static bool isLinuxQt(const BaseQtVersion *qtVersion);
static bool hasLinuxQt(const ProjectExplorer::Target *target);
static QString homeDirOnDevice(const QString &uname);
static QString devrootshPath();
static int applicationIconSize(MaemoDeviceConfig::OsVersion osVersion);
......
......@@ -61,10 +61,9 @@ MaemoPackageCreationFactory::MaemoPackageCreationFactory(QObject *parent)
QStringList MaemoPackageCreationFactory::availableCreationIds(ProjectExplorer::BuildStepList *parent) const
{
if (!qobject_cast<Qt4MaemoDeployConfiguration *>(parent->parent()))
return QStringList();
QStringList ids;
if (!MaemoGlobal::hasLinuxQt(parent->target()))
return ids;
if (qobject_cast<AbstractDebBasedQt4MaemoTarget *>(parent->target())
&& !parent->contains(MaemoDebianPackageCreationStep::CreatePackageId)) {
ids << MaemoDebianPackageCreationStep::CreatePackageId;
......
......@@ -76,9 +76,10 @@ void MaemoRemoteMounter::setBuildConfiguration(const Qt4BuildConfiguration *bc)
{
ASSERT_STATE(Inactive);
const BaseQtVersion * const qtVersion = bc->qtVersion();
m_remoteMountsAllowed
= qobject_cast<AbstractQt4MaemoTarget *>(bc->target())->allowsRemoteMounts();
m_maddeRoot = qtVersion ? MaemoGlobal::maddeRoot(qtVersion->qmakeCommand()) : "";
const AbstractQt4MaemoTarget * const maemoTarget
= qobject_cast<AbstractQt4MaemoTarget *>(bc->target());
m_remoteMountsAllowed = maemoTarget && maemoTarget->allowsRemoteMounts();
m_maddeRoot = qtVersion ? MaemoGlobal::maddeRoot(qtVersion->qmakeCommand()) : QString();
}
void MaemoRemoteMounter::addMountSpecification(const MaemoMountSpecification &mountSpec,
......
......@@ -52,6 +52,7 @@
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qt4projectmanager/qt4project.h>
#include <qt4projectmanager/qt4target.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
......@@ -105,7 +106,7 @@ void MaemoRunConfiguration::init()
this, SLOT(handleDeployConfigChanged()));
handleDeployConfigChanged();
Qt4Project *pro = maemoTarget()->qt4Project();
Qt4Project *pro = qt4Target()->qt4Project();
connect(pro, SIGNAL(proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode*,bool)),
this, SLOT(proFileUpdate(Qt4ProjectManager::Internal::Qt4ProFileNode*,bool)));
connect(pro, SIGNAL(proFileInvalidated(Qt4ProjectManager::Internal::Qt4ProFileNode *)),
......@@ -116,9 +117,9 @@ MaemoRunConfiguration::~MaemoRunConfiguration()
{
}
AbstractQt4MaemoTarget *MaemoRunConfiguration::maemoTarget() const
Qt4BaseTarget *MaemoRunConfiguration::qt4Target() const
{
return static_cast<AbstractQt4MaemoTarget *>(target());
return static_cast<Qt4BaseTarget *>(target());
}
Qt4BuildConfiguration *MaemoRunConfiguration::activeQt4BuildConfiguration() const
......@@ -140,7 +141,7 @@ QWidget *MaemoRunConfiguration::createConfigurationWidget()
Utils::OutputFormatter *MaemoRunConfiguration::createOutputFormatter() const
{
return new QtOutputFormatter(maemoTarget()->qt4Project());
return new QtOutputFormatter(qt4Target()->qt4Project());
}
void MaemoRunConfiguration::handleParseState(bool success)
......@@ -197,7 +198,7 @@ bool MaemoRunConfiguration::fromMap(const QVariantMap &map)
SystemEnvironmentBase).toInt());
m_remoteMounts->fromMap(map);
m_validParse = maemoTarget()->qt4Project()->validParse(m_proFilePath);
m_validParse = qt4Target()->qt4Project()->validParse(m_proFilePath);
setDefaultDisplayName(defaultDisplayName());
......@@ -207,9 +208,9 @@ bool MaemoRunConfiguration::fromMap(const QVariantMap &map)
QString MaemoRunConfiguration::defaultDisplayName()
{
if (!m_proFilePath.isEmpty())
return (QFileInfo(m_proFilePath).completeBaseName());
return (QFileInfo(m_proFilePath).completeBaseName()) + QLatin1String(" (remote)");
//: Maemo run configuration default display name
return tr("Run on Maemo device");
return tr("Run on remote device");
}
MaemoDeviceConfig::ConstPtr MaemoRunConfiguration::deviceConfig() const
......@@ -275,7 +276,7 @@ QString MaemoRunConfiguration::remoteProjectSourcesMountPoint() const
QString MaemoRunConfiguration::localExecutableFilePath() const
{
TargetInformation ti = maemoTarget()->qt4Project()->rootProjectNode()
TargetInformation ti = qt4Target()->qt4Project()->rootProjectNode()
->targetInformation(m_proFilePath);
if (!ti.valid)
return QString();
......@@ -299,7 +300,11 @@ MaemoPortList MaemoRunConfiguration::freePorts() const
bool MaemoRunConfiguration::useRemoteGdb() const
{
return m_useRemoteGdb && maemoTarget()->allowsRemoteMounts();
if (!m_useRemoteGdb)
return false;
const AbstractQt4MaemoTarget * const maemoTarget
= qobject_cast<AbstractQt4MaemoTarget *>(target());
return maemoTarget && maemoTarget->allowsRemoteMounts();
}
void MaemoRunConfiguration::setArguments(const QString &args)
......@@ -309,7 +314,9 @@ void MaemoRunConfiguration::setArguments(const QString &args)
MaemoRunConfiguration::DebuggingType MaemoRunConfiguration::debuggingType() const
{
if (!maemoTarget()->allowsQmlDebugging())
const AbstractQt4MaemoTarget * const maemoTarget
= qobject_cast<AbstractQt4MaemoTarget *>(target());
if (!maemoTarget || !maemoTarget->allowsQmlDebugging())
return DebugCppOnly;
if (useCppDebugger()) {
if (useQmlDebugger())
......
......@@ -56,7 +56,6 @@ namespace Internal {
class Qt4ProFileNode;
class AbstractQt4MaemoTarget;
class AbstractLinuxDeviceDeployStep;
class MaemoDeviceConfigListModel;
class MaemoManager;
......@@ -85,7 +84,7 @@ public:
bool isEnabled(ProjectExplorer::BuildConfiguration *config) const;
QWidget *createConfigurationWidget();
Utils::OutputFormatter *createOutputFormatter() const;
AbstractQt4MaemoTarget *maemoTarget() const;
Qt4BaseTarget *qt4Target() const;
Qt4BuildConfiguration *activeQt4BuildConfiguration() const;
Qt4MaemoDeployConfiguration *deployConfig() const;
......
......@@ -96,11 +96,13 @@ MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
this, SLOT(runConfigurationEnabledChange(bool)));
const AbstractQt4MaemoTarget * const maemoTarget
= runConfiguration->maemoTarget();
const bool remoteMountsAvailable = maemoTarget->allowsRemoteMounts();
= qobject_cast<AbstractQt4MaemoTarget *>(runConfiguration->target());
const bool remoteMountsAvailable
= maemoTarget && maemoTarget->allowsRemoteMounts();
m_debugDetailsContainer->setVisible(remoteMountsAvailable);
m_mountDetailsContainer->setVisible(remoteMountsAvailable);
const bool qmlDebuggingAvailable = maemoTarget->allowsQmlDebugging();
const bool qmlDebuggingAvailable
= !maemoTarget || maemoTarget->allowsQmlDebugging();
m_debuggingLanguagesLabel->setVisible(qmlDebuggingAvailable);
m_debugCppOnlyButton->setVisible(qmlDebuggingAvailable);
m_debugQmlOnlyButton->setVisible(qmlDebuggingAvailable);
......
......@@ -75,16 +75,16 @@ MaemoRunConfigurationFactory::~MaemoRunConfigurationFactory()
bool MaemoRunConfigurationFactory::canCreate(Target *parent,
const QString &id) const
{
AbstractQt4MaemoTarget *target = qobject_cast<AbstractQt4MaemoTarget *>(parent);
if (!target)
if (!MaemoGlobal::hasLinuxQt(parent))
return false;
return target->qt4Project()->hasApplicationProFile(pathFromId(id));
return qobject_cast<Qt4BaseTarget *>(parent)->qt4Project()
->hasApplicationProFile(pathFromId(id));
}
bool MaemoRunConfigurationFactory::canRestore(Target *parent,
const QVariantMap &map) const
{
if (!qobject_cast<AbstractQt4MaemoTarget *>(parent))
if (!MaemoGlobal::hasLinuxQt(parent))
return false;
return ProjectExplorer::idFromMap(map)
.startsWith(QLatin1String(MAEMO_RC_ID));
......@@ -98,8 +98,8 @@ bool MaemoRunConfigurationFactory::canClone(Target *parent,
QStringList MaemoRunConfigurationFactory::availableCreationIds(Target *parent) const
{
if (AbstractQt4MaemoTarget *t = qobject_cast<AbstractQt4MaemoTarget *>(parent)) {
if (t) {
if (Qt4BaseTarget *t = qobject_cast<Qt4BaseTarget *>(parent)) {
if (t && MaemoGlobal::hasLinuxQt(t)) {
return t->qt4Project()->
applicationProFilePathes(QLatin1String(MAEMO_RC_ID_PREFIX));
}
......@@ -109,7 +109,8 @@ QStringList MaemoRunConfigurationFactory::availableCreationIds(Target *parent) c
QString MaemoRunConfigurationFactory::displayNameForId(const QString &id) const
{
return QFileInfo(pathFromId(id)).completeBaseName();
return QFileInfo(pathFromId(id)).completeBaseName()
+ QLatin1String(" (remote)");
}
RunConfiguration *MaemoRunConfigurationFactory::create(Target *parent,
......@@ -117,9 +118,8 @@ RunConfiguration *MaemoRunConfigurationFactory::create(Target *parent,
{
if (!canCreate(parent, id))
return 0;
AbstractQt4MaemoTarget *pqt4parent = static_cast<AbstractQt4MaemoTarget *>(parent);
return new MaemoRunConfiguration(pqt4parent, pathFromId(id));
return new MaemoRunConfiguration(qobject_cast<Qt4BaseTarget *>(parent),
pathFromId(id));
}
RunConfiguration *MaemoRunConfigurationFactory::restore(Target *parent,
......@@ -127,8 +127,8 @@ RunConfiguration *MaemoRunConfigurationFactory::restore(Target *parent,
{
if (!canRestore(parent, map))
return 0;
AbstractQt4MaemoTarget *target = static_cast<AbstractQt4MaemoTarget *>(parent);
MaemoRunConfiguration *rc = new MaemoRunConfiguration(target, QString());
MaemoRunConfiguration *rc
= new MaemoRunConfiguration(qobject_cast<Qt4BaseTarget *>(parent), QString());
if (rc->fromMap(map))
return rc;
......@@ -143,7 +143,7 @@ RunConfiguration *MaemoRunConfigurationFactory::clone(Target *parent,
return 0;
MaemoRunConfiguration *old = static_cast<MaemoRunConfiguration *>(source);
return new MaemoRunConfiguration(static_cast<AbstractQt4MaemoTarget *>(parent), old);
return new MaemoRunConfiguration(static_cast<Qt4BaseTarget *>(parent), old);
}
// #pragma mark -- MaemoRunControlFactory
......@@ -169,8 +169,10 @@ bool MaemoRunControlFactory::canRun(RunConfiguration *runConfiguration,
return false;
const int freePortCount = maemoRunConfig->freePorts().count();
const AbstractQt4MaemoTarget * const maemoTarget
= qobject_cast<AbstractQt4MaemoTarget *>(maemoRunConfig->target());
const bool remoteMountsAllowed
= maemoRunConfig->maemoTarget()->allowsRemoteMounts();
= maemoTarget && maemoTarget->allowsRemoteMounts();
if (remoteMountsAllowed && freePortCount == 0)
return false;
const int mountDirCount
......
......@@ -118,9 +118,9 @@ QStringList Qt4MaemoDeployConfigurationFactory::availableCreationIds(Target *par
ids << Qt4MaemoDeployConfiguration::HarmattanId;
} else if (qobject_cast<Qt4MeegoTarget *>(parent)) {
ids << Qt4MaemoDeployConfiguration::MeegoId;
} /*else if (qobject_cast<Qt4BaseTarget *>(parent)) { // TODO: Check for Linux
} else if (MaemoGlobal::hasLinuxQt(parent)) {
ids << Qt4MaemoDeployConfiguration::GenericLinuxId;
}*/
}
return ids;
}
......
......@@ -129,19 +129,6 @@ AbstractQt4MaemoTarget::AbstractQt4MaemoTarget(Qt4Project *parent, const QString
AbstractQt4MaemoTarget::~AbstractQt4MaemoTarget()
{ }
AbstractQt4MaemoTarget::DebugArchitecture AbstractQt4MaemoTarget::debugArchitecture() const
{
// TODO: This functionality should be inside the debugger.
const ProjectExplorer::Abi &abi
= activeBuildConfiguration()->toolChain()->targetAbi();
DebugArchitecture arch(abi.toString());
// TODO: This might do the wrong thing for x64.
arch.gnuTarget = QLatin1String(abi.architecture() == ProjectExplorer::Abi::ArmArchitecture
? "arm-none-linux-gnueabi": "i386-unknown-linux-gnu");
return arch;
}
QList<ProjectExplorer::ToolChain *> AbstractQt4MaemoTarget::possibleToolChains(ProjectExplorer::BuildConfiguration *bc) const
{
QList<ProjectExplorer::ToolChain *> result;
......
......@@ -60,6 +60,7 @@ public:
Qt4BuildConfigurationFactory *buildConfigurationFactory() const;
void createApplicationProFiles();
QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Node *n);
QList<ProjectExplorer::ToolChain *> possibleToolChains(ProjectExplorer::BuildConfiguration *bc) const;
virtual bool allowsRemoteMounts() const=0;
virtual bool allowsPackagingDisabling() const=0;
......@@ -74,19 +75,6 @@ public:
bool setPackageName(const QString &packageName);
bool setShortDescription(const QString &description);
struct DebugArchitecture {
explicit DebugArchitecture(const QString &a = QString(), const QString &t = QString()) :
architecture(a), gnuTarget(t)
{ }
QString architecture;
QString gnuTarget;
};
// TODO: Is this needed with the ABI info we have?
DebugArchitecture debugArchitecture() const;
QList<ProjectExplorer::ToolChain *> possibleToolChains(ProjectExplorer::BuildConfiguration *bc) const;
protected:
enum ActionStatus { NoActionRequired, ActionSuccessful, ActionFailed };
......
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