Android: Skip "Build APK" for non-app builds

For projects using Qt 5.15 and Qt 6, the deployment settings
file is generated by CMake/qmake and not Qt Creator, so if
such file doesn't exist or it's been generated by Qt Creator,
we can assume the project is not an android app.

This is mainly a workaround for now to avoid a more involved
fix which would need to potentially remove the method
AndroidManager::deploymentSettings() (and it's use cases) which
is used to generate a minimal version of deployment settings
file, which was added some time ago where the build system
CMake and Qt wasn't handling that generation, but now with Qt
5.15 and Qt 6, that shouldn't be a concern of Qt Creator.

Fixes: QTCREATORBUG-27167
Fixes: QTBUG-111334
Task-number: QTCREATORBUG-26888
Change-Id: I15657f3b67acc52c28c92e6af24668f778432a19
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Assam Boudjelthia
2023-05-12 01:22:07 +03:00
parent c5818cfe6d
commit cae4dd01a8

View File

@@ -361,6 +361,14 @@ Abi AndroidManager::androidAbi2Abi(const QString &androidAbi)
bool AndroidManager::skipInstallationAndPackageSteps(const Target *target)
{
// For projects using Qt 5.15 and Qt 6, the deployment settings file
// is generated by CMake/qmake and not Qt Creator, so if such file doesn't exist
// or it's been generated by Qt Creator, we can assume the project is not
// an android app.
const FilePath inputFile = AndroidQtVersion::androidDeploymentSettings(target);
if (!inputFile.exists() || AndroidManager::isQtCreatorGenerated(inputFile))
return true;
const Project *p = target->project();
const Core::Context cmakeCtx = Core::Context(CMakeProjectManager::Constants::CMAKE_PROJECT_ID);