Commit 724d2fc4 authored by Andrew Knight's avatar Andrew Knight
Browse files

Fix winrtrunner device detection and deployment for WP8.1



Add device detection for WP8.1, and use the Appx packaging codepath
for these devices. Rely on winrtrunner to automatically select the
correct profile.

Change-Id: Ibd1d415644fdc8fd007969be25213410c3c0e0a7
Reviewed-by: default avatarOliver Wolff <oliver.wolff@digia.com>
parent e3979fe0
......@@ -197,7 +197,7 @@ static int extractDeviceId(QByteArray *line)
static IDevice::MachineType machineTypeFromLine(const QByteArray &line)
{
return line.startsWith("Emulator ") ? IDevice::Emulator : IDevice::Hardware;
return line.contains("Emulator ") ? IDevice::Emulator : IDevice::Hardware;
}
/*
......@@ -206,6 +206,19 @@ static IDevice::MachineType machineTypeFromLine(const QByteArray &line)
* Available devices:
* Appx:
* 0 local
* Phone:
* 0 Device
* 1 Emulator 8.1 WVGA 4 inch 512MB
* 2 Emulator 8.1 WVGA 4 inch
* 3 Emulator 8.1 WXGA 4 inch
* 4 Emulator 8.1 720P 4.7 inch
* 5 Emulator 8.1 1080P 5.5 inch
* 6 Emulator 8.1 1080P 6 inch
* 7 WE8.1H Emulator WVGA 512MB
* 8 WE8.1H Emulator WVGA
* 9 WE8.1H Emulator WXGA
* 10 WE8.1H Emulator 720P
* 11 WE8.1H Emulator 1080P
* Xap:
* 0 Device
* 1 Emulator WVGA 512MB
......@@ -216,7 +229,7 @@ static IDevice::MachineType machineTypeFromLine(const QByteArray &line)
void WinRtDeviceFactory::parseRunnerOutput(const QByteArray &output) const
{
ProjectExplorer::DeviceManager *deviceManager = ProjectExplorer::DeviceManager::instance();
enum State { StartState, AppxState, XapState };
enum State { StartState, AppxState, PhoneState, XapState };
State state = StartState;
int numFound = 0;
int numSkipped = 0;
......@@ -224,6 +237,8 @@ void WinRtDeviceFactory::parseRunnerOutput(const QByteArray &output) const
line = line.trimmed();
if (line == "Appx:") {
state = AppxState;
} else if (line == "Phone:") {
state = PhoneState;
} else if (line == "Xap:") {
state = XapState;
} else {
......@@ -239,6 +254,13 @@ void WinRtDeviceFactory::parseRunnerOutput(const QByteArray &output) const
internalName += QStringLiteral("appx.");
deviceType = Constants::WINRT_DEVICE_TYPE_LOCAL;
name = tr("Windows Runtime local UI");
} else if (state == PhoneState) {
internalName += QStringLiteral("phone.");
name = QString::fromLocal8Bit(line);
if (machineType == IDevice::Emulator)
deviceType = Constants::WINRT_DEVICE_TYPE_EMULATOR;
else
deviceType = Constants::WINRT_DEVICE_TYPE_PHONE;
} else if (state == XapState) {
internalName += QStringLiteral("xap.");
name = QString::fromLocal8Bit(line);
......
......@@ -71,15 +71,15 @@ bool WinRtPackageDeploymentStep::init()
if (!qt)
return false;
m_isWinPhone = (qt->type() == QLatin1String(Constants::WINRT_WINPHONEQT));
QString args = QtcProcess::quoteArg(QDir::toNativeSeparators(targetPath));
args += QLatin1Char(' ') + m_args;
if (m_isWinPhone) {
m_manifestFileName = QLatin1String("WMAppManifest");
m_manifestFileName = QStringLiteral("AppxManifest");
if (qt->type() == QLatin1String(Constants::WINRT_WINPHONEQT)
&& qt->mkspec().toString().contains(QLatin1String("msvc2012"))) {
m_createMappingFile = true;
} else {
m_manifestFileName = QLatin1String("AppxManifest");
m_manifestFileName = QStringLiteral("WMAppManifest");
}
if (m_createMappingFile) {
......
......@@ -61,7 +61,6 @@ private:
QString m_executablePathInManifest;
QString m_mappingFileContent;
QString m_manifestFileName;
bool m_isWinPhone;
bool m_createMappingFile;
};
......
......@@ -68,7 +68,6 @@ WinRtRunControl::WinRtRunControl(WinRtRunConfiguration *runConfiguration, RunMod
return;
}
m_isWinPhone = (qt->type() == QLatin1String(Constants::WINRT_WINPHONEQT));
m_runnerFilePath = qt->binPath().toString() + QStringLiteral("/winrtrunner.exe");
if (!QFile::exists(m_runnerFilePath)) {
appendMessage(tr("Cannot find winrtrunner.exe in \"%1\".").arg(
......@@ -175,8 +174,6 @@ void WinRtRunControl::onProcessReadyReadStdErr()
bool WinRtRunControl::startWinRtRunner()
{
QString runnerArgs;
QtcProcess::addArg(&runnerArgs, QStringLiteral("--profile"));
QtcProcess::addArg(&runnerArgs, m_isWinPhone ? QStringLiteral("xap") : QStringLiteral("appx"));
if (m_device) {
QtcProcess::addArg(&runnerArgs, QStringLiteral("--device"));
QtcProcess::addArg(&runnerArgs, QString::number(m_device->deviceId()));
......
......@@ -76,7 +76,6 @@ private:
QString m_executableFilePath;
QString m_arguments;
bool m_uninstallAfterStop;
bool m_isWinPhone;
Utils::QtcProcess *m_process;
Utils::Environment m_environment;
};
......
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