Android: Fix android-*-deployment-settings.json detection

Qt 6.0 + CMake: The name for the Android deployment settings file needs
to be determined by using the build key of the current run configuration
rather than by using the display name of the project root node.

Since in contrast to qmake/Qbs, CMake does not supply us with the file
name and we have to contruct it ourselves. Therefore, it makes sense to
move the value into the Android plugin.

This change adds AndroidQtVersion::androidDeploymentSettings which lets
qmake and Qbs still provide the value as before while handling the CMake
fallback.

Fixes: QTCREATORBUG-25209
Change-Id: I12314d06a45d6e045cb654d9140f9d2ed4602f67
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
Alessandro Portale
2021-02-12 20:57:18 +01:00
parent 768d4321f9
commit ae5255cebd
6 changed files with 29 additions and 28 deletions

View File

@@ -35,7 +35,9 @@
#include <qtsupport/qtsupportconstants.h>
#include <qtsupport/qtversionmanager.h>
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectnodes.h>
#include <projectexplorer/target.h>
#include <projectexplorer/kit.h>
#include <projectexplorer/project.h>
@@ -169,6 +171,24 @@ int AndroidQtVersion::minimumNDK() const
return m_minNdk;
}
Utils::FilePath AndroidQtVersion::androidDeploymentSettings(const Target *target)
{
// Try to fetch the file name from node data as provided by qmake and Qbs
const QString buildKey = target->activeBuildKey();
const ProjectNode *node = target->project()->findNodeForBuildKey(buildKey);
if (node) {
const QString nameFromData = node->data(Constants::AndroidDeploySettingsFile).toString();
if (!nameFromData.isEmpty())
return Utils::FilePath::fromUserInput(nameFromData);
}
// If unavailable, construct the name by ourselves (CMake)
const BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(target->kit());
const bool isQt6 = qt && qt->qtVersion() >= QtSupport::QtVersionNumber{6, 0, 0};
return target->activeBuildConfiguration()->buildDirectory().pathAppended(
isQt6 ? QString::fromLatin1("android-%1-deployment-settings.json").arg(buildKey)
: QLatin1String("android_deployment_settings.json"));
}
void AndroidQtVersion::parseMkSpec(ProFileEvaluator *evaluator) const
{
m_androidAbis = evaluator->values("ALL_ANDROID_ABIS");