summaryrefslogtreecommitdiff
path: root/src/winrtrunner/appxphoneengine.cpp
diff options
context:
space:
mode:
authorMaurice Kalinowski <maurice.kalinowski@qt.io>2016-07-20 12:42:12 +0200
committerMaurice Kalinowski <maurice.kalinowski@qt.io>2016-07-20 14:22:32 +0000
commitfa17fe6d16891a786dfa457a3c13856ebe74925f (patch)
tree3a850da005f3076895a08de256cab0d67918ce97 /src/winrtrunner/appxphoneengine.cpp
parentc24403b1dbe8d1b7bc27e2d1e11fd5cddd4ae1b9 (diff)
downloadqttools-fa17fe6d16891a786dfa457a3c13856ebe74925f.tar.gz
winrtrunner: Add support for installing packages
So far winrtrunner was only capable of creating a package manually, not to specify a package to install. This can be very helpful for testing purposes. Change-Id: Idecbea3c3413662a1f42f60fec60832eac7e7626 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/winrtrunner/appxphoneengine.cpp')
-rw-r--r--src/winrtrunner/appxphoneengine.cpp39
1 files changed, 22 insertions, 17 deletions
diff --git a/src/winrtrunner/appxphoneengine.cpp b/src/winrtrunner/appxphoneengine.cpp
index a71d03936..fb78e350b 100644
--- a/src/winrtrunner/appxphoneengine.cpp
+++ b/src/winrtrunner/appxphoneengine.cpp
@@ -224,8 +224,14 @@ AppxPhoneEngine::AppxPhoneEngine(Runner *runner)
d->hasFatalError = true;
ComPtr<IStream> manifestStream;
- HRESULT hr = SHCreateStreamOnFile(wchar(d->manifest), STGM_READ, &manifestStream);
- RETURN_VOID_IF_FAILED("Failed to open manifest stream");
+ HRESULT hr;
+ if (d->manifestReader) {
+ hr = d->manifestReader->GetStream(&manifestStream);
+ RETURN_VOID_IF_FAILED("Failed to query manifest stream from manifest reader.");
+ } else {
+ hr = SHCreateStreamOnFile(wchar(d->manifest), STGM_READ, &manifestStream);
+ RETURN_VOID_IF_FAILED("Failed to open manifest stream");
+ }
if (!getPhoneProductId(manifestStream.Get(), &d->productId)) {
qCWarning(lcWinRtRunner) << "Failed to read phone product ID from the manifest.";
@@ -393,23 +399,22 @@ bool AppxPhoneEngine::install(bool removeFirst)
if (!installDependencies())
return false;
- const QDir base = QFileInfo(d->manifest).absoluteDir();
- const QString packageFileName = base.absoluteFilePath(d->packageFamilyName + QStringLiteral(".appx"));
- if (!createPackage(packageFileName))
- return false;
-
- if (!sign(packageFileName))
- return false;
-
- ComPtr<IStream> manifestStream;
- hr = SHCreateStreamOnFile(wchar(d->manifest), STGM_READ, &manifestStream);
- RETURN_FALSE_IF_FAILED("Failed to open manifest stream");
+ const QDir base = QFileInfo(d->executable).absoluteDir();
+ const bool existingPackage = d->runner->app().endsWith(QLatin1String(".appx"));
+ const QString packageFileName = existingPackage
+ ? d->runner->app()
+ : base.absoluteFilePath(d->packageFamilyName + QStringLiteral(".appx"));
+ if (!existingPackage) {
+ if (!createPackage(packageFileName))
+ return false;
- ComPtr<IAppxManifestReader> manifestReader;
- hr = d->packageFactory->CreateManifestReader(manifestStream.Get(), &manifestReader);
- RETURN_FALSE_IF_FAILED("Failed to create manifest reader for installation");
+ if (!sign(packageFileName))
+ return false;
+ } else {
+ qCDebug(lcWinRtRunner) << "Installing existing package.";
+ }
- return installPackage(manifestReader.Get(), packageFileName);
+ return installPackage(d->manifestReader.Get(), packageFileName);
}
bool AppxPhoneEngine::remove()