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

    https://github.com/apache/cordova-android/pull/176#discussion_r31065606
  
    --- Diff: bin/lib/check_reqs.js ---
    @@ -70,18 +72,23 @@ module.exports.get_target = function() {
     
     // Returns a promise. Called only by build and clean commands.
     module.exports.check_ant = function() {
    -    return tryCommand('ant -version', 'Failed to run "ant -version", make 
sure you have ant installed and added to your PATH.');
    +    return tryCommand('ant -version', 'Failed to run "ant -version", make 
sure you have ant installed and added to your PATH.')
    +    .then(function (output) {
    +        // Parse Ant version from command output
    +        return /version ((?:\d+\.)+(?:\d+))/i.exec(output)[1];
    +    });
     };
     
     // Returns a promise. Called only by build and clean commands.
     module.exports.check_gradle = function() {
         var sdkDir = process.env['ANDROID_HOME'];
    -    var wrapperDir = path.join(sdkDir, 'tools', 'templates', 'gradle', 
'wrapper');
    -    if (!fs.existsSync(wrapperDir)) {
    -        return Q.reject(new Error('Could not find gradle wrapper within 
android sdk. Might need to update your Android SDK.\n' +
    -            'Looked here: ' + wrapperDir));
    -    }
    -    return Q.when();
    +    var wrapper = path.join(sdkDir, 'tools', 'templates', 'gradle', 
'wrapper', 'gradlew');
    --- End diff --
    
    If `ANDROID_HOME` is not defined, the error you will get here is:
    
        Gradle: not installed
        [TypeError: Arguments to path.join must be strings]
    
    (since you end up passing null to `path.join()`)
    
    While there is a previous check for `ANDROID_HOME` (as part of the Android 
SDK check), it would be nice to make this error more meaningful.


---
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]

Reply via email to