Commit d3cb2cae authored by BogDan Vatra's avatar BogDan Vatra
Browse files

Use QVersionNumber to compare versions



Comparing strings will give us strange results e.g.
23.0.20 > 25.0.0

Change-Id: Id709ebfe45454064a18706e2df5d01ed5a3e8551
Reviewed-by: Vikas Pachdha's avatarVikas Pachdha <vikas.pachdha@qt.io>
Reviewed-by: Alessandro Portale's avatarAlessandro Portale <alessandro.portale@qt.io>
parent ca039a6e
......@@ -60,6 +60,7 @@
#include <QMessageBox>
#include <QApplication>
#include <QDomDocument>
#include <QVersionNumber>
namespace {
const QLatin1String AndroidManifestName("AndroidManifest.xml");
......@@ -565,16 +566,16 @@ bool AndroidManager::updateGradleProperties(ProjectExplorer::Target *target)
gradleProperties["buildDir"] = ".build";
gradleProperties["androidCompileSdkVersion"] = buildTargetSDK(target).split(QLatin1Char('-')).last().toLocal8Bit();
if (gradleProperties["androidBuildToolsVersion"].isEmpty()) {
QString maxVersion;
QVersionNumber maxVersion;
QDir buildToolsDir(AndroidConfigurations::currentConfig().sdkLocation().appendPath(QLatin1String("build-tools")).toString());
foreach (const QFileInfo &file, buildToolsDir.entryList(QDir::Dirs|QDir::NoDotAndDotDot)) {
QString ver(file.fileName());
QVersionNumber ver = QVersionNumber::fromString(file.fileName());
if (maxVersion < ver)
maxVersion = ver;
}
if (maxVersion.isEmpty())
if (maxVersion.isNull())
return false;
gradleProperties["androidBuildToolsVersion"] = maxVersion.toLocal8Bit();
gradleProperties["androidBuildToolsVersion"] = maxVersion.toString().toLocal8Bit();
}
return mergeGradleProperties(gradlePropertiesPath, gradleProperties);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment