cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject android commit: CB-7321 Don't require ant for create script
Date Fri, 15 Aug 2014 17:59:23 GMT
Repository: cordova-android
Updated Branches:
  refs/heads/master 4319447cb -> 95aa5c9f1


CB-7321 Don't require ant for create script


Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/95aa5c9f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/95aa5c9f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/95aa5c9f

Branch: refs/heads/master
Commit: 95aa5c9f1c45b79151dc9650447faeaf12a75d96
Parents: 4319447
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Fri Aug 15 13:58:53 2014 -0400
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Fri Aug 15 13:58:53 2014 -0400

----------------------------------------------------------------------
 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-android/blob/95aa5c9f/bin/lib/check_reqs.js
----------------------------------------------------------------------
diff --git a/bin/lib/check_reqs.js b/bin/lib/check_reqs.js
index 17a3bd4..db45474 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,6 +123,6 @@ 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-android/blob/95aa5c9f/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-android/blob/95aa5c9f/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() {


Mime
View raw message