Fix apkPath for gradle 4.0+

This change keeps the compatibility with old gradle.
It is needed for projects that must use the old gradle version.

src/tools/androiddeployqt/main.cpp was moved from qttools into
qtbase in 5.11. So re-apply c03f5673 in qttools here.

Task-number: QTBUG-69755
Change-Id: I2399d445f8208766e4185d717bb51f1317fdcc00
Reviewed-by: Volker Krause <volker.krause@kdab.com>
(cherry picked from commit e2f4193112)
Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
bb10
BogDan Vatra 2018-03-15 09:08:30 +02:00 committed by Liang Qi
parent f2668c6b43
commit 490d461ab0
1 changed files with 8 additions and 3 deletions

View File

@ -2328,10 +2328,15 @@ enum PackageType {
QString apkPath(const Options &options, PackageType pt)
{
QString path(options.outputDirectory);
if (options.gradle)
path += QLatin1String("/build/outputs/apk/") + QDir(options.outputDirectory).dirName() + QLatin1Char('-');
else
if (options.gradle) {
path += QLatin1String("/build/outputs/apk/");
QString buildType(options.releasePackage ? QLatin1String("release/") : QLatin1String("debug/"));
if (QDir(path + buildType).exists())
path += buildType;
path += QDir(options.outputDirectory).dirName() + QLatin1Char('-');
} else {
path += QLatin1String("/bin/QtApp-");
}
if (options.releasePackage) {
path += QLatin1String("release-");
if (pt == UnsignedAPK)