[ 
https://issues.apache.org/jira/browse/CB-8954?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14559495#comment-14559495
 ] 

ASF GitHub Bot commented on CB-8954:
------------------------------------

Github user TimBarham commented on a diff in the pull request:

    https://github.com/apache/cordova-android/pull/176#discussion_r31061166
  
    --- 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 --
    
    My IDE wants you to mark `version` and `installed` as optional :)


> Update platform check_reqs script to return structured result to 
> 'requirements' command
> ---------------------------------------------------------------------------------------
>
>                 Key: CB-8954
>                 URL: https://issues.apache.org/jira/browse/CB-8954
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android, iOS, Windows, WP8
>            Reporter: Vladimir Kotikov
>            Assignee: Vladimir Kotikov
>
> Since {{requirements}} LIB method assumes that underlying platform script 
> will be {{require}}d instead of spawning child process and capturing output, 
> we need to modify these scripts to provide method that will be called for 
> getting current requirements status.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to