CB-7321 Don't require ant for create script

This commit is contained in:
Andrew Grieve 2014-08-15 13:58:53 -04:00
parent 4319447cb5
commit 95aa5c9f1c
3 changed files with 12 additions and 4 deletions

View File

@ -55,7 +55,7 @@ module.exports.get_target = function() {
} }
} }
// Returns a promise. // Returns a promise. Called only by build and clean commands.
module.exports.check_ant = function() { module.exports.check_ant = function() {
return tryCommand('ant -version', 'Failed to run "ant -version", make sure you have ant installed and added to your PATH.'); return tryCommand('ant -version', 'Failed to run "ant -version", make sure you have ant installed and added to your PATH.');
} }
@ -123,6 +123,6 @@ module.exports.check_android = function() {
// Returns a promise. // Returns a promise.
module.exports.run = function() { module.exports.run = function() {
return Q.all([this.check_ant(), this.check_java(), this.check_android()]); return Q.all([this.check_java(), this.check_android()]);
} }

View File

@ -25,6 +25,7 @@ var shell = require('shelljs'),
path = require('path'), path = require('path'),
fs = require('fs'), fs = require('fs'),
ROOT = path.join(__dirname, '..', '..'); ROOT = path.join(__dirname, '..', '..');
var check_reqs = require('./check_reqs');
function hasCustomRules() { function hasCustomRules() {
@ -60,9 +61,12 @@ module.exports.run = function(build_type) {
return Q.reject('Build option \'' + build_type + '\' not recognized.'); return Q.reject('Build option \'' + build_type + '\' not recognized.');
} }
// Without our custom_rules.xml, we need to clean before building. // Without our custom_rules.xml, we need to clean before building.
var ret = Q(); var ret;
if (!hasCustomRules()) { if (!hasCustomRules()) {
// clean will call check_ant() for us.
ret = require('./clean').run(); ret = require('./clean').run();
} else {
ret = check_reqs.check_ant();
} }
return ret.then(function() { return ret.then(function() {
return spawn('ant', args); return spawn('ant', args);

View File

@ -22,6 +22,7 @@
var build = require('./build'), var build = require('./build'),
spawn = require('./spawn'), spawn = require('./spawn'),
path = require('path'); path = require('path');
var check_reqs = require('./check_reqs');
/* /*
* Cleans the project using ant * Cleans the project using ant
@ -29,7 +30,10 @@ var build = require('./build'),
*/ */
module.exports.run = function() { module.exports.run = function() {
var args = build.getAntArgs('clean'); var args = build.getAntArgs('clean');
return spawn('ant', args); return check_reqs.check_ant()
.then(function() {
return spawn('ant', args);
});
} }
module.exports.help = function() { module.exports.help = function() {