forked from qt-creator/qt-creator
Android: get correct value for ANDROID_DEPLOYMENT_SETTINGS_FILE for Qt 6
CMake with Qt 6 which uses android-${target}-deployment-settings.json
file name, we use substitute ${target} with the root node target name
to get the correct file name.
Task-number: QTCREATORBUG-24678
Change-Id: Ib0c82b947b3217b6b763191b22d91ab9674fedce
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -49,6 +49,7 @@
|
||||
#include <projectexplorer/taskhub.h>
|
||||
#include <qmljs/qmljsmodelmanagerinterface.h>
|
||||
#include <qtsupport/qtcppkitinfo.h>
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
|
||||
#include <app/app_version.h>
|
||||
|
||||
@@ -561,16 +562,6 @@ void CMakeBuildSystem::updateProjectData()
|
||||
cmakeBuildConfiguration()->project()->setExtraProjectFiles(m_reader.projectFilesToWatch());
|
||||
|
||||
CMakeConfig patchedConfig = cmakeBuildConfiguration()->configurationFromCMake();
|
||||
{
|
||||
CMakeConfigItem settingFileItem;
|
||||
settingFileItem.key = "ANDROID_DEPLOYMENT_SETTINGS_FILE";
|
||||
settingFileItem.value = cmakeBuildConfiguration()
|
||||
->buildDirectory()
|
||||
.pathAppended("android_deployment_settings.json")
|
||||
.toString()
|
||||
.toUtf8();
|
||||
patchedConfig.append(settingFileItem);
|
||||
}
|
||||
{
|
||||
QSet<QString> res;
|
||||
QStringList apps;
|
||||
@@ -602,8 +593,32 @@ void CMakeBuildSystem::updateProjectData()
|
||||
auto newRoot = generateProjectTree(m_allFiles);
|
||||
if (newRoot) {
|
||||
setRootProjectNode(std::move(newRoot));
|
||||
if (p->rootProjectNode())
|
||||
p->setDisplayName(p->rootProjectNode()->displayName());
|
||||
CMakeConfigItem settingFileItem;
|
||||
settingFileItem.key = "ANDROID_DEPLOYMENT_SETTINGS_FILE";
|
||||
|
||||
const FilePath buildDir = cmakeBuildConfiguration()->buildDirectory();
|
||||
if (p->rootProjectNode()) {
|
||||
const QString nodeName = p->rootProjectNode()->displayName();
|
||||
p->setDisplayName(nodeName);
|
||||
|
||||
const Kit *k = kit();
|
||||
if (DeviceTypeKitAspect::deviceTypeId(k) == Android::Constants::ANDROID_DEVICE_TYPE) {
|
||||
const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(k);
|
||||
if (qt && qt->qtVersion() >= QtSupport::QtVersionNumber{6, 0, 0}) {
|
||||
const QLatin1String jsonFile("android-%1-deployment-settings.json");
|
||||
settingFileItem.value = buildDir.pathAppended(jsonFile.arg(nodeName))
|
||||
.toString()
|
||||
.toUtf8();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (settingFileItem.value.isEmpty()) {
|
||||
settingFileItem.value = buildDir.pathAppended("android_deployment_settings.json")
|
||||
.toString()
|
||||
.toUtf8();
|
||||
}
|
||||
patchedConfig.append(settingFileItem);
|
||||
|
||||
for (const CMakeBuildTarget &bt : m_buildTargets) {
|
||||
const QString buildKey = bt.title;
|
||||
@@ -646,7 +661,6 @@ void CMakeBuildSystem::updateProjectData()
|
||||
{
|
||||
updateQmlJSCodeModel();
|
||||
}
|
||||
|
||||
emit cmakeBuildConfiguration()->buildTypeChanged();
|
||||
|
||||
qCDebug(cmakeBuildSystemLog) << "All CMake project data up to date.";
|
||||
|
||||
Reference in New Issue
Block a user