Repository: cordova-android
Updated Branches:
  refs/heads/master 30325e4f3 -> 9544783b5


CB-11640: Fixing check_reqs.js so it actually works

This closes #338


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

Branch: refs/heads/master
Commit: 9544783b5eb9317addb00ba0c75de7a87e665364
Parents: eaf9b31
Author: Joe Bowser <[email protected]>
Authored: Tue Sep 27 14:38:07 2016 -0700
Committer: Joe Bowser <[email protected]>
Committed: Mon Oct 3 14:41:14 2016 -0700

----------------------------------------------------------------------
 bin/lib/check_reqs.js | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/9544783b/bin/lib/check_reqs.js
----------------------------------------------------------------------
diff --git a/bin/lib/check_reqs.js b/bin/lib/check_reqs.js
index 8f1f646..ac6fa4c 100644
--- a/bin/lib/check_reqs.js
+++ b/bin/lib/check_reqs.js
@@ -152,7 +152,6 @@ module.exports.check_java = function() {
             // javac writes version info to stderr instead of stdout
             return tryCommand('javac -version', msg, true)
                 .then(function (output) {
-                    console.log(output);
                     //Let's check for at least Java 8, and keep it future 
proof so we can support Java 10
                     var match = /javac 
((?:1\.)(?:[8-9]\.)(?:\d+))|((?:1\.)(?:[1-9]\d+\.)(?:\d+))/i.exec(output);
                     return match && match[1];
@@ -227,6 +226,7 @@ module.exports.check_android = function() {
             throw new CordovaError('\'ANDROID_HOME\' environment variable is 
set to non-existent path: ' + process.env['ANDROID_HOME'] +
                 '\nTry update it manually to point to valid SDK directory.');
         }
+        return hasAndroidHome;
     });
 };
 
@@ -269,13 +269,23 @@ module.exports.check_android_target = 
function(originalError) {
 
 // Returns a promise.
 module.exports.run = function() {
-    return Q.all([this.check_java(), this.check_android()])
-    .then(function() {
-        console.log('ANDROID_HOME=' + process.env['ANDROID_HOME']);
-        console.log('JAVA_HOME=' + process.env['JAVA_HOME']);
-    });
+     return Q.all([this.check_java(), this.check_android()])
+     .then(function(values) {
+         console.log('ANDROID_HOME=' + process.env['ANDROID_HOME']);
+         console.log('JAVA_HOME=' + process.env['JAVA_HOME']);
+
+         if (!values[0]) {
+            throw new CordovaError('Requirements check failed for JDK 1.8 or 
greater');
+         }
+
+
+         if (!values[1]) {
+            throw new CordovaError('Requirements check failed for Android 
SDK');
+         }
+     });
 };
 
+
 /**
  * Object thar represents one of requirements for current platform.
  * @param {String} id         The unique identifier for this requirements.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to