diff options
author | Jake Petroules <jake.petroules@theqtcompany.com> | 2015-09-20 01:14:11 -0700 |
---|---|---|
committer | Jake Petroules <jake.petroules@theqtcompany.com> | 2015-10-21 17:36:40 +0000 |
commit | 37941caa354c7cf381981d8ad077fe327de18305 (patch) | |
tree | 43189771038629dbe0e7a6084faaa22f6d3fbf55 /src/lib/corelib/api/runenvironment.cpp | |
parent | f28db825763f8346ea1bb7ee3ad29d2e4e71ab44 (diff) |
Add support for running iOS apps on devices.
Change-Id: I86c8278545aa90663719ea1d67d564a04f4e703f
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Diffstat (limited to 'src/lib/corelib/api/runenvironment.cpp')
-rw-r--r-- | src/lib/corelib/api/runenvironment.cpp | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/src/lib/corelib/api/runenvironment.cpp b/src/lib/corelib/api/runenvironment.cpp index 94272e0d2..e0f0a0c91 100644 --- a/src/lib/corelib/api/runenvironment.cpp +++ b/src/lib/corelib/api/runenvironment.cpp @@ -38,10 +38,12 @@ #include <logging/logger.h> #include <logging/translator.h> #include <tools/error.h> +#include <tools/fileinfo.h> #include <tools/hostosinfo.h> #include <tools/installoptions.h> #include <tools/preferences.h> #include <tools/propertyfinder.h> +#include <tools/qbsassert.h> #include <tools/shellutils.h> #include <QDir> @@ -170,7 +172,52 @@ int RunEnvironment::runTarget(const QString &targetBin, const QStringList &argum QStringList targetArguments = arguments; const QString completeSuffix = QFileInfo(targetBin).completeSuffix(); - if (targetOS.contains(QLatin1String("windows"))) { + if (targetOS.contains(QLatin1String("ios"))) { + QString bundlePath = d->resolvedProduct->buildDirectory(); + const bool install = PropertyFinder().propertyValue( + d->resolvedProduct->moduleProperties->value(), + QLatin1String("qbs"), + QLatin1String("install")).toBool(); + if (install) { + bundlePath = d->installOptions.installRoot(); + const QString installDir = PropertyFinder().propertyValue( + d->resolvedProduct->moduleProperties->value(), + QLatin1String("qbs"), + QLatin1String("installDir")).toString(); + bundlePath += QLatin1Char('/') + installDir; + } + + const QString bundleName = PropertyFinder().propertyValue( + d->resolvedProduct->moduleProperties->value(), + QLatin1String("bundle"), + QLatin1String("bundleName")).toString(); + bundlePath += QLatin1Char('/') + bundleName; + + QBS_CHECK(targetExecutable.startsWith(bundlePath)); + + if (QFileInfo(targetExecutable = findExecutable(QStringList() + << QStringLiteral("iostool"))).isExecutable()) { + targetArguments = QStringList() + << QStringLiteral("-run") + << QStringLiteral("-bundle") + << QDir::cleanPath(bundlePath); + if (!arguments.isEmpty()) + targetArguments << QStringLiteral("-extra-args") << arguments; + } else if (QFileInfo(targetExecutable = findExecutable(QStringList() + << QStringLiteral("ios-deploy"))).isExecutable()) { + targetArguments = QStringList() + << QStringLiteral("--noninteractive") + << QStringLiteral("--bundle") + << QDir::cleanPath(bundlePath); + if (!arguments.isEmpty()) + targetArguments << QStringLiteral("--args") << arguments; + } else { + d->logger.qbsLog(LoggerError) + << Tr::tr("No suitable iOS deployment tools were found in the environment. " + "Consider installing ios-deploy."); + return EXIT_FAILURE; + } + } else if (targetOS.contains(QLatin1String("windows"))) { if (completeSuffix == QLatin1String("msi")) { targetExecutable = QLatin1String("msiexec"); targetArguments.prepend(QDir::toNativeSeparators(targetBin)); |