You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by na...@apache.org on 2014/10/02 20:17:42 UTC
[08/29] git commit: CB-7511 Auto-detect Android SDK when Android
Studio is installed
CB-7511 Auto-detect Android SDK when Android Studio is installed
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/6604aec5
Tree: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/tree/6604aec5
Diff: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/diff/6604aec5
Branch: refs/heads/master
Commit: 6604aec53c51aa8f37346ebfff99231091f166f9
Parents: 8a6cdcc
Author: Andrew Grieve <ag...@chromium.org>
Authored: Wed Sep 10 10:14:38 2014 -0400
Committer: Prabhjot Singh <pr...@amazon.com>
Committed: Wed Sep 17 14:04:29 2014 +0530
----------------------------------------------------------------------
bin/lib/check_reqs.js | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/6604aec5/bin/lib/check_reqs.js
----------------------------------------------------------------------
diff --git a/bin/lib/check_reqs.js b/bin/lib/check_reqs.js
index 201d9a9..6d1dee3 100644
--- a/bin/lib/check_reqs.js
+++ b/bin/lib/check_reqs.js
@@ -141,6 +141,20 @@ module.exports.check_android = function() {
var androidCmdPath = forgivingWhichSync('android');
var adbInPath = !!forgivingWhichSync('adb');
var hasAndroidHome = !!process.env['ANDROID_HOME'] && fs.existsSync(process.env['ANDROID_HOME']);
+ function maybeSetAndroidHome(value) {
+ if (fs.existsSync(value)) {
+ hasAndroidHome = true;
+ process.env['ANDROID_HOME'] = value;
+ }
+ }
+ if (!hasAndroidHome && !androidCmdPath) {
+ if (isWindows) {
+ maybeSetAndroidHome(path.join(process.env['LOCALAPPDATA'], 'Android', 'android-studio', 'sdk'));
+ maybeSetAndroidHome(path.join(process.env['ProgramFiles'], 'Android', 'android-studio', 'sdk'));
+ } else if (process.platform == 'darwin') {
+ maybeSetAndroidHome('/Applications/Android Studio.app/sdk');
+ }
+ }
if (hasAndroidHome && !androidCmdPath) {
process.env['PATH'] += path.delimiter + path.join(process.env['ANDROID_HOME'], 'tools');
}
@@ -171,7 +185,8 @@ module.exports.check_android_target = function(valid_target) {
.then(function(output) {
if (!output.match(valid_target)) {
throw new Error('Please install Android target "' + valid_target + '".\n' +
- 'Hint: Run "android" from your command-line to open the SDK manager.');
+ output + '\n\n' +
+ 'Hint: Install it using the SDK manager by running: ' + forgivingWhichSync('android'));
}
});
};
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org