Remove UWP support

The UWP support in Qt was removed with Qt 6 and the support in Qt
Creator is basically untested.

Change-Id: I3148efdb596ddd326f590c14c22cc77ded2582a7
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
David Schulz
2022-02-24 13:57:53 +01:00
parent b2331dd5f6
commit b8caa4f26b
43 changed files with 8 additions and 2533 deletions

View File

@@ -35,7 +35,6 @@
\list
\li \l Android
\li \l iOS
\li \l {Universal Windows Platform (UWP)}
\endlist
You must install the tool chain for building applications for the targeted
@@ -83,17 +82,4 @@
\li \l{Qt for iOS}
\endlist
\section1 Universal Windows Platform (UWP)
Microsoft Windows 10 introduced the Universal Windows Platform (UWP),
which provides a common application platform on every device that runs
Windows 10, as a successor to Windows Runtime (WinRT) introduced by
Windows 8. The UWP core APIs are the same on all Windows devices, and
therefore applications that only use the core APIs will run on any
Windows 10 device, such as a desktop PC, or Xbox One.
For more information about developing applications for UWP using Qt 5, see
\l{https://doc.qt.io/qt-5/winrt-support.html}{Qt for UWP}.
\note Developing for UWP using Qt 6 is not supported.
*/

View File

@@ -38,7 +38,7 @@
You can connect \l{glossary-device}{devices} to the development PC to run, debug,
and analyze applications built for them from \QC. When you install Qt for a
target platform, such as Android, QNX, or Universal Windows Platform (UWP),
target platform, such as Android or QNX,
the build and run settings for the development targets might be set up
automatically in \QC.

View File

@@ -80,11 +80,6 @@
\li \image ok
\li \image ok
\li \inlineimage ok
\row
\li \l{Universal Windows Platform (UWP)}{UWP}
\li
\li
\li \image ok
\row
\li \l{Building Applications for the Web}{WebAssembly}
\li \image ok
@@ -92,6 +87,9 @@
\li \image ok
\endtable
\note UWP support was removed from \QC 8.0.
To develop for UWP using Qt 5, use \QC 7.0, or earlier.
\QC automatically runs scheduled checks for updates based on the settings
specified in \uicontrol Tools > \uicontrol Options \uicontrol Environment >
\uicontrol Update.

View File

@@ -58,9 +58,6 @@
\li \l{Connecting MCUs}{MCU Device} (commercial only)
\li \l{Connecting QNX Devices}{QNX Device}
\li \l{Building Applications for the Web}{WebAssembly Runtime}
\li \l{https://doc.qt.io/qt-5/winrt-support.html}{Windows Phone} (Qt 5)
\li Windows Phone Emulator (Qt 5)
\li Windows Runtime (local, Qt 5)
\endlist
\section1 Filtering Kit Settings

View File

@@ -78,7 +78,6 @@ add_subdirectory(qmlpreview)
add_subdirectory(qmlprofiler)
add_subdirectory(remotelinux)
add_subdirectory(valgrind)
add_subdirectory(winrt)
add_subdirectory(perfprofiler)
add_subdirectory(qbsprojectmanager)
add_subdirectory(ctfvisualizer)

View File

@@ -80,7 +80,6 @@ Project {
"valgrind/valgrind.qbs",
"vcsbase/vcsbase.qbs",
"webassembly/webassembly.qbs",
"welcome/welcome.qbs",
"winrt/winrt.qbs"
"welcome/welcome.qbs"
].concat(project.additionalPlugins)
}

View File

@@ -901,34 +901,18 @@ QStringList MsvcToolChain::suggestedMkspecList() const
case Abi::WindowsMsvc2013Flavor:
return {"win32-msvc",
"win32-msvc2013",
"winphone-arm-msvc2013",
"winphone-x86-msvc2013",
"winrt-arm-msvc2013",
"winrt-x86-msvc2013",
"winrt-x64-msvc2013",
"win32-msvc2012",
"win32-msvc2010"};
case Abi::WindowsMsvc2015Flavor:
return {"win32-msvc",
"win32-msvc2015",
"winphone-arm-msvc2015",
"winphone-x86-msvc2015",
"winrt-arm-msvc2015",
"winrt-x86-msvc2015",
"winrt-x64-msvc2015"};
"win32-msvc2015"};
case Abi::WindowsMsvc2017Flavor:
return {"win32-msvc",
"win32-msvc2017",
"winrt-arm-msvc2017",
"winrt-x86-msvc2017",
"winrt-x64-msvc2017"};
"win32-msvc2017",};
case Abi::WindowsMsvc2019Flavor:
return {"win32-msvc",
"win32-msvc2019",
"win32-arm64-msvc",
"winrt-arm-msvc2019",
"winrt-x86-msvc2019",
"winrt-x64-msvc2019"};
"win32-arm64-msvc"};
case Abi::WindowsMsvc2022Flavor:
return {"win32-msvc",
"win32-msvc2022",

View File

@@ -45,7 +45,6 @@
#include <ios/iosconstants.h>
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtkitinformation.h>
#include <winrt/winrtconstants.h>
#include <QDir>
#include <QFileInfo>
@@ -60,7 +59,6 @@ using namespace Constants;
namespace Internal {
using namespace ProjectExplorer::Constants;
using namespace Ios::Constants;
using namespace WinRt::Internal::Constants;
static QString extractToolchainPrefix(QString *compilerName)
{

View File

@@ -1,16 +0,0 @@
add_qtc_plugin(WinRt
PLUGIN_DEPENDS Core Debugger ProjectExplorer QtSupport
SOURCES
winrt.qrc
winrtconstants.h
winrtdebugsupport.cpp winrtdebugsupport.h
winrtdeployconfiguration.cpp winrtdeployconfiguration.h
winrtdevice.cpp winrtdevice.h
winrtpackagedeploymentstep.cpp winrtpackagedeploymentstep.h
winrtphoneqtversion.cpp winrtphoneqtversion.h
winrtplugin.cpp winrtplugin.h
winrtqtversion.cpp winrtqtversion.h
winrtrunconfiguration.cpp winrtrunconfiguration.h
winrtruncontrol.cpp winrtruncontrol.h
winrtrunnerhelper.cpp winrtrunnerhelper.h
)

View File

@@ -1,20 +0,0 @@
{
\"Name\" : \"WinRt\",
\"Version\" : \"$$QTCREATOR_VERSION\",
\"CompatVersion\" : \"$$QTCREATOR_COMPAT_VERSION\",
\"Platform\" : \"Windows (8.1|10|11)\",
\"Vendor\" : \"The Qt Company Ltd\",
\"Copyright\" : \"(C) $$QTCREATOR_COPYRIGHT_YEAR The Qt Company Ltd\",
\"License\" : [ \"Commercial Usage\",
\"\",
\"Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and The Qt Company.\",
\"\",
\"GNU General Public License Usage\",
\"\",
\"Alternatively, this plugin may be used under the terms of the GNU General Public License version 3 as published by the Free Software Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT included in the packaging of this plugin. Please review the following information to ensure the GNU General Public License requirements will be met: https://www.gnu.org/licenses/gpl-3.0.html.\"
],
\"Category\" : \"Device Support\",
\"Description\" : \"Helper for Windows Runtime projects.\",
\"Url\" : \"http://www.qt.io\",
$$dependencyList
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 160 B

View File

@@ -1,38 +0,0 @@
import qbs 1.0
QtcPlugin {
name: "WinRt"
Depends { name: "Core" }
Depends { name: "Debugger" }
Depends { name: "ProjectExplorer" }
Depends { name: "QtSupport" }
Depends { name: "QmakeProjectManager" }
Depends { name: "Qt.gui" }
Depends { name: "app_version_header" }
files: [
"winrt.qrc",
"winrtconstants.h",
"winrtdebugsupport.cpp",
"winrtdebugsupport.h",
"winrtdeployconfiguration.cpp",
"winrtdeployconfiguration.h",
"winrtdevice.cpp",
"winrtdevice.h",
"winrtpackagedeploymentstep.cpp",
"winrtpackagedeploymentstep.h",
"winrtphoneqtversion.cpp",
"winrtphoneqtversion.h",
"winrtplugin.cpp",
"winrtplugin.h",
"winrtqtversion.cpp",
"winrtqtversion.h",
"winrtrunconfiguration.cpp",
"winrtrunconfiguration.h",
"winrtruncontrol.cpp",
"winrtruncontrol.h",
"winrtrunnerhelper.cpp",
"winrtrunnerhelper.h"
]
}

View File

@@ -1,8 +0,0 @@
<RCC>
<qresource prefix="/winrt">
<file>images/winrtdevice.png</file>
<file>images/winrtdevice@2x.png</file>
<file>images/winrtdevicesmall.png</file>
<file>images/winrtdevicesmall@2x.png</file>
</qresource>
</RCC>

View File

@@ -1,44 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
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";
const char WINRT_BUILD_STEP_DEPLOY[] = "WinRt.BuildStep.Deploy";
const char WINRT_WINRTQT[] = "WinRt.QtVersion.WindowsRuntime";
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";
} // Constants
} // Internal
} // WinRt

View File

@@ -1,132 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "winrtdebugsupport.h"
#include "winrtrunconfiguration.h"
#include "winrtrunnerhelper.h"
#include <app/app_version.h>
#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <qmldebug/qmldebugcommandlinearguments.h>
#include <QFileInfo>
#include <QLocalServer>
#include <QLocalSocket>
#include <QTcpServer>
#include <utils/qtcprocess.h>
#include <utils/url.h>
using namespace Debugger;
using namespace ProjectExplorer;
namespace WinRt {
namespace Internal {
WinRtDebugSupport::WinRtDebugSupport(RunControl *runControl)
: DebuggerRunTool(runControl)
{
// FIXME: This is just working for local debugging;
setStartMode(AttachToLocalProcess);
// The first Thread needs to be resumed manually.
setCommandsAfterConnect("~0 m");
QFileInfo debuggerHelper(QCoreApplication::applicationDirPath()
+ QLatin1String("/winrtdebughelper.exe"));
if (!debuggerHelper.isExecutable()) {
reportFailure(tr("The WinRT debugging helper is missing from your %1 "
"installation. It was assumed to be located at %2")
.arg(Core::Constants::IDE_DISPLAY_NAME)
.arg(debuggerHelper.absoluteFilePath()));
return;
}
if (isQmlDebugging()) {
QUrl qmlServer = Utils::urlFromLocalHostAndFreePort();
if (qmlServer.port() <= 0) {
reportFailure(tr("Not enough free ports for QML debugging."));
return;
}
setQmlServer(qmlServer);
}
setSymbolFile(runControl->targetFilePath());
QString errorMessage;
m_runner = new WinRtRunnerHelper(this, &errorMessage);
if (!errorMessage.isEmpty()) {
reportFailure(errorMessage);
return;
}
QLocalServer server;
server.listen(QLatin1String("QtCreatorWinRtDebugPIDPipe"));
m_runner->debug(debuggerHelper.absoluteFilePath());
if (!m_runner->waitForStarted()) {
reportFailure(tr("Cannot start the WinRT Runner Tool."));
return;
}
if (!server.waitForNewConnection(10000)) {
reportFailure(tr("Cannot establish connection to the WinRT debugging helper."));
return;
}
while (server.hasPendingConnections()) {
QLocalSocket *connection = server.nextPendingConnection();
if (connection->waitForReadyRead(1000)) {
const QByteArray &output = connection->readAll();
QList<QByteArray> arg = output.split(':');
if (arg.first() == "PID") {
bool ok =false;
int pid = arg.last().toInt(&ok);
if (!ok) {
reportFailure(tr("Cannot extract the PID from the WinRT debugging helper. "
"(output: %1)").arg(QString::fromLocal8Bit(output)));
return;
}
setAttachPid(Utils::ProcessHandle(pid));
server.close();
return;
}
}
}
server.close();
reportFailure(tr("Cannot create an appropriate run control for "
"the current run configuration."));
}
WinRtDebugSupport::~WinRtDebugSupport()
{
delete m_runner;
}
} // namespace Internal
} // namespace WinRt

View File

@@ -1,49 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <debugger/debuggerruncontrol.h>
namespace WinRt {
namespace Internal {
class WinRtRunConfiguration;
class WinRtRunnerHelper;
class WinRtDebugSupport : public Debugger::DebuggerRunTool
{
Q_OBJECT
public:
explicit WinRtDebugSupport(ProjectExplorer::RunControl *runControl);
~WinRtDebugSupport();
private:
WinRtRunnerHelper *m_runner = nullptr;
};
} // namespace Internal
} // namespace WinRt

View File

@@ -1,70 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "winrtdeployconfiguration.h"
#include "winrtpackagedeploymentstep.h"
#include "winrtconstants.h"
#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <QCoreApplication>
using namespace ProjectExplorer;
namespace WinRt {
namespace Internal {
WinRtAppDeployConfigurationFactory::WinRtAppDeployConfigurationFactory()
{
setConfigBaseId("WinRTAppxDeployConfiguration");
setDefaultDisplayName(QCoreApplication::translate("WinRt::Internal::WinRtDeployConfiguration",
"Run windeployqt"));
addSupportedTargetDeviceType(Constants::WINRT_DEVICE_TYPE_LOCAL);
addInitialStep(Constants::WINRT_BUILD_STEP_DEPLOY);
}
WinRtPhoneDeployConfigurationFactory::WinRtPhoneDeployConfigurationFactory()
{
setConfigBaseId("WinRTPhoneDeployConfiguration");
setDefaultDisplayName(QCoreApplication::translate("WinRt::Internal::WinRtDeployConfiguration",
"Deploy to Windows Phone"));
addSupportedTargetDeviceType(Constants::WINRT_DEVICE_TYPE_PHONE);
addInitialStep(Constants::WINRT_BUILD_STEP_DEPLOY);
}
WinRtEmulatorDeployConfigurationFactory::WinRtEmulatorDeployConfigurationFactory()
{
setConfigBaseId("WinRTEmulatorDeployConfiguration");
setDefaultDisplayName(QCoreApplication::translate("WinRt::Internal::WinRtDeployConfiguration",
"Deploy to Windows Phone Emulator"));
addSupportedTargetDeviceType(Constants::WINRT_DEVICE_TYPE_EMULATOR);
addInitialStep(Constants::WINRT_BUILD_STEP_DEPLOY);
}
} // namespace Internal
} // namespace WinRt

View File

@@ -1,53 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <projectexplorer/deployconfiguration.h>
#include <projectexplorer/buildstep.h>
namespace WinRt {
namespace Internal {
class WinRtAppDeployConfigurationFactory : public ProjectExplorer::DeployConfigurationFactory
{
public:
WinRtAppDeployConfigurationFactory();
};
class WinRtPhoneDeployConfigurationFactory : public ProjectExplorer::DeployConfigurationFactory
{
public:
WinRtPhoneDeployConfigurationFactory();
};
class WinRtEmulatorDeployConfigurationFactory : public ProjectExplorer::DeployConfigurationFactory
{
public:
WinRtEmulatorDeployConfigurationFactory();
};
} // namespace Internal
} // namespace WinRt

View File

@@ -1,364 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "winrtdevice.h"
#include "winrtconstants.h"
#include "winrtqtversion.h"
#include <coreplugin/messagemanager.h>
#include <projectexplorer/devicesupport/desktopprocesssignaloperation.h>
#include <projectexplorer/devicesupport/devicemanager.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <qtsupport/qtversionmanager.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <utils/portlist.h>
#include <QFileInfo>
#include <QIcon>
#include <QLoggingCategory>
#include <QWizard>
using QtSupport::QtVersion;
using QtSupport::QtVersionManager;
using namespace Core;
using namespace ProjectExplorer;
using namespace Utils;
namespace WinRt {
namespace Internal {
static Q_LOGGING_CATEGORY(winrtDeviceLog, "qtc.winrt.deviceParser", QtWarningMsg)
WinRtDevice::WinRtDevice()
{
setDisplayType(displayNameForType(type()));
setOsType(OsTypeWindows);
PortList portList;
portList.addRange(Port(ProjectExplorer::Constants::DESKTOP_PORT_START),
Port(ProjectExplorer::Constants::DESKTOP_PORT_END));
setFreePorts(portList);
}
IDeviceWidget *WinRtDevice::createWidget()
{
return nullptr;
}
DeviceProcessSignalOperation::Ptr WinRtDevice::signalOperation() const
{
class WinRtDesktopSignalOperation : public DesktopProcessSignalOperation
{
public:
WinRtDesktopSignalOperation() {}
~WinRtDesktopSignalOperation() {}
};
return DeviceProcessSignalOperation::Ptr(new WinRtDesktopSignalOperation());
}
void WinRtDevice::fromMap(const QVariantMap &map)
{
IDevice::fromMap(map);
m_deviceId = map.value(QStringLiteral("WinRtRunnerDeviceId")).toInt();
}
QVariantMap WinRtDevice::toMap() const
{
QVariantMap map = IDevice::toMap();
map.insert(QStringLiteral("WinRtRunnerDeviceId"), m_deviceId);
return map;
}
QString WinRtDevice::displayNameForType(Id type)
{
if (type == Constants::WINRT_DEVICE_TYPE_LOCAL)
return QCoreApplication::translate("WinRt::Internal::WinRtDevice",
"Windows Runtime (Local)");
if (type == Constants::WINRT_DEVICE_TYPE_PHONE)
return QCoreApplication::translate("WinRt::Internal::WinRtDevice",
"Windows Phone");
if (type == Constants::WINRT_DEVICE_TYPE_EMULATOR)
return QCoreApplication::translate("WinRt::Internal::WinRtDevice",
"Windows Phone Emulator");
return QString();
}
// Factory
WinRtDeviceFactory::WinRtDeviceFactory(Id deviceType)
: ProjectExplorer::IDeviceFactory(deviceType)
{
if (allPrerequisitesLoaded()) {
onPrerequisitesLoaded();
} else {
connect(DeviceManager::instance(), &DeviceManager::devicesLoaded,
this, &WinRtDeviceFactory::onPrerequisitesLoaded, Qt::QueuedConnection);
connect(QtVersionManager::instance(),
&QtVersionManager::qtVersionsLoaded,
this, &WinRtDeviceFactory::onPrerequisitesLoaded, Qt::QueuedConnection);
}
setDisplayName(WinRtDevice::displayNameForType(deviceType));
setConstructionFunction(&WinRtDevice::create);
setCombinedIcon(":/winrt/images/winrtdevicesmall.png",
":/winrt/images/winrtdevice.png");
}
void WinRtDeviceFactory::autoDetect()
{
qCDebug(winrtDeviceLog) << __FUNCTION__;
const QString runnerFilePath = findRunnerFilePath();
if (runnerFilePath.isEmpty()) {
qCDebug(winrtDeviceLog) << "No winrtrunner.exe found.";
return;
}
if (!m_process) {
qCDebug(winrtDeviceLog) << __FUNCTION__ << "Creating process";
m_process = new QtcProcess(this);
connect(m_process, &QtcProcess::errorOccurred, this, &WinRtDeviceFactory::onProcessError);
connect(m_process, &QtcProcess::finished, this, &WinRtDeviceFactory::onProcessFinished);
}
const CommandLine cmd{FilePath::fromString(runnerFilePath), {"--list-devices"}};
m_process->setCommand(cmd);
qCDebug(winrtDeviceLog) << __FUNCTION__ << "Starting process" << cmd.toUserOutput();
m_process->start();
qCDebug(winrtDeviceLog) << __FUNCTION__ << "Process started";
}
void WinRtDeviceFactory::onPrerequisitesLoaded()
{
if (!allPrerequisitesLoaded() || m_initialized)
return;
qCDebug(winrtDeviceLog) << __FUNCTION__;
m_initialized = true;
disconnect(DeviceManager::instance(), &DeviceManager::devicesLoaded,
this, &WinRtDeviceFactory::onPrerequisitesLoaded);
disconnect(QtVersionManager::instance(), &QtVersionManager::qtVersionsLoaded,
this, &WinRtDeviceFactory::onPrerequisitesLoaded);
autoDetect();
connect(QtVersionManager::instance(), &QtVersionManager::qtVersionsChanged,
this, &WinRtDeviceFactory::autoDetect);
qCDebug(winrtDeviceLog) << __FUNCTION__ << "Done";
}
void WinRtDeviceFactory::onProcessError()
{
MessageManager::writeDisrupting(
tr("Error while executing winrtrunner: %1").arg(m_process->errorString()));
}
void WinRtDeviceFactory::onProcessFinished()
{
int exitCode = m_process->exitCode();
QProcess::ExitStatus exitStatus = m_process->exitStatus();
qCDebug(winrtDeviceLog) << __FUNCTION__ << "Exit code:" << exitCode <<"\tExit status:"
<< exitStatus;
if (exitStatus == QProcess::CrashExit) {
// already handled in onProcessError
return;
}
if (exitCode != 0) {
MessageManager::writeFlashing(tr("winrtrunner returned with exit code %1.").arg(exitCode));
return;
}
const QByteArray stdOut = m_process->readAllStandardOutput();
const QByteArray stdErr = m_process->readAllStandardError();
qCDebug(winrtDeviceLog) << __FUNCTION__ << "winrtrunner's stdout:" << stdOut;
if (!stdErr.isEmpty())
qCDebug(winrtDeviceLog) << __FUNCTION__ << "winrtrunner's stderr:" << stdErr;
parseRunnerOutput(stdOut);
}
bool WinRtDeviceFactory::allPrerequisitesLoaded()
{
return QtVersionManager::isLoaded() && DeviceManager::instance()->isLoaded();
}
QString WinRtDeviceFactory::findRunnerFilePath() const
{
qCDebug(winrtDeviceLog) << __FUNCTION__;
const QString winRtRunnerExe = QStringLiteral("/winrtrunner.exe");
const QList<QtVersion *> winrtVersions
= QtVersionManager::sortVersions(
QtVersionManager::versions(QtVersion::isValidPredicate([](const QtVersion *v) {
return v->type() == QLatin1String(Constants::WINRT_WINRTQT)
|| v->type() == QLatin1String(Constants::WINRT_WINPHONEQT);
})));
QString filePath;
QtVersion *qt = nullptr;
for (QtVersion *v : winrtVersions) {
if (!qt || qt->qtVersion() < v->qtVersion()) {
QFileInfo fi(v->hostBinPath().toString() + winRtRunnerExe);
if (fi.isFile() && fi.isExecutable()) {
qt = v;
filePath = fi.absoluteFilePath();
}
}
}
qCDebug(winrtDeviceLog) << __FUNCTION__ << "Found" << filePath;
return filePath;
}
static int extractDeviceId(QByteArray *line)
{
qCDebug(winrtDeviceLog) << __FUNCTION__ << "Line:" << *line;
int pos = line->indexOf(' ');
if (pos < 0) {
qCDebug(winrtDeviceLog) << __FUNCTION__ << "Could not find space, returning -1";
return -1;
}
bool ok;
int id = line->left(pos).toInt(&ok);
if (!ok) {
qCDebug(winrtDeviceLog) << __FUNCTION__ << "Could not extract ID";
return -1;
}
line->remove(0, pos + 1);
qCDebug(winrtDeviceLog) << __FUNCTION__ << "Found ID" << id;
return id;
}
static IDevice::MachineType machineTypeFromLine(const QByteArray &line)
{
return line.contains("Emulator ") ? IDevice::Emulator : IDevice::Hardware;
}
/*
* The output of "winrtrunner --list-devices" looks like this:
*
* 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
* 2 Emulator WVGA
* 3 Emulator WXGA
* 4 Emulator 720P
*/
void WinRtDeviceFactory::parseRunnerOutput(const QByteArray &output) const
{
qCDebug(winrtDeviceLog) << __FUNCTION__;
ProjectExplorer::DeviceManager *deviceManager = ProjectExplorer::DeviceManager::instance();
enum State { StartState, AppxState, PhoneState, XapState };
State state = StartState;
int numFound = 0;
int numSkipped = 0;
foreach (QByteArray line, output.split('\n')) {
line = line.trimmed();
qCDebug(winrtDeviceLog) << __FUNCTION__ << "Line:" << line;
if (line == "Appx:") {
qCDebug(winrtDeviceLog) << __FUNCTION__ << "state = AppxState";
state = AppxState;
} else if (line == "Phone:") {
qCDebug(winrtDeviceLog) << __FUNCTION__ << "state = PhoneState";
state = PhoneState;
} else if (line == "Xap:") {
qCDebug(winrtDeviceLog) << __FUNCTION__ << "state = XapState";
state = XapState;
} else {
const int deviceId = extractDeviceId(&line);
if (deviceId < 0) {
qCDebug(winrtDeviceLog) << __FUNCTION__ << "Could not extract device ID";
continue;
}
const IDevice::MachineType machineType = machineTypeFromLine(line);
Id deviceType;
QString name;
QString internalName = QStringLiteral("WinRT.");
if (state == AppxState) {
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);
if (machineType == IDevice::Emulator)
deviceType = Constants::WINRT_DEVICE_TYPE_EMULATOR;
else
deviceType = Constants::WINRT_DEVICE_TYPE_PHONE;
}
internalName += QString::number(deviceId);
const Id internalId = Id::fromString(internalName);
++numFound;
if (DeviceManager::instance()->find(internalId)) {
qCDebug(winrtDeviceLog) << __FUNCTION__ << "Skipping device with ID" << deviceId;
++numSkipped;
continue;
}
auto device = WinRtDevice::create();
device->setupId(IDevice::AutoDetected, internalId);
device->setDeviceId(deviceId);
device->setType(deviceType);
device->setMachineType(machineType);
device->setDefaultDisplayName(name);
deviceManager->addDevice(ProjectExplorer::IDevice::ConstPtr(device));
qCDebug(winrtDeviceLog) << __FUNCTION__ << "Added device" << name << "(internal name:"
<< internalName << ")";
}
}
QString message = tr("Found %n Windows Runtime devices.", nullptr, numFound);
if (const int numNew = numFound - numSkipped) {
message += QLatin1Char(' ');
message += tr("%n of them are new.", nullptr, numNew);
}
qCDebug(winrtDeviceLog) << message;
}
} // Internal
} // WinRt

View File

@@ -1,83 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <projectexplorer/devicesupport/idevice.h>
#include <projectexplorer/devicesupport/idevicefactory.h>
namespace Utils { class QtcProcess; }
namespace WinRt {
namespace Internal {
class WinRtDevice final : public ProjectExplorer::IDevice
{
public:
typedef QSharedPointer<WinRtDevice> Ptr;
typedef QSharedPointer<const WinRtDevice> ConstPtr;
static Ptr create() { return Ptr(new WinRtDevice); }
ProjectExplorer::IDeviceWidget *createWidget() override;
ProjectExplorer::DeviceProcessSignalOperation::Ptr signalOperation() const override;
static QString displayNameForType(Utils::Id type);
int deviceId() const { return m_deviceId; }
void setDeviceId(int deviceId) { m_deviceId = deviceId; }
protected:
void fromMap(const QVariantMap &map) final;
QVariantMap toMap() const final;
private:
WinRtDevice();
int m_deviceId = -1;
};
class WinRtDeviceFactory final : public QObject, public ProjectExplorer::IDeviceFactory
{
Q_OBJECT
public:
explicit WinRtDeviceFactory(Utils::Id deviceType);
void autoDetect();
void onPrerequisitesLoaded();
private:
void onProcessError();
void onProcessFinished();
static bool allPrerequisitesLoaded();
QString findRunnerFilePath() const;
void parseRunnerOutput(const QByteArray &output) const;
Utils::QtcProcess *m_process = nullptr;
bool m_initialized = false;
};
} // Internal
} // WinRt

View File

@@ -1,408 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "winrtpackagedeploymentstep.h"
#include "winrtconstants.h"
#include <projectexplorer/abstractprocessstep.h>
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/buildtargetinfo.h>
#include <projectexplorer/deployablefile.h>
#include <projectexplorer/deploymentdata.h>
#include <projectexplorer/processparameters.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/project.h>
#include <projectexplorer/runconfiguration.h>
#include <projectexplorer/target.h>
#include <qtsupport/qtkitinformation.h>
#include <utils/aspects.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <utils/fancylineedit.h>
#include <utils/layoutbuilder.h>
#include <QLabel>
#include <QLayout>
#include <QRegularExpression>
#include <QToolButton>
using namespace ProjectExplorer;
using namespace Utils;
namespace WinRt {
namespace Internal {
const char ARGUMENTS_KEY[] = "WinRt.BuildStep.Deploy.Arguments";
const char DEFAULTARGUMENTS_KEY[] = "WinRt.BuildStep.Deploy.DefaultArguments";
class WinRtArgumentsAspect final : public BaseAspect
{
Q_DECLARE_TR_FUNCTIONS(WinRt::Internal::WinRtArgumentsAspect)
public:
WinRtArgumentsAspect() = default;
void addToLayout(LayoutBuilder &builder) final;
void fromMap(const QVariantMap &map) final;
void toMap(QVariantMap &map) const final;
void setValue(const QString &value);
QString value() const { return m_value; }
void setDefaultValue(const QString &value) { m_defaultValue = value; }
QString defaultValue() const { return m_defaultValue; }
void restoreDefaultValue();
private:
FancyLineEdit *m_lineEdit = nullptr;
QString m_value;
QString m_defaultValue;
};
class WinRtPackageDeploymentStep final : public AbstractProcessStep
{
Q_DECLARE_TR_FUNCTIONS(WinRt::Internal::WinRtPackageDeploymentStep)
public:
WinRtPackageDeploymentStep(BuildStepList *bsl, Utils::Id id);
QString defaultWinDeployQtArguments() const;
void raiseError(const QString &errorMessage);
void raiseWarning(const QString &warningMessage);
private:
bool init() override;
void doRun() override;
bool processSucceeded(int exitCode, QProcess::ExitStatus status) override;
void stdOutput(const QString &line) override;
bool parseIconsAndExecutableFromManifest(QString manifestFileName, QStringList *items, QString *executable);
WinRtArgumentsAspect *m_argsAspect = nullptr;
QString m_targetFilePath;
QString m_targetDirPath;
QString m_executablePathInManifest;
QString m_mappingFileContent;
QString m_manifestFileName;
bool m_createMappingFile = false;
};
void WinRtArgumentsAspect::addToLayout(LayoutBuilder &builder)
{
QTC_CHECK(!m_lineEdit);
auto label = new QLabel(tr("Arguments:"));
label->setTextInteractionFlags(Qt::TextSelectableByMouse);
builder.addItem(label);
auto *layout = new QHBoxLayout();
m_lineEdit = new Utils::FancyLineEdit();
if (!m_value.isEmpty())
m_lineEdit->setText(m_value);
else if (!m_defaultValue.isEmpty())
m_lineEdit->setText(m_defaultValue);
connect(m_lineEdit, &Utils::FancyLineEdit::textEdited,
this, &WinRtArgumentsAspect::setValue);
layout->addWidget(m_lineEdit);
auto restoreDefaultButton = new QToolButton();
restoreDefaultButton->setText(tr("Restore Default Arguments"));
connect(restoreDefaultButton, &QToolButton::clicked,
this, &WinRtArgumentsAspect::restoreDefaultValue);
layout->addWidget(restoreDefaultButton);
builder.addItem(layout);
}
void WinRtArgumentsAspect::fromMap(const QVariantMap &map)
{
m_defaultValue = map.value(DEFAULTARGUMENTS_KEY).toString();
m_value = map.value(ARGUMENTS_KEY).toString();
}
void WinRtArgumentsAspect::toMap(QVariantMap &map) const
{
map.insert(DEFAULTARGUMENTS_KEY, m_defaultValue);
map.insert(ARGUMENTS_KEY, m_value);
}
void WinRtArgumentsAspect::setValue(const QString &value)
{
if (value == m_value)
return;
m_value = value;
if (m_lineEdit)
m_lineEdit->setText(value);
emit changed();
}
void WinRtArgumentsAspect::restoreDefaultValue()
{
if (m_defaultValue == m_value)
return;
setValue(m_defaultValue);
}
WinRtPackageDeploymentStep::WinRtPackageDeploymentStep(BuildStepList *bsl, Utils::Id id)
: AbstractProcessStep(bsl, id)
{
setDisplayName(tr("Run windeployqt"));
m_argsAspect = addAspect<WinRtArgumentsAspect>();
m_argsAspect->setDefaultValue(defaultWinDeployQtArguments());
m_argsAspect->setValue(defaultWinDeployQtArguments());
}
bool WinRtPackageDeploymentStep::init()
{
if (!AbstractProcessStep::init())
return false;
RunConfiguration *rc = target()->activeRunConfiguration();
QTC_ASSERT(rc, return false);
const BuildTargetInfo bti = rc->buildTargetInfo();
Utils::FilePath appTargetFilePath = bti.targetFilePath;
m_targetFilePath = appTargetFilePath.toString();
if (m_targetFilePath.isEmpty()) {
raiseError(tr("No executable to deploy found in %1.").arg(bti.projectFilePath.toString()));
return false;
}
// ### Ideally, the file paths in applicationTargets() should already have the .exe suffix.
// Whenever this will eventually work, we can drop appending the .exe suffix here.
if (!m_targetFilePath.endsWith(QLatin1String(".exe"), Qt::CaseInsensitive))
m_targetFilePath.append(QLatin1String(".exe"));
m_targetDirPath = appTargetFilePath.parentDir().toString();
if (!m_targetDirPath.endsWith(QLatin1Char('/')))
m_targetDirPath += QLatin1Char('/');
const QtSupport::QtVersion *qt = QtSupport::QtKitAspect::qtVersion(kit());
if (!qt)
return false;
const FilePath windeployqtPath = qt->hostBinPath().resolvePath(QString("windeployqt.exe"));
CommandLine windeployqt{windeployqtPath};
windeployqt.addArg(QDir::toNativeSeparators(m_targetFilePath));
windeployqt.addArgs(m_argsAspect->value(), CommandLine::Raw);
if (qt->type() == Constants::WINRT_WINPHONEQT) {
m_createMappingFile = true;
windeployqt.addArgs({"-list", "mapping"});
}
ProcessParameters *params = processParameters();
if (!windeployqtPath.exists()) {
raiseError(tr("Cannot find windeployqt.exe in \"%1\".")
.arg(QDir::toNativeSeparators(qt->hostBinPath().toString())));
return false;
}
params->setCommandLine(windeployqt);
params->setEnvironment(target()->activeBuildConfiguration()
? target()->activeBuildConfiguration()->environment()
: Environment::systemEnvironment());
return true;
}
void WinRtPackageDeploymentStep::doRun()
{
const QtSupport::QtVersion *qt = QtSupport::QtKitAspect::qtVersion(kit());
if (!qt)
return;
m_manifestFileName = QStringLiteral("AppxManifest");
if (m_createMappingFile) {
m_mappingFileContent = QLatin1String("[Files]\n");
QDir assetDirectory(m_targetDirPath + QLatin1String("assets"));
if (assetDirectory.exists()) {
QStringList iconsToDeploy;
const QString fullManifestPath = m_targetDirPath + m_manifestFileName
+ QLatin1String(".xml");
if (!parseIconsAndExecutableFromManifest(fullManifestPath, &iconsToDeploy,
&m_executablePathInManifest)) {
raiseError(tr("Cannot parse manifest file %1.").arg(fullManifestPath));
return;
}
foreach (const QString &icon, iconsToDeploy) {
m_mappingFileContent += QLatin1Char('"')
+ QDir::toNativeSeparators(m_targetDirPath + icon) + QLatin1String("\" \"")
+ QDir::toNativeSeparators(icon) + QLatin1String("\"\n");
}
}
}
AbstractProcessStep::doRun();
}
bool WinRtPackageDeploymentStep::processSucceeded(int exitCode, QProcess::ExitStatus status)
{
if (m_createMappingFile) {
QString targetInstallationPath;
// The list holds the local file paths and the "remote" file paths
QList<QPair<QString, QString> > installableFilesList;
foreach (DeployableFile file, target()->deploymentData().allFiles()) {
QString remoteFilePath = file.remoteFilePath();
while (remoteFilePath.startsWith(QLatin1Char('/')))
remoteFilePath.remove(0, 1);
QString localFilePath = file.localFilePath().toString();
if (localFilePath == m_targetFilePath) {
if (!m_targetFilePath.endsWith(QLatin1String(".exe"))) {
remoteFilePath += QLatin1String(".exe");
localFilePath += QLatin1String(".exe");
}
targetInstallationPath = remoteFilePath;
}
installableFilesList.append(QPair<QString, QString>(localFilePath, remoteFilePath));
}
// if there are no INSTALLS set we just deploy the files from windeployqt,
// the icons referenced in the manifest file and the actual build target
QString baseDir;
if (targetInstallationPath.isEmpty()) {
if (!m_targetFilePath.endsWith(QLatin1String(".exe")))
m_targetFilePath.append(QLatin1String(".exe"));
m_mappingFileContent
+= QLatin1Char('"') + QDir::toNativeSeparators(m_targetFilePath)
+ QLatin1String("\" \"")
+ QDir::toNativeSeparators(m_executablePathInManifest) + QLatin1String("\"\n");
baseDir = m_targetDirPath;
} else {
baseDir = targetInstallationPath.left(targetInstallationPath.lastIndexOf(QLatin1Char('/')) + 1);
}
typedef QPair<QString, QString> QStringPair;
foreach (const QStringPair &pair, installableFilesList) {
// For the mapping file we need the remote paths relative to the application's executable
QString relativeRemotePath;
if (QDir(pair.second).isRelative())
relativeRemotePath = pair.second;
else
relativeRemotePath = QDir(baseDir).relativeFilePath(pair.second);
if (QDir(relativeRemotePath).isAbsolute() || relativeRemotePath.startsWith(QLatin1String(".."))) {
raiseWarning(tr("File %1 is outside of the executable's directory. These files cannot be installed.").arg(relativeRemotePath));
continue;
}
m_mappingFileContent += QLatin1Char('"') + QDir::toNativeSeparators(pair.first)
+ QLatin1String("\" \"") + QDir::toNativeSeparators(relativeRemotePath)
+ QLatin1String("\"\n");
}
const QString mappingFilePath = m_targetDirPath + m_manifestFileName
+ QLatin1String(".map");
QFile mappingFile(mappingFilePath);
if (!mappingFile.open(QFile::WriteOnly | QFile::Text)) {
raiseError(tr("Cannot open mapping file %1 for writing.").arg(mappingFilePath));
return false;
}
mappingFile.write(m_mappingFileContent.toUtf8());
}
return AbstractProcessStep::processSucceeded(exitCode, status);
}
void WinRtPackageDeploymentStep::stdOutput(const QString &line)
{
if (m_createMappingFile)
m_mappingFileContent += line;
AbstractProcessStep::stdOutput(line);
}
QString WinRtPackageDeploymentStep::defaultWinDeployQtArguments() const
{
QString args;
ProcessArgs::addArg(&args, QStringLiteral("--qmldir"));
ProcessArgs::addArg(&args, project()->projectDirectory().toUserOutput());
return args;
}
void WinRtPackageDeploymentStep::raiseError(const QString &errorMessage)
{
emit addOutput(errorMessage, BuildStep::OutputFormat::ErrorMessage);
emit addTask(DeploymentTask(Task::Error, errorMessage), 1);
}
void WinRtPackageDeploymentStep::raiseWarning(const QString &warningMessage)
{
emit addOutput(warningMessage, BuildStep::OutputFormat::NormalMessage);
emit addTask(DeploymentTask(Task::Warning, warningMessage), 1);
}
bool WinRtPackageDeploymentStep::parseIconsAndExecutableFromManifest(QString manifestFileName, QStringList *icons, QString *executable)
{
if (!icons->isEmpty())
icons->clear();
QFile manifestFile(manifestFileName);
if (!manifestFile.open(QFile::ReadOnly))
return false;
const QString contents = QString::fromUtf8(manifestFile.readAll());
QRegularExpression iconPattern(QStringLiteral("[\\\\/a-zA-Z0-9_\\-\\!]*\\.(png|jpg|jpeg)"));
QRegularExpressionMatchIterator iterator = iconPattern.globalMatch(contents);
while (iterator.hasNext()) {
QRegularExpressionMatch match = iterator.next();
const QString icon = match.captured(0);
icons->append(icon);
}
const QLatin1String executablePrefix(manifestFileName.contains(QLatin1String("AppxManifest")) ? "Executable=" : "ImagePath=");
QRegularExpression executablePattern(executablePrefix + QStringLiteral("\"([a-zA-Z0-9_-]*\\.exe)\""));
QRegularExpressionMatch match = executablePattern.match(contents);
if (!match.hasMatch())
return false;
*executable = match.captured(1);
return true;
}
// WinRtDeployStepFactory
WinRtDeployStepFactory::WinRtDeployStepFactory()
{
registerStep<WinRtPackageDeploymentStep>(Constants::WINRT_BUILD_STEP_DEPLOY);
setDisplayName(QCoreApplication::translate("WinRt::Internal::WinRtDeployStepFactory", "Run windeployqt"));
setFlags(BuildStepInfo::Unclonable);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
setSupportedDeviceTypes({Constants::WINRT_DEVICE_TYPE_LOCAL,
Constants::WINRT_DEVICE_TYPE_EMULATOR,
Constants::WINRT_DEVICE_TYPE_PHONE});
setRepeatable(false);
}
} // namespace Internal
} // namespace WinRt

View File

@@ -1,40 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <projectexplorer/buildstep.h>
namespace WinRt {
namespace Internal {
class WinRtDeployStepFactory final : public ProjectExplorer::BuildStepFactory
{
public:
WinRtDeployStepFactory();
};
} // namespace Internal
} // namespace WinRt

View File

@@ -1,70 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "winrtphoneqtversion.h"
#include "winrtconstants.h"
#include <qtsupport/qtsupportconstants.h>
#include <utils/id.h>
#include <QSet>
namespace WinRt {
namespace Internal {
QString WinRtPhoneQtVersion::description() const
{
return tr("Windows Phone");
}
QSet<Utils::Id> WinRtPhoneQtVersion::targetDeviceTypes() const
{
return {Constants::WINRT_DEVICE_TYPE_PHONE, Constants::WINRT_DEVICE_TYPE_EMULATOR};
}
QSet<Utils::Id> WinRtPhoneQtVersion::availableFeatures() const
{
QSet<Utils::Id> features = QtSupport::QtVersion::availableFeatures();
features.insert(QtSupport::Constants::FEATURE_MOBILE);
features.remove(QtSupport::Constants::FEATURE_QT_CONSOLE);
features.remove(Utils::Id::versionedId(QtSupport::Constants::FEATURE_QT_QUICK_CONTROLS_PREFIX, 1));
features.remove(QtSupport::Constants::FEATURE_QT_WEBKIT);
return features;
}
// Factory
WinRtPhoneQtVersionFactory::WinRtPhoneQtVersionFactory()
{
setQtVersionCreator([] { return new WinRtPhoneQtVersion; });
setSupportedType(Constants::WINRT_WINPHONEQT);
setRestrictionChecker([](const SetupData &setup) { return setup.platforms.contains("winphone"); });
setPriority(10);
}
} // Internal
} // WinRt

View File

@@ -1,52 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include "winrtqtversion.h"
namespace WinRt {
namespace Internal {
class WinRtPhoneQtVersion : public QtSupport::QtVersion
{
Q_DECLARE_TR_FUNCTIONS(WinRt::Internal::WinRtQtVersion)
public:
WinRtPhoneQtVersion() = default;
QSet<Utils::Id> availableFeatures() const override;
QString description() const override;
QSet<Utils::Id> targetDeviceTypes() const override;
};
class WinRtPhoneQtVersionFactory : public QtSupport::QtVersionFactory
{
public:
WinRtPhoneQtVersionFactory();
};
} // Internal
} // WinRt

View File

@@ -1,92 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "winrtplugin.h"
#include "winrtconstants.h"
#include "winrtdebugsupport.h"
#include "winrtdeployconfiguration.h"
#include "winrtdevice.h"
#include "winrtpackagedeploymentstep.h"
#include "winrtphoneqtversion.h"
#include "winrtqtversion.h"
#include "winrtrunconfiguration.h"
#include "winrtruncontrol.h"
#include <projectexplorer/devicesupport/devicemanager.h>
#include <projectexplorer/devicesupport/idevice.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/target.h>
using namespace ProjectExplorer;
namespace WinRt {
namespace Internal {
class WinRtPluginPrivate
{
public:
WinRtRunConfigurationFactory runConfigFactory;
WinRtQtVersionFactory qtVersionFactory;
WinRtPhoneQtVersionFactory phoneQtVersionFactory;
WinRtAppDeployConfigurationFactory appDeployConfigFactory;
WinRtPhoneDeployConfigurationFactory phoneDeployConfigFactory;
WinRtEmulatorDeployConfigurationFactory emulatorDeployFactory;
WinRtDeployStepFactory deployStepFactory;
WinRtDeviceFactory localDeviceFactory{Constants::WINRT_DEVICE_TYPE_LOCAL};
WinRtDeviceFactory phoneDeviceFactory{Constants::WINRT_DEVICE_TYPE_PHONE};
WinRtDeviceFactory emulatorDeviceFactory{Constants::WINRT_DEVICE_TYPE_EMULATOR};
RunWorkerFactory runWorkerFactory{
RunWorkerFactory::make<WinRtRunner>(),
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
{runConfigFactory.runConfigurationId()}
};
RunWorkerFactory debugWorkerFactory{
RunWorkerFactory::make<WinRtDebugSupport>(),
{ProjectExplorer::Constants::DEBUG_RUN_MODE},
{runConfigFactory.runConfigurationId()},
{Internal::Constants::WINRT_DEVICE_TYPE_LOCAL}
};
};
WinRtPlugin::~WinRtPlugin()
{
delete d;
}
bool WinRtPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
Q_UNUSED(arguments)
Q_UNUSED(errorMessage)
d = new WinRtPluginPrivate;
return true;
}
} // namespace Internal
} // namespace WinRt

View File

@@ -1,48 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <extensionsystem/iplugin.h>
namespace WinRt {
namespace Internal {
class WinRtPlugin final : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "WinRt.json")
public:
~WinRtPlugin() final;
private:
bool initialize(const QStringList &arguments, QString *errorMessage) final;
class WinRtPluginPrivate *d = nullptr;
};
} // namespace Internal
} // namespace WinRt

View File

@@ -1,68 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "winrtqtversion.h"
#include "winrtconstants.h"
#include <coreplugin/featureprovider.h>
#include <qtsupport/qtsupportconstants.h>
namespace WinRt {
namespace Internal {
QString WinRtQtVersion::description() const
{
return tr("Windows Runtime");
}
QSet<Utils::Id> WinRtQtVersion::availableFeatures() const
{
QSet<Utils::Id> features = QtSupport::QtVersion::availableFeatures();
features.insert(QtSupport::Constants::FEATURE_MOBILE);
features.remove(QtSupport::Constants::FEATURE_QT_CONSOLE);
features.remove(Utils::Id::versionedId(QtSupport::Constants::FEATURE_QT_QUICK_CONTROLS_PREFIX, 1));
features.remove(QtSupport::Constants::FEATURE_QT_WEBKIT);
return features;
}
QSet<Utils::Id> WinRtQtVersion::targetDeviceTypes() const
{
return {Constants::WINRT_DEVICE_TYPE_LOCAL, Constants::WINRT_DEVICE_TYPE_EMULATOR};
}
// Factory
WinRtQtVersionFactory::WinRtQtVersionFactory()
{
setQtVersionCreator([] { return new WinRtQtVersion; });
setSupportedType(Constants::WINRT_WINRTQT);
setRestrictionChecker([](const SetupData &setup) { return setup.platforms.contains("winrt"); });
setPriority(10);
}
} // Internal
} // WinRt

View File

@@ -1,53 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtversionfactory.h>
namespace WinRt {
namespace Internal {
class WinRtQtVersion : public QtSupport::QtVersion
{
Q_DECLARE_TR_FUNCTIONS(WinRt::Internal::WinRtQtVersion)
public:
WinRtQtVersion() = default;
QString description() const override;
QSet<Utils::Id> availableFeatures() const override;
QSet<Utils::Id> targetDeviceTypes() const override;
};
class WinRtQtVersionFactory : public QtSupport::QtVersionFactory
{
public:
WinRtQtVersionFactory();
};
} // Internal
} // WinRt

View File

@@ -1,94 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "winrtrunconfiguration.h"
#include "winrtconstants.h"
#include <projectexplorer/target.h>
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtkitinformation.h>
using namespace ProjectExplorer;
namespace WinRt {
namespace Internal {
// UninstallAfterStopAspect
UninstallAfterStopAspect::UninstallAfterStopAspect()
: BoolAspect("WinRtRunConfigurationUninstallAfterStopId")
{
setLabel(WinRtRunConfiguration::tr("Uninstall package after application stops"),
LabelPlacement::AtCheckBox);
}
// LoopbackExemptClientAspect
LoopbackExemptClientAspect::LoopbackExemptClientAspect()
: BoolAspect("WinRtRunConfigurationLoopbackExemptClient")
{
setLabel(WinRtRunConfiguration::tr("Enable localhost communication for clients"),
LabelPlacement::AtCheckBox);
}
// LoopbackExemptServerAspect
LoopbackExemptServerAspect::LoopbackExemptServerAspect()
: BoolAspect("WinRtRunConfigurationLoopbackExemptServer")
{
setLabel(WinRtRunConfiguration::tr("Enable localhost communication for "
"servers (requires elevated rights)"),
LabelPlacement::AtCheckBox);
}
// WinRtRunConfiguration
WinRtRunConfiguration::WinRtRunConfiguration(Target *target, Utils::Id id)
: RunConfiguration(target, id)
{
setDisplayName(tr("Run App Package"));
addAspect<ArgumentsAspect>();
addAspect<UninstallAfterStopAspect>();
const QtSupport::QtVersion *qt
= QtSupport::QtKitAspect::qtVersion(target->kit());
if (qt && qt->qtVersion() >= QtSupport::QtVersionNumber(5, 12, 0)) {
addAspect<LoopbackExemptClientAspect>();
addAspect<LoopbackExemptServerAspect>();
}
}
// WinRtRunConfigurationFactory
WinRtRunConfigurationFactory::WinRtRunConfigurationFactory()
{
registerRunConfiguration<WinRtRunConfiguration>("WinRt.WinRtRunConfiguration:");
addSupportedTargetDeviceType(Constants::WINRT_DEVICE_TYPE_LOCAL);
addSupportedTargetDeviceType(Constants::WINRT_DEVICE_TYPE_PHONE);
addSupportedTargetDeviceType(Constants::WINRT_DEVICE_TYPE_EMULATOR);
}
} // namespace Internal
} // namespace WinRt

View File

@@ -1,72 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <projectexplorer/runconfigurationaspects.h>
namespace WinRt {
namespace Internal {
class UninstallAfterStopAspect : public Utils::BoolAspect
{
Q_OBJECT
public:
UninstallAfterStopAspect();
};
class LoopbackExemptClientAspect : public Utils::BoolAspect
{
Q_OBJECT
public:
LoopbackExemptClientAspect();
};
class LoopbackExemptServerAspect : public Utils::BoolAspect
{
Q_OBJECT
public:
LoopbackExemptServerAspect();
};
class WinRtRunConfiguration : public ProjectExplorer::RunConfiguration
{
Q_OBJECT
public:
WinRtRunConfiguration(ProjectExplorer::Target *target, Utils::Id id);
};
class WinRtRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory
{
public:
WinRtRunConfigurationFactory();
};
} // namespace Internal
} // namespace WinRt

View File

@@ -1,110 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "winrtruncontrol.h"
#include "winrtdevice.h"
#include "winrtrunconfiguration.h"
#include "winrtrunnerhelper.h"
#include <coreplugin/idocument.h>
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/buildtargetinfo.h>
#include <projectexplorer/target.h>
#include <projectexplorer/project.h>
#include <projectexplorer/kitinformation.h>
#include <qtsupport/qtkitinformation.h>
#include <utils/utilsicons.h>
#include <QTimer>
using ProjectExplorer::DeviceKitAspect;
using ProjectExplorer::IDevice;
using ProjectExplorer::RunControl;
using Utils::Id;
using ProjectExplorer::Target;
namespace WinRt {
namespace Internal {
WinRtRunner::WinRtRunner(RunControl *runControl)
: RunWorker(runControl)
{
runControl->setIcon(Utils::Icons::RUN_SMALL_TOOLBAR);
}
void WinRtRunner::start()
{
if (m_state != StoppedState)
return;
QTC_ASSERT(!m_runner, m_state = StoppedState; reportFailure(); return);
QString errorMessage;
m_runner = new WinRtRunnerHelper(this, &errorMessage);
if (!errorMessage.isEmpty()) {
reportFailure(errorMessage);
return;
}
connect(m_runner, &WinRtRunnerHelper::started, this, &WinRtRunner::onProcessStarted);
connect(m_runner, &WinRtRunnerHelper::finished, this, &WinRtRunner::onProcessFinished);
connect(m_runner, &WinRtRunnerHelper::error, this, &WinRtRunner::onProcessError);
m_state = StartingState;
m_runner->start();
}
void WinRtRunner::stop()
{
if (m_state == StoppedState)
return;
m_runner->stop();
}
void WinRtRunner::onProcessStarted()
{
QTC_CHECK(m_state == StartingState);
m_state = StartedState;
reportStarted();
}
void WinRtRunner::onProcessFinished()
{
QTC_CHECK(m_state == StartedState);
onProcessError();
}
void WinRtRunner::onProcessError()
{
QTC_ASSERT(m_runner, return);
m_runner->disconnect();
m_runner->deleteLater();
m_runner = nullptr;
m_state = StoppedState;
reportStopped();
}
} // namespace Internal
} // namespace WinRt

View File

@@ -1,58 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include "winrtdevice.h"
#include <projectexplorer/runcontrol.h>
namespace WinRt {
namespace Internal {
class WinRtRunnerHelper;
class WinRtRunner : public ProjectExplorer::RunWorker
{
Q_OBJECT
public:
explicit WinRtRunner(ProjectExplorer::RunControl *runControl);
void start() override;
void stop() override;
private:
enum State { StartingState, StartedState, StoppedState };
void onProcessStarted();
void onProcessFinished();
void onProcessError();
State m_state = StoppedState;
WinRtRunnerHelper *m_runner = nullptr;
};
} // namespace Internal
} // namespace WinRt

View File

@@ -1,225 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "winrtrunnerhelper.h"
#include "winrtconstants.h"
#include "winrtrunconfiguration.h"
#include <coreplugin/idocument.h>
#include <projectexplorer/buildtargetinfo.h>
#include <projectexplorer/devicesupport/idevice.h>
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/project.h>
#include <projectexplorer/runcontrol.h>
#include <projectexplorer/target.h>
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtkitinformation.h>
#include <utils/qtcprocess.h>
#include <QDir>
using namespace ProjectExplorer;
using namespace WinRt;
using namespace WinRt::Internal;
WinRtRunnerHelper::WinRtRunnerHelper(ProjectExplorer::RunWorker *runWorker, QString *errorMessage)
: QObject(runWorker)
, m_worker(runWorker)
{
auto runControl = runWorker->runControl();
m_device = runWorker->device().dynamicCast<const WinRtDevice>();
const QtSupport::QtVersion *qt = QtSupport::QtKitAspect::qtVersion(runControl->kit());
if (!qt) {
*errorMessage = tr("The current kit has no Qt version.");
return;
}
m_runnerFilePath = qt->hostBinPath().toString() + QStringLiteral("/winrtrunner.exe");
if (!QFile::exists(m_runnerFilePath)) {
*errorMessage = tr("Cannot find winrtrunner.exe in \"%1\".").arg(
QDir::toNativeSeparators(qt->hostBinPath().toString()));
return;
}
m_executableFilePath = runControl->targetFilePath();
if (m_executableFilePath.isEmpty()) {
*errorMessage = tr("Cannot determine the executable file path for \"%1\".")
.arg(runControl->projectFilePath().toUserOutput());
return;
}
// ### we should not need to append ".exe" here.
if (!m_executableFilePath.endsWith(QLatin1String(".exe")))
m_executableFilePath = m_executableFilePath + QStringLiteral(".exe");
bool loopbackExemptClient = false;
bool loopbackExemptServer = false;
if (auto aspect = runControl->aspect<ArgumentsAspect>())
m_arguments = aspect->arguments(runControl->macroExpander());
if (auto aspect = runControl->aspect<UninstallAfterStopAspect>())
m_uninstallAfterStop = aspect->value();
if (auto aspect = runControl->aspect<LoopbackExemptClientAspect>())
loopbackExemptClient = aspect->value();
if (auto aspect = runControl->aspect<LoopbackExemptServerAspect>())
loopbackExemptServer = aspect->value();
if (loopbackExemptClient && loopbackExemptServer)
m_loopbackArguments = QStringList{"--loopbackexempt", "clientserver"};
else if (loopbackExemptClient)
m_loopbackArguments = QStringList{"--loopbackexempt", "client"};
else if (loopbackExemptServer)
m_loopbackArguments = QStringList{"--loopbackexempt", "server"};
}
void WinRtRunnerHelper::appendMessage(const QString &message, Utils::OutputFormat format)
{
QTC_ASSERT(m_worker, return);
m_worker->appendMessage(message, format);
}
void WinRtRunnerHelper::debug(const QString &debuggerExecutable, const QString &debuggerArguments)
{
m_debuggerExecutable = debuggerExecutable;
m_debuggerArguments = debuggerArguments;
startWinRtRunner(Debug);
}
void WinRtRunnerHelper::start()
{
startWinRtRunner(Start);
}
void WinRtRunnerHelper::stop()
{
if (m_process)
m_process->interrupt();
else
startWinRtRunner(Stop);
}
bool WinRtRunnerHelper::waitForStarted(int msecs)
{
QTC_ASSERT(m_process, return false);
return m_process->waitForStarted(msecs);
}
void WinRtRunnerHelper::onProcessReadyReadStdOut()
{
QTC_ASSERT(m_process, return);
appendMessage(QString::fromLocal8Bit(m_process->readAllStandardOutput()), Utils::StdOutFormat);
}
void WinRtRunnerHelper::onProcessReadyReadStdErr()
{
QTC_ASSERT(m_process, return);
appendMessage(QString::fromLocal8Bit(m_process->readAllStandardError()), Utils::StdErrFormat);
}
void WinRtRunnerHelper::onProcessFinished()
{
QTC_ASSERT(m_process, return);
m_process->disconnect();
m_process->deleteLater();
m_process = nullptr;
emit finished();
}
void WinRtRunnerHelper::onProcessError(QProcess::ProcessError processError)
{
QTC_ASSERT(m_process, return);
appendMessage(tr("Error while executing the WinRT Runner Tool: %1\n").arg(
m_process->errorString()), Utils::ErrorMessageFormat);
m_process->disconnect();
m_process->deleteLater();
m_process = nullptr;
emit error(processError);
}
void WinRtRunnerHelper::startWinRtRunner(const RunConf &conf)
{
using namespace Utils;
CommandLine cmdLine(FilePath::fromString(m_runnerFilePath), {});
if (m_device) {
cmdLine.addArg("--device");
cmdLine.addArg(QString::number(m_device->deviceId()));
}
QtcProcess *process = nullptr;
bool connectProcess = false;
switch (conf) {
case Debug:
cmdLine.addArg("--debug");
cmdLine.addArg(m_debuggerExecutable);
if (!m_debuggerArguments.isEmpty()) {
cmdLine.addArg("--debugger-arguments");
cmdLine.addArg(m_debuggerArguments);
}
Q_FALLTHROUGH();
case Start:
cmdLine.addArgs({"--start", "--stop", "--wait", "0"});
connectProcess = true;
QTC_ASSERT(!m_process, m_process->deleteLater());
m_process = new QtcProcess(this);
process = m_process;
break;
case Stop:
cmdLine.addArg("--stop");
process = new QtcProcess(this);
break;
}
if (m_device->type() == Constants::WINRT_DEVICE_TYPE_LOCAL)
cmdLine.addArgs({"--profile", "appx"});
else if (m_device->type() == Constants::WINRT_DEVICE_TYPE_PHONE ||
m_device->type() == Constants::WINRT_DEVICE_TYPE_EMULATOR)
cmdLine.addArgs({"--profile", "appxphone"});
cmdLine.addArgs(m_loopbackArguments);
cmdLine.addArg(m_executableFilePath.toString());
cmdLine.addArgs(m_arguments, CommandLine::Raw);
appendMessage(cmdLine.toUserOutput(), NormalMessageFormat);
if (connectProcess) {
connect(process, &QtcProcess::started, this, &WinRtRunnerHelper::started);
connect(process, &QtcProcess::finished, this, &WinRtRunnerHelper::onProcessFinished);
connect(process, &QtcProcess::errorOccurred, this, &WinRtRunnerHelper::onProcessError);
connect(process, &QtcProcess::readyReadStandardOutput, this, &WinRtRunnerHelper::onProcessReadyReadStdOut);
connect(process, &QtcProcess::readyReadStandardError, this, &WinRtRunnerHelper::onProcessReadyReadStdErr);
}
process->setUseCtrlCStub(true);
process->setCommand(cmdLine);
process->setEnvironment(m_worker->runControl()->buildEnvironment());
process->setWorkingDirectory(m_executableFilePath.absolutePath());
process->start();
}

View File

@@ -1,86 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include "winrtdevice.h"
#include <utils/environment.h>
#include <utils/filepath.h>
#include <utils/outputformat.h>
#include <QObject>
#include <QProcess>
namespace Utils { class QtcProcess; }
namespace ProjectExplorer { class RunWorker; }
namespace WinRt {
namespace Internal {
class WinRtRunnerHelper : public QObject
{
Q_OBJECT
public:
WinRtRunnerHelper(ProjectExplorer::RunWorker *runWorker, QString *errorMessage);
void debug(const QString &debuggerExecutable, const QString &debuggerArguments = QString());
void start();
void stop();
bool waitForStarted(int msecs = 10000);
signals:
void started();
void finished();
void error(QProcess::ProcessError error);
private:
enum RunConf { Start, Stop, Debug };
void onProcessReadyReadStdOut();
void onProcessReadyReadStdErr();
void onProcessFinished();
void onProcessError(QProcess::ProcessError processError);
void startWinRtRunner(const RunConf &conf);
void appendMessage(const QString &message, Utils::OutputFormat format);
ProjectExplorer::RunWorker *m_worker = nullptr;
WinRtDevice::ConstPtr m_device;
QString m_runnerFilePath;
Utils::FilePath m_executableFilePath;
QString m_debuggerExecutable;
QString m_debuggerArguments;
QString m_arguments;
QStringList m_loopbackArguments;
bool m_uninstallAfterStop = false;
Utils::QtcProcess *m_process = nullptr;
};
} // namespace WinRt
} // namespace Internal

View File

@@ -46,7 +46,6 @@ add_subdirectory(screenshotcropper)
add_subdirectory(sdktool)
add_subdirectory(valgrindfake)
add_subdirectory(wininterrupt) ## windows only
add_subdirectory(winrtdebughelper) ## windows only
if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/perfparser/CMakeLists.txt)
add_subdirectory(perfparser)

View File

@@ -9920,43 +9920,6 @@
d="m 579.5,371.5 h 2.5 m -1.48438,-1.54688 -0.0227,2.94133 c 0.002,0.96521 0.83838,0.77673 1.50706,0.60555 m -3.69064,0 1.19887,1.38951 M 577.5,370.5 c 1,0 1,0.28518 1,1.5 0,1.21481 0,1.5 -1,1.5 -1,0 -1,-0.30273 -1,-1.5 0,-1.19726 0,-1.5 1,-1.5 z"
id="path6333" />
</g>
<g
id="src/plugins/winrt/images/winrtdevice"
transform="translate(-206,-74)">
<use
transform="translate(561,337)"
style="display:inline"
x="0"
y="0"
xlink:href="#backgroundRect_32_28"
id="use5913-0-8-1-5-6-8-11"
width="100%"
height="100%" />
<path
sodipodi:nodetypes="cccccccccccccccccccc"
style="fill:#000000;fill-opacity:1"
inkscape:connector-curvature="0"
d="m 607,391 h 10 v -10.16502 l -10,1.1313 z m 12,-10.3911 V 391 h 12 v -11.74108 z m 0,22.75938 12,1.34794 V 393 h -12 z m -12,-1.35943 10,1.12952 V 393 h -10 z"
id="path5333-0" />
</g>
<g
id="src/plugins/winrt/images/winrtdevicesmall"
transform="translate(-238,-58)">
<use
x="0"
y="0"
xlink:href="#backgroundRect"
id="use6054-3"
width="100%"
height="100%"
transform="translate(650,-41)" />
<path
sodipodi:nodetypes="cccccccccccccccccccc"
style="fill:#000000;fill-opacity:1"
inkscape:connector-curvature="0"
d="M 636.00003,403 H 641 v -4.67861 l -4.99997,0.67433 z M 642,398.18129 V 403 h 6.00003 v -5.6287 z m 0,10.72061 6.00003,0.81345 V 404 H 642 Z M 636.00003,408.09093 641,408.7667 V 404 h -4.99997 z"
id="path5333" />
</g>
<g
id="src/plugins/debugger/images/debugger_stop_mask"
transform="translate(-711,333)"

Before

Width:  |  Height:  |  Size: 365 KiB

After

Width:  |  Height:  |  Size: 364 KiB

View File

@@ -16,7 +16,6 @@ Project {
"sdktool/sdktool.qbs",
"valgrindfake/valgrindfake.qbs",
"iostool/iostool.qbs",
"winrtdebughelper/winrtdebughelper.qbs"
].concat(project.additionalTools)
Project {

View File

@@ -1,8 +0,0 @@
if (NOT WIN32)
return()
endif()
add_qtc_executable(winrtdebughelper
SOURCES
winrtdebughelper.cpp
)

View File

@@ -1,74 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int pid = -1;
const size_t maxPipeNameSize = 256;
wchar_t pipeName[maxPipeNameSize] = {0};
for (int i = 0; i < argc - 1; ++i) {
if (!strcmp(argv[i], "-t")) {
++i;
if (swprintf(pipeName, maxPipeNameSize, L"%hs", argv[i]) < 0)
return 0; // Pipe name too long
} else if (!strcmp(argv[i], "-p")) {
++i;
// check if -p is followed by a number
const char *pidString = argv[i];
char *end;
pid = strtoul(pidString, &end, 0);
if (*end != 0)
return 0;
}
}
if (pid < 0)
return 0;
if (*pipeName == 0)
swprintf(pipeName, maxPipeNameSize, L"\\\\.\\pipe\\QtCreatorWinRtDebugPIDPipe");
HANDLE pipe;
while (true) {
pipe = CreateFile(pipeName, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
if (pipe != INVALID_HANDLE_VALUE)
break;
if ((GetLastError() != ERROR_PIPE_BUSY) || (!WaitNamedPipe(pipeName, 10000)))
return 0;
}
const size_t msgBufferSize = 15;
char pidMessageBuffer[msgBufferSize];
int length = sprintf_s(pidMessageBuffer, msgBufferSize, "PID:%d", pid);
if (length >= 0)
WriteFile(pipe, pidMessageBuffer, length, NULL, NULL);
return 0;
}

View File

@@ -1,12 +0,0 @@
import qbs 1.0
QtcTool {
name: "winrtdebughelper"
condition: qbs.targetOS.contains("windows")
Depends { name: "Qt.network" }
files: [
"winrtdebughelper.cpp",
]
}