WinRT: Remove Qmake dependency

Change-Id: I3f358b9911ffdd096f7f50d3540a3620e3c3b5f5
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
hjk
2018-05-04 09:36:41 +02:00
parent 43bdabff67
commit 6d3275212b
4 changed files with 21 additions and 85 deletions

View File

@@ -3,5 +3,4 @@ QTC_PLUGIN_DEPENDS += \
coreplugin \
debugger \
projectexplorer \
qmakeprojectmanager \
qtsupport

View File

@@ -31,13 +31,9 @@
#include <projectexplorer/target.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/runconfigurationaspects.h>
#include <projectexplorer/runnables.h>
#include <utils/detailswidget.h>
#include <qmakeprojectmanager/qmakeproject.h>
#include <qmakeprojectmanager/qmakeprojectmanagerconstants.h>
#include <QFormLayout>
using namespace ProjectExplorer;
@@ -46,17 +42,15 @@ using namespace Utils;
namespace WinRt {
namespace Internal {
class UninstallAfterStopAspect : public BaseBoolAspect
{
Q_OBJECT
public:
UninstallAfterStopAspect(RunConfiguration *rc)
: BaseBoolAspect(rc, "WinRtRunConfigurationUninstallAfterStopId")
{
setLabel(WinRtRunConfiguration::tr("Uninstall package after application stops"));
}
};
// UninstallAfterStopAspect
UninstallAfterStopAspect::UninstallAfterStopAspect(RunConfiguration *rc)
: BaseBoolAspect(rc, "WinRtRunConfigurationUninstallAfterStopId")
{
setLabel(WinRtRunConfiguration::tr("Uninstall package after application stops"));
}
// WinRtRunConfiguration
WinRtRunConfiguration::WinRtRunConfiguration(Target *target, Core::Id id)
: RunConfiguration(target, id)
@@ -82,67 +76,11 @@ QWidget *WinRtRunConfiguration::createConfigurationWidget()
return detailsWidget;
}
bool WinRtRunConfiguration::uninstallAfterStop() const
{
return extraAspect<UninstallAfterStopAspect>()->value();
}
QString WinRtRunConfiguration::proFilePath() const
{
return buildKey();
}
QString WinRtRunConfiguration::arguments() const
{
return extraAspect<ProjectExplorer::ArgumentsAspect>()->arguments();
}
ProjectExplorer::Runnable WinRtRunConfiguration::runnable() const
{
ProjectExplorer::StandardRunnable r;
r.executable = executable();
r.commandLineArguments = arguments();
return r;
}
QString WinRtRunConfiguration::executable() const
{
QmakeProjectManager::QmakeProject *project
= static_cast<QmakeProjectManager::QmakeProject *>(target()->project());
if (!project)
return QString();
QmakeProjectManager::QmakeProFile *rootProFile = project->rootProFile();
if (!rootProFile)
return QString();
const QmakeProjectManager::QmakeProFile *pro
= rootProFile->findProFile(Utils::FileName::fromString(proFilePath()));
if (!pro)
return QString();
QmakeProjectManager::TargetInformation ti = pro->targetInformation();
if (!ti.valid)
return QString();
QString destDir = ti.destDir.toString();
if (destDir.isEmpty())
destDir = ti.buildDir.toString();
else if (QDir::isRelativePath(destDir))
destDir = QDir::cleanPath(ti.buildDir.toString() + '/' + destDir);
QString executable = QDir::cleanPath(destDir + '/' + ti.target);
executable = Utils::HostOsInfo::withExecutableSuffix(executable);
return executable;
}
// WinRtRunConfigurationFactory
WinRtRunConfigurationFactory::WinRtRunConfigurationFactory()
{
registerRunConfiguration<WinRtRunConfiguration>("WinRt.WinRtRunConfiguration:");
addSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID);
addSupportedTargetDeviceType(Constants::WINRT_DEVICE_TYPE_LOCAL);
addSupportedTargetDeviceType(Constants::WINRT_DEVICE_TYPE_PHONE);
addSupportedTargetDeviceType(Constants::WINRT_DEVICE_TYPE_EMULATOR);
@@ -150,5 +88,3 @@ WinRtRunConfigurationFactory::WinRtRunConfigurationFactory()
} // namespace Internal
} // namespace WinRt
#include "winrtrunconfiguration.moc"

View File

@@ -30,6 +30,14 @@
namespace WinRt {
namespace Internal {
class UninstallAfterStopAspect : public ProjectExplorer::BaseBoolAspect
{
Q_OBJECT
public:
UninstallAfterStopAspect(ProjectExplorer::RunConfiguration *rc);
};
class WinRtRunConfiguration : public ProjectExplorer::RunConfiguration
{
Q_OBJECT
@@ -38,15 +46,6 @@ public:
WinRtRunConfiguration(ProjectExplorer::Target *target, Core::Id id);
QWidget *createConfigurationWidget() override;
QString proFilePath() const;
QString arguments() const;
bool uninstallAfterStop() const;
ProjectExplorer::Runnable runnable() const override;
private:
QString executable() const;
};
class WinRtRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory

View File

@@ -50,7 +50,7 @@ WinRtRunnerHelper::WinRtRunnerHelper(ProjectExplorer::RunWorker *runWorker, QStr
: QObject(runWorker)
, m_worker(runWorker)
{
auto runConfiguration = qobject_cast<WinRtRunConfiguration *>(runWorker->runControl()->runConfiguration());
auto runConfiguration = runWorker->runControl()->runConfiguration();
ProjectExplorer::Target *target = runConfiguration->target();
m_device = runWorker->device().dynamicCast<const WinRtDevice>();
@@ -81,8 +81,10 @@ WinRtRunnerHelper::WinRtRunnerHelper(ProjectExplorer::RunWorker *runWorker, QStr
if (!m_executableFilePath.endsWith(QLatin1String(".exe")))
m_executableFilePath += QStringLiteral(".exe");
m_arguments = runConfiguration->arguments();
m_uninstallAfterStop = runConfiguration->uninstallAfterStop();
if (auto aspect = runConfiguration->extraAspect<ArgumentsAspect>())
m_arguments = aspect->arguments();
if (auto aspect = runConfiguration->extraAspect<UninstallAfterStopAspect>())
m_uninstallAfterStop = aspect->value();
if (ProjectExplorer::BuildConfiguration *bc = target->activeBuildConfiguration())
m_environment = bc->environment();