forked from qt-creator/qt-creator
Move sdkmanager's sdk level parsing to AndroidConfig
Both the sdkmanger and avdmanager (maybe more) need to parse the sdk level for packages and devices which may contain letters, make them use the same logic. Change-Id: Iff7fef3a66e00fac11b833f73f2f334a4cf1a766 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -418,6 +418,28 @@ QString AndroidConfig::apiLevelNameFor(const SdkPlatform *platform)
|
||||
QString("android-%1").arg(platform->apiLevel()) : "";
|
||||
}
|
||||
|
||||
int AndroidConfig::platformNameToApiLevel(const QString &platformName)
|
||||
{
|
||||
int apiLevel = -1;
|
||||
static const QRegularExpression re("(android-)(?<apiLevel>[0-9A-Z]{1,})",
|
||||
QRegularExpression::CaseInsensitiveOption);
|
||||
QRegularExpressionMatch match = re.match(platformName);
|
||||
if (match.hasMatch()) {
|
||||
QString apiLevelStr = match.captured("apiLevel");
|
||||
bool isUInt;
|
||||
apiLevel = apiLevelStr.toUInt(&isUInt);
|
||||
if (!isUInt) {
|
||||
if (apiLevelStr == 'Q')
|
||||
apiLevel = 29;
|
||||
else if (apiLevelStr == 'R')
|
||||
apiLevel = 30;
|
||||
else if (apiLevelStr == 'S')
|
||||
apiLevel = 31;
|
||||
}
|
||||
}
|
||||
return apiLevel;
|
||||
}
|
||||
|
||||
bool AndroidConfig::isCmdlineSdkToolsInstalled() const
|
||||
{
|
||||
QString toolPath("cmdline-tools/latest/bin/sdkmanager");
|
||||
|
Reference in New Issue
Block a user