You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2013/12/06 02:13:20 UTC
[04/32] git commit: [android] call out to platform check_req script
[android] call out to platform check_req script
Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/42f4d49f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/42f4d49f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/42f4d49f
Branch: refs/heads/fireos
Commit: 42f4d49fc30ca37fb22309b92f104c2336f70c3f
Parents: de57aff
Author: Michal Mocny <mm...@gmail.com>
Authored: Wed Nov 27 16:38:17 2013 -0500
Committer: Michal Mocny <mm...@gmail.com>
Committed: Thu Nov 28 10:45:58 2013 -0500
----------------------------------------------------------------------
src/metadata/android_parser.js | 38 ++++---------------------------------
1 file changed, 4 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/42f4d49f/src/metadata/android_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/android_parser.js b/src/metadata/android_parser.js
index 535d5b2..aeda478 100644
--- a/src/metadata/android_parser.js
+++ b/src/metadata/android_parser.js
@@ -25,7 +25,7 @@ var fs = require('fs'),
child_process = require('child_process'),
project_config= require('../config'),
Q = require('q'),
- config_parser = require('../config_parser');
+ lazy_load = require('../lazy_load');
var default_prefs = {
"useBrowserHistory":"true",
@@ -45,40 +45,10 @@ module.exports = function android_parser(project) {
// Returns a promise.
module.exports.check_requirements = function(project_root) {
events.emit('log', 'Checking Android requirements...');
- var command = 'android list target';
- events.emit('verbose', 'Running "' + command + '" (output to follow)');
- var d = Q.defer();
- child_process.exec(command, function(err, output, stderr) {
- events.emit('verbose', output);
- if (err) {
- d.reject(new Error('The command `android` failed. Make sure you have the latest Android SDK installed, and the `android` command (inside the tools/ folder) added to your path. Output: ' + output));
- } else {
- if (output.indexOf('android-17') == -1) {
- d.reject(new Error('Please install Android target 17 (the Android 4.2 SDK). Make sure you have the latest Android tools installed as well. Run `android` from your command-line to install/update any missing SDKs or tools.'));
- } else {
- var custom_path = project_config.has_custom_path(project_root, 'android');
- var framework_path;
- if (custom_path) {
- framework_path = path.resolve(path.join(custom_path, 'framework'));
- } else {
- framework_path = path.join(util.libDirectory, 'android', 'cordova', require('../../platforms').android.version, 'framework');
- }
- var cmd = 'android update project -p "' + framework_path + '" -t android-17';
- events.emit('verbose', 'Running "' + cmd + '" (output to follow)...');
- var d2 = Q.defer();
- child_process.exec(cmd, function(err, output, stderr) {
- events.emit('verbose', output + stderr);
- if (err) {
- d2.reject(new Error('Error updating the Cordova library to work with your Android environment. Command run: "' + cmd + '", output: ' + output));
- } else {
- d2.resolve();
- }
- });
- d.resolve(d2.promise);
- }
- }
+ return lazy_load.based_on_config(project_root, 'android').then(function(lib_path) {
+ var check_reqs = require(path.join(lib_path, 'bin', 'lib', 'check_reqs'));
+ return check_reqs.run();
});
- return d.promise;
};
module.exports.prototype = {