cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [1/3] android commit: CB-7714 Teach check_reqs about brew's install location for android SDK
Date Mon, 06 Oct 2014 14:34:28 GMT
Repository: cordova-android
Updated Branches:
  refs/heads/4.0.x 862c223e1 -> 9577735ff
  refs/heads/master 30681eb77 -> 2dcd50c11


CB-7714 Teach check_reqs about brew's install location for android SDK


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

Branch: refs/heads/4.0.x
Commit: 2dcd50c11b0da370587994bad8496ec1757a26cf
Parents: 30681eb
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Mon Oct 6 10:33:31 2014 -0400
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Mon Oct 6 10:33:31 2014 -0400

----------------------------------------------------------------------
 bin/lib/check_reqs.js | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/2dcd50c1/bin/lib/check_reqs.js
----------------------------------------------------------------------
diff --git a/bin/lib/check_reqs.js b/bin/lib/check_reqs.js
index e527571..0b87bab 100644
--- a/bin/lib/check_reqs.js
+++ b/bin/lib/check_reqs.js
@@ -31,7 +31,7 @@ var isWindows = process.platform == 'win32';
 
 function forgivingWhichSync(cmd) {
     try {
-        return which.sync(cmd);
+        return fs.realpathSync(which.sync(cmd));
     } catch (e) {
         return '';
     }
@@ -102,7 +102,7 @@ module.exports.check_java = function() {
                 } else {
                     // See if we can derive it from javac's location.
                     // fs.realpathSync is require on Ubuntu, which symplinks from /usr/bin
-> JDK
-                    var maybeJavaHome = path.dirname(path.dirname(fs.realpathSync(javacPath)));
+                    var maybeJavaHome = path.dirname(path.dirname(javacPath));
                     if (fs.existsSync(path.join(maybeJavaHome, 'lib', 'tools.jar'))) {
                         process.env['JAVA_HOME'] = maybeJavaHome;
                     } else {
@@ -179,9 +179,15 @@ module.exports.check_android = function() {
         }
         if (androidCmdPath && !hasAndroidHome) {
             var parentDir = path.dirname(androidCmdPath);
+            var grandParentDir = path.dirname(parentDir);
             if (path.basename(parentDir) == 'tools') {
                 process.env['ANDROID_HOME'] = path.dirname(parentDir);
                 hasAndroidHome = true;
+            } else if (fs.existsSync(path.join(grandParentDir, 'tools', 'android'))) {
+                process.env['ANDROID_HOME'] = grandParentDir;
+                hasAndroidHome = true;
+            } else {
+                throw new Error('ANDROID_HOME is not set and no "tools" directory found at
' + parentDir);
             }
         }
         if (hasAndroidHome && !adbInPath) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message