From 5ed2272e51c134a9b489240bbadccee5b3d00441 Mon Sep 17 00:00:00 2001 From: Max Woghiren Date: Mon, 22 Sep 2014 16:04:24 -0400 Subject: [PATCH] Added gradle distribution URL updating. --- bin/templates/cordova/lib/build.js | 8 ++++++++ framework/build.gradle | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/bin/templates/cordova/lib/build.js b/bin/templates/cordova/lib/build.js index 2e6a624d..41c7d97b 100644 --- a/bin/templates/cordova/lib/build.js +++ b/bin/templates/cordova/lib/build.js @@ -214,6 +214,14 @@ var builders = { shell.rm('-rf', path.join(projectPath, 'gradle', 'wrapper')); shell.mkdir('-p', path.join(projectPath, 'gradle')); shell.cp('-r', path.join(wrapperDir, 'gradle', 'wrapper'), path.join(projectPath, 'gradle')); + + // If the gradle distribution URL is set, make sure it points to version 1.12. + // If it's not set, do nothing, assuming that we're using a future version of gradle that we don't want to mess with. + // For some reason, using ^ and $ don't work. This does the job, though. + var distributionUrlRegex = /distributionUrl.*zip/; + var distributionUrl = 'distributionUrl=http\\://services.gradle.org/distributions/gradle-1.12-all.zip'; + var gradleWrapperPropertiesPath = path.join(projectPath, 'gradle', 'wrapper', 'gradle-wrapper.properties'); + shell.sed('-i', distributionUrlRegex, distributionUrl, gradleWrapperPropertiesPath); }); }, diff --git a/framework/build.gradle b/framework/build.gradle index 6ca284d3..a0fb2d23 100644 --- a/framework/build.gradle +++ b/framework/build.gradle @@ -29,7 +29,9 @@ buildscript { // It can affect things like where the .apk is generated. // It also dictates what the minimum android build-tools version // that you need (Set in bin/templates/project/cordova.gradle). - // Be sure to also update the value in bin/templates/project. + // Be sure to also update the value in: + // (1) bin/templates/project/build.gradle, and + // (2) the distribution URL in bin/templates/cordova/lib/build.js. classpath 'com.android.tools.build:gradle:0.12.+' } }