Github user TimBarham commented on a diff in the pull request:
https://github.com/apache/cordova-android/pull/176#discussion_r31061124
--- Diff: bin/lib/check_reqs.js ---
@@ -223,27 +237,87 @@ module.exports.check_android_target =
function(valid_target) {
// android-L
// Google Inc.:Google APIs:20
// Google Inc.:Glass Development Kit Preview:20
+ if (!valid_target) valid_target = module.exports.get_target();
var msg = 'Android SDK not found. Make sure that it is installed. If
it is not at the default location, set the ANDROID_HOME environment variable.';
return tryCommand('android list targets --compact', msg)
.then(function(output) {
- if (output.split('\n').indexOf(valid_target) == -1) {
- var androidCmd = module.exports.getAbsoluteAndroidCmd();
- throw new Error('Please install Android target: "' +
valid_target + '".\n\n' +
- 'Hint: Open the SDK manager by running: ' + androidCmd +
'\n' +
- 'You will require:\n' +
- '1. "SDK Platform" for ' + valid_target + '\n' +
- '2. "Android SDK Platform-tools (latest)\n' +
- '3. "Android SDK Build-tools" (latest)');
+ var targets = output.split('\n');
+ if (targets.indexOf(valid_target) >= 0) {
+ return targets;
}
+
+ var androidCmd = module.exports.getAbsoluteAndroidCmd();
+ throw new Error('Please install Android target: "' + valid_target
+ '".\n\n' +
+ 'Hint: Open the SDK manager by running: ' + androidCmd + '\n' +
+ 'You will require:\n' +
+ '1. "SDK Platform" for ' + valid_target + '\n' +
+ '2. "Android SDK Platform-tools (latest)\n' +
+ '3. "Android SDK Build-tools" (latest)');
});
};
// Returns a promise.
module.exports.run = function() {
- return Q.all([this.check_java(), this.check_android()])
+ return Q.all([this.check_java(), this.check_android(),
this.check_android_target()])
.then(function() {
console.log('ANDROID_HOME=' + process.env['ANDROID_HOME']);
console.log('JAVA_HOME=' + process.env['JAVA_HOME']);
});
};
+/**
+ * Object thar represents one of requirements for current platform.
+ * @param {String} id The unique identifier for this requirements.
+ * @param {String} name The name of requirements. Human-readable
field.
+ * @param {String} version The version of requirement installed. In
some cases could be an array of strings
+ * (for example, check_android_target returns
an array of android targets installed)
+ * @param {Boolean} installed Indicates whether the reuirement is
installed or not
--- End diff --
Typo - 'requirement'
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]