CB-3445: android: Copy Gradle wrapper from Android SDK rather than bundling a JAR

This commit is contained in:
Ian Clelland
2014-06-19 16:12:40 -04:00
parent 3a9898a6a6
commit 0ffb5d253a
5 changed files with 31 additions and 263 deletions
+18
View File
@@ -24,6 +24,7 @@ var shell = require('shelljs'),
Q = require('q'),
path = require('path'),
fs = require('fs'),
which = require('which'),
ROOT = path.join(__dirname, '..', '..');
// Get valid target from framework/project.properties
@@ -40,6 +41,23 @@ module.exports.get_target = function() {
}
}
// Returns a promise.
module.exports.sdk_dir = function() {
var d = Q.defer();
which('android', function(err, path) {
if (err) {
d.reject(new Error('ERROR: Cannot find Android SDK. android command not found.'));
} else {
var toolsDir = path.substring(0, path.lastIndexOf('/'));
if (toolsDir.substring(toolsDir.length-6) != "/tools") {
d.reject(new Error('ERROR: Cannot find Android SDK. android command not found in tools dir.'));
}
d.resolve(toolsDir.substring(0, toolsDir.length-6));
}
});
return d.promise;
};
// Returns a promise.
module.exports.check_ant = function() {
var d = Q.defer();