summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBogDan Vatra <bogdan@kde.org>2014-12-19 12:29:38 +0200
committerBogDan Vatra <bogdan@kde.org>2014-12-19 15:14:05 +0100
commitb0bd62581b1181d6c0955fc10c10dfe1b1aeb288 (patch)
tree78f0effe83d3c848ae181d80f795360752d8cede
parenta87f13be56d8ded8e040a6d6f941ccc654187931 (diff)
downloadqttools-b0bd62581b1181d6c0955fc10c10dfe1b1aeb288.tar.gz
Make sure we are using gradle 2.x
Google is playing with my nerves! Android SDK Tools v24.0.0 set gradle 1.x by default, then in v24.0.1 they've switched to gradle 2.x. Incredibly, a few days later they're released v24.0.2 and again they've switched back to gradle 1.x as the default gradle version. Thought, when a project is opened in Android Studio, Android Studio switches to gradle 2.x. We'll do the same thing in androiddeployqt. Change-Id: Id5ca3f94a96b230cbb6af410bccf292d53f9ea5b Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
-rw-r--r--src/androiddeployqt/main.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/androiddeployqt/main.cpp b/src/androiddeployqt/main.cpp
index f782c34aa..925f2c5b7 100644
--- a/src/androiddeployqt/main.cpp
+++ b/src/androiddeployqt/main.cpp
@@ -44,6 +44,7 @@
#include <QStandardPaths>
#include <QUuid>
#include <QDirIterator>
+#include <QRegExp>
#include <algorithm>
static const bool mustReadOutputAnyway = true; // pclose seems to return the wrong error code unless we read the output
@@ -2373,6 +2374,18 @@ static bool mergeGradleProperties(const QString &path, GradleProperties properti
return true;
}
+bool updateGradleDistributionUrl(const QString &path) {
+ // check if we are using gradle 2.x
+ GradleProperties gradleProperties = readGradleProperties(path);
+ QString distributionUrl = QString::fromLocal8Bit(gradleProperties["distributionUrl"]);
+ QRegExp re(QLatin1String(".*services.gradle.org/distributions/gradle-2..*.zip"));
+ if (!re.exactMatch(distributionUrl)) {
+ gradleProperties["distributionUrl"] = "https\\://services.gradle.org/distributions/gradle-2.2.1-all.zip";
+ return mergeGradleProperties(path, gradleProperties);
+ }
+ return true;
+}
+
bool buildGradleProject(const Options &options)
{
GradleProperties localProperties;
@@ -2392,6 +2405,9 @@ bool buildGradleProject(const Options &options)
if (!mergeGradleProperties(gradlePropertiesPath, gradleProperties))
return false;
+ if (!updateGradleDistributionUrl(options.outputDirectory + QLatin1String("gradle/wrapper/gradle-wrapper.properties")))
+ return false;
+
#if defined(Q_OS_WIN32)
QString gradlePath(options.outputDirectory + QLatin1String("gradlew.bat"));
#else