diff options
author | Jake Petroules <jake.petroules@qt.io> | 2017-06-26 10:32:13 -0700 |
---|---|---|
committer | Jake Petroules <jake.petroules@qt.io> | 2017-06-27 16:35:00 +0000 |
commit | 9edb9f9de409f488c920fb295a0674f2bad5ff17 (patch) | |
tree | 78b4e6b9acc9bc3ad24dbf9ae595f318b6c767aa /src/lib/corelib | |
parent | 7e0191856b3c76517a2654183b52192713ff5770 (diff) |
Fix running bundled applications on Apple platforms
Previously, Qbs would attempt to run the temporary copy of the
application executable in the .tmp/ subdirectory of the product build
directory. This patch corrects it so that it is run via the copy in the
install root, or the actual bundle executable in the build directory.
Change-Id: I988081e3f70ec52965e798c8193b75c2dcc4fdf9
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/lib/corelib')
-rw-r--r-- | src/lib/corelib/api/projectdata.cpp | 10 | ||||
-rw-r--r-- | src/lib/corelib/api/runenvironment.cpp | 21 |
2 files changed, 13 insertions, 18 deletions
diff --git a/src/lib/corelib/api/projectdata.cpp b/src/lib/corelib/api/projectdata.cpp index 961ce075c..475861e5b 100644 --- a/src/lib/corelib/api/projectdata.cpp +++ b/src/lib/corelib/api/projectdata.cpp @@ -537,6 +537,16 @@ QList<ArtifactData> ProductData::installableArtifacts() const QString ProductData::targetExecutable() const { QBS_ASSERT(isValid(), return QString()); + if (d->moduleProperties.getModuleProperty(QLatin1String("bundle"), + QLatin1String("isBundle")).toBool()) { + for (const ArtifactData &ta : targetArtifacts()) { + if (ta.fileTags().contains(QLatin1String("bundle.application-executable"))) { + if (ta.installData().isInstallable()) + return ta.installData().localInstallFilePath(); + return ta.filePath(); + } + } + } for (const ArtifactData &ta : targetArtifacts()) { if (ta.isExecutable()) { if (ta.installData().isInstallable()) diff --git a/src/lib/corelib/api/runenvironment.cpp b/src/lib/corelib/api/runenvironment.cpp index 4c4b4e681..96484815b 100644 --- a/src/lib/corelib/api/runenvironment.cpp +++ b/src/lib/corelib/api/runenvironment.cpp @@ -219,23 +219,8 @@ int RunEnvironment::doRunTarget(const QString &targetBin, const QStringList &arg QStringList targetArguments = arguments; const QString completeSuffix = QFileInfo(targetBin).completeSuffix(); - if (targetOS.contains(QLatin1String("ios"))) { - QString bundlePath = d->resolvedProduct->buildDirectory(); - const bool install = d->resolvedProduct->moduleProperties->qbsPropertyValue( - QLatin1String("install")).toBool(); - if (install) { - bundlePath = d->installOptions.installRoot(); - const QString installDir = d->resolvedProduct->moduleProperties->qbsPropertyValue( - QLatin1String("installDir")).toString(); - bundlePath += QLatin1Char('/') + installDir; - } - - const QString bundleName = d->resolvedProduct->moduleProperties->moduleProperty( - QLatin1String("bundle"), - QLatin1String("bundleName")).toString(); - bundlePath += QLatin1Char('/') + bundleName; - - QBS_CHECK(targetExecutable.startsWith(bundlePath)); + if (targetOS.contains(QLatin1String("ios")) || targetOS.contains(QLatin1String("tvos"))) { + const QString bundlePath = targetBin + QLatin1String("/.."); if (QFileInfo(targetExecutable = findExecutable(QStringList() << QStringLiteral("iostool"))).isExecutable()) { @@ -256,7 +241,7 @@ int RunEnvironment::doRunTarget(const QString &targetBin, const QStringList &arg targetArguments << QStringLiteral("--args") << arguments; } else { d->logger.qbsLog(LoggerError) - << Tr::tr("No suitable iOS deployment tools were found in the environment. " + << Tr::tr("No suitable deployment tools were found in the environment. " "Consider installing ios-deploy."); return EXIT_FAILURE; } |