Commit d4a32cdb authored by Joerg Bornemann's avatar Joerg Bornemann
Browse files

WinRt: fix run control for SUBDIRS projects



Winrtrunner was called with the executable file path for the
top-level .pro file, which happens to be the empty string.
We now store (and use) the right .pro file path.

Change-Id: I7d71e6b99393e863f3ba0df2d2902f29d75a9583
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@digia.com>
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent d6e0df1c
......@@ -10,6 +10,7 @@ QtcPlugin {
Depends { name: "Debugger" }
Depends { name: "ProjectExplorer" }
Depends { name: "QtSupport" }
Depends { name: "QmakeProjectManager" }
Depends { name: "Qt.gui" }
files: [
......
......@@ -3,4 +3,5 @@ QTC_PLUGIN_DEPENDS += \
coreplugin \
debugger \
projectexplorer \
qmakeprojectmanager \
qtsupport
......@@ -33,6 +33,7 @@
namespace WinRt {
namespace Internal {
namespace Constants {
const char WINRT_DEVICE_TYPE_LOCAL[] = "WinRt.Device.Local";
const char WINRT_DEVICE_TYPE_EMULATOR[] = "WinRt.Device.Emulator";
const char WINRT_DEVICE_TYPE_PHONE[] = "WinRt.Device.Phone";
......@@ -43,7 +44,9 @@ const char WINRT_WINPHONEQT[] = "WinRt.QtVersion.WindowsPhone";
const char WINRT_QTMAP_SUBKEYNAME[] = "WinRt";
const char WINRT_QTMAP_OSFLAVOR[] = "OsFlavor";
const char WINRT_MANIFEST_EDITOR_ID[] = "WinRTManifestEditorID";
}
const char WINRT_RC_PREFIX[] = "WinRt.WinRtRunConfiguration:";
} // Constants
} // Internal
} // WinRt
......
......@@ -29,6 +29,7 @@
#include "winrtrunconfiguration.h"
#include "winrtrunconfigurationwidget.h"
#include "winrtconstants.h"
#include <coreplugin/icore.h>
#include <projectexplorer/target.h>
......@@ -40,8 +41,14 @@ namespace Internal {
static const char argumentsIdC[] = "WinRtRunConfigurationArgumentsId";
static const char uninstallAfterStopIdC[] = "WinRtRunConfigurationUninstallAfterStopId";
static QString pathFromId(Core::Id id)
{
return id.suffixAfter(Constants::WINRT_RC_PREFIX);
}
WinRtRunConfiguration::WinRtRunConfiguration(ProjectExplorer::Target *parent, Core::Id id)
: RunConfiguration(parent, id)
, m_proFilePath(pathFromId(id))
, m_uninstallAfterStop(false)
{
setDisplayName(tr("Run App Package"));
......
......@@ -47,6 +47,7 @@ public:
QVariantMap toMap() const;
bool fromMap(const QVariantMap &map);
const QString &proFilePath() const { return m_proFilePath; }
const QString &arguments() const { return m_arguments; }
bool uninstallAfterStop() const { return m_uninstallAfterStop; }
......@@ -59,6 +60,7 @@ public slots:
void setUninstallAfterStop(bool b);
private:
QString m_proFilePath;
QString m_arguments;
bool m_uninstallAfterStop;
};
......
......@@ -37,15 +37,16 @@
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
#include <qmakeprojectmanager/qmakeproject.h>
#include <utils/qtcassert.h>
using namespace ProjectExplorer;
using QmakeProjectManager::QmakeProject;
using QmakeProjectManager::QmakeProFileNode;
namespace WinRt {
namespace Internal {
static const char winrtConfigurationIdC[] = "WinRTConfigurationID";
static bool isKitCompatible(Kit *kit)
{
IDevice::ConstPtr device = DeviceKitInformation::device(kit);
......@@ -62,13 +63,17 @@ WinRtRunConfigurationFactory::WinRtRunConfigurationFactory()
{
}
QList<Core::Id> WinRtRunConfigurationFactory::availableCreationIds(Target *parent, CreationMode mode) const
QList<Core::Id> WinRtRunConfigurationFactory::availableCreationIds(Target *parent,
CreationMode mode) const
{
Q_UNUSED(mode)
QList<Core::Id> result;
if (isKitCompatible(parent->kit()))
result.append(Core::Id(winrtConfigurationIdC));
return result;
if (!canHandle(parent))
return QList<Core::Id>();
QmakeProject *project = static_cast<QmakeProject *>(parent->project());
QList<QmakeProFileNode *> nodes = project->applicationProFiles();
if (mode == AutoCreate)
nodes = QmakeProject::nodesWithQtcRunnable(nodes);
return QmakeProject::idsForNodes(Core::Id(Constants::WINRT_RC_PREFIX), nodes);
}
QString WinRtRunConfigurationFactory::displayNameForId(Core::Id id) const
......@@ -79,7 +84,8 @@ QString WinRtRunConfigurationFactory::displayNameForId(Core::Id id) const
bool WinRtRunConfigurationFactory::canCreate(Target *parent, Core::Id id) const
{
return id == winrtConfigurationIdC && isKitCompatible(parent->kit());
Q_UNUSED(id);
return canHandle(parent);
}
RunConfiguration *WinRtRunConfigurationFactory::doCreate(Target *parent, Core::Id id)
......@@ -89,12 +95,15 @@ RunConfiguration *WinRtRunConfigurationFactory::doCreate(Target *parent, Core::I
bool WinRtRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
{
return ProjectExplorer::idFromMap(map) == winrtConfigurationIdC && isKitCompatible(parent->kit());
if (!canHandle(parent))
return false;
return idFromMap(map).toString().startsWith(QLatin1String(Constants::WINRT_RC_PREFIX));
}
RunConfiguration *WinRtRunConfigurationFactory::doRestore(Target *parent, const QVariantMap &map)
{
RunConfiguration *config = new WinRtRunConfiguration(parent, winrtConfigurationIdC);
RunConfiguration *config = new WinRtRunConfiguration(parent, idFromMap(map));
config->fromMap(map);
return config;
}
......@@ -113,6 +122,15 @@ RunConfiguration *WinRtRunConfigurationFactory::clone(Target *parent, RunConfigu
return 0;
}
bool WinRtRunConfigurationFactory::canHandle(Target *parent) const
{
if (!isKitCompatible(parent->kit()))
return false;
if (!qobject_cast<QmakeProject *>(parent->project()))
return false;
return true;
}
WinRtRunControlFactory::WinRtRunControlFactory()
{
}
......
......@@ -52,6 +52,7 @@ public:
ProjectExplorer::RunConfiguration *product);
private:
bool canHandle(ProjectExplorer::Target *parent) const;
virtual ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, Core::Id id);
virtual ProjectExplorer::RunConfiguration *doRestore(ProjectExplorer::Target *parent, const QVariantMap &map);
};
......
......@@ -90,8 +90,7 @@ bool WinRtRunnerHelper::init(WinRtRunConfiguration *runConfiguration, QString *e
return false;
}
const Utils::FileName proFile = Utils::FileName::fromString(
target->project()->document()->filePath());
const QString &proFile = m_runConfiguration->proFilePath();
m_executableFilePath = target->applicationTargets().targetForProject(proFile).toString()
+ QStringLiteral(".exe"); // ### we should not need to append ".exe" here.
......
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