Android: Read NDK and api versions from modules/Core.json

Qt 6.5+ writes the NDK version that was used for building Qt into
modules/Core.json. With this change, Qt Creator, now reads this version
and (if present) prefers it over the respective NDK version defined by
Qt Creator's own sdk_definition.json.

The order of preference for an NDK version being required and used for a
Qt version is now:

1) NDK that was manually set as "Default"
2) NDK defined by Qt's modules/Core.json
3) NDK version defined for a Qt version by sdk_definition.json
4) Default/fallback NDK version defined by sdk_definition.json

Task-number: QTCREATORBUG-28629
Change-Id: I2a0a9b3a1719139dc937d468e1dd3643289510a1
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
Alessandro Portale
2023-01-09 13:59:45 +01:00
parent 06c4df37b9
commit b73d6f3be8
4 changed files with 139 additions and 0 deletions

View File

@@ -953,6 +953,16 @@ bool AndroidConfig::sdkToolsOk() const
QStringList AndroidConfig::essentialsFromQtVersion(const QtVersion &version) const
{
if (auto androidQtVersion = dynamic_cast<const AndroidQtVersion *>(&version)) {
bool ok;
const AndroidQtVersion::BuiltWith bw = androidQtVersion->builtWith(&ok);
if (ok) {
const QString ndkPackage = ndkPackageMarker() + bw.ndkVersion.toString();
return QStringList(ndkPackage)
+ packagesWithoutNdks(m_defaultSdkDepends.essentialPackages);
}
}
QVersionNumber qtVersion = version.qtVersion();
for (const SdkForQtVersions &item : m_specificQtVersions)
if (item.containsVersion(qtVersion))
@@ -973,6 +983,13 @@ static FilePath ndkSubPath(const SdkForQtVersions &packages)
FilePath AndroidConfig::ndkSubPathFromQtVersion(const QtVersion &version) const
{
if (auto androidQtVersion = dynamic_cast<const AndroidQtVersion *>(&version)) {
bool ok;
const AndroidQtVersion::BuiltWith bw = androidQtVersion->builtWith(&ok);
if (ok)
return FilePath::fromString(NdksSubDir) / bw.ndkVersion.toString();
}
for (const SdkForQtVersions &item : m_specificQtVersions)
if (item.containsVersion(version.qtVersion()))
return ndkSubPath(item);