CB-7321 Don't require ant for create script
Project: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/commit/99283e6b Tree: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/tree/99283e6b Diff: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/diff/99283e6b Branch: refs/heads/master Commit: 99283e6b88a5aa06b71265b6898766d7dadba4e0 Parents: 0053d3d Author: Andrew Grieve <[email protected]> Authored: Fri Aug 15 13:58:53 2014 -0400 Committer: Archana Naik <[email protected]> Committed: Mon Aug 18 12:37:43 2014 -0700 ---------------------------------------------------------------------- bin/lib/check_reqs.js | 4 ++-- bin/templates/cordova/lib/build.js | 6 +++++- bin/templates/cordova/lib/clean.js | 6 +++++- 3 files changed, 12 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/99283e6b/bin/lib/check_reqs.js ---------------------------------------------------------------------- diff --git a/bin/lib/check_reqs.js b/bin/lib/check_reqs.js index 6236836..dbbb353 100644 --- a/bin/lib/check_reqs.js +++ b/bin/lib/check_reqs.js @@ -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() { return tryCommand('ant -version', 'Failed to run "ant -version", make sure you have ant installed and added to your PATH.'); } @@ -123,5 +123,5 @@ module.exports.check_android = function() { // Returns a promise. 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()]); } http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/99283e6b/bin/templates/cordova/lib/build.js ---------------------------------------------------------------------- diff --git a/bin/templates/cordova/lib/build.js b/bin/templates/cordova/lib/build.js index 6336ecf..5134f41 100644 --- a/bin/templates/cordova/lib/build.js +++ b/bin/templates/cordova/lib/build.js @@ -25,6 +25,7 @@ var shell = require('shelljs'), path = require('path'), fs = require('fs'), ROOT = path.join(__dirname, '..', '..'); +var check_reqs = require('./check_reqs'); function hasCustomRules() { @@ -60,9 +61,12 @@ module.exports.run = function(build_type) { return Q.reject('Build option \'' + build_type + '\' not recognized.'); } // Without our custom_rules.xml, we need to clean before building. - var ret = Q(); + var ret; if (!hasCustomRules()) { + // clean will call check_ant() for us. ret = require('./clean').run(); + } else { + ret = check_reqs.check_ant(); } return ret.then(function() { return spawn('ant', args); http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/99283e6b/bin/templates/cordova/lib/clean.js ---------------------------------------------------------------------- diff --git a/bin/templates/cordova/lib/clean.js b/bin/templates/cordova/lib/clean.js index 0a2e0ce..f215829 100644 --- a/bin/templates/cordova/lib/clean.js +++ b/bin/templates/cordova/lib/clean.js @@ -22,6 +22,7 @@ var build = require('./build'), spawn = require('./spawn'), path = require('path'); +var check_reqs = require('./check_reqs'); /* * Cleans the project using ant @@ -29,7 +30,10 @@ var build = require('./build'), */ module.exports.run = function() { var args = build.getAntArgs('clean'); - return spawn('ant', args); + return check_reqs.check_ant() + .then(function() { + return spawn('ant', args); + }); } module.exports.help = function() {
