You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2017/11/27 19:46:10 UTC

[GitHub] infil00p closed pull request #396: CB-12677: (android) added option for explicitly specifying path to An?

infil00p closed pull request #396: CB-12677: (android) added option for explicitly specifying path to An?
URL: https://github.com/apache/cordova-android/pull/396
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/bin/templates/cordova/lib/check_reqs.js b/bin/templates/cordova/lib/check_reqs.js
index 2c3f291d8..157f4aa7b 100644
--- a/bin/templates/cordova/lib/check_reqs.js
+++ b/bin/templates/cordova/lib/check_reqs.js
@@ -99,7 +99,12 @@ module.exports.get_gradle_wrapper = function () {
     var i = 0;
     var foundStudio = false;
     var program_dir;
-    if (module.exports.isDarwin()) {
+    // CB-12677: check if Android Studio path was explicitly set via environment variable
+    if (process.env['ANDROID_STUDIO_HOME']) {
+
+        androidStudioPath = path.join(process.env['ANDROID_STUDIO_HOME'], 'gradle');
+
+    } else if (module.exports.isDarwin()) {
         program_dir = fs.readdirSync('/Applications');
         while (i < program_dir.length && !foundStudio) {
             if (program_dir[i].startsWith('Android Studio')) {
@@ -157,7 +162,8 @@ module.exports.check_gradle = function () {
     if (gradlePath.length !== 0) { d.resolve(gradlePath); } else {
         d.reject(new CordovaError('Could not find an installed version of Gradle either in Android Studio,\n' +
                                 'or on your system to install the gradle wrapper. Please include gradle \n' +
-                                'in your path, or install Android Studio'));
+                                'in your path, or install Android Studio, or set up \'ANDROID_STUDIO_HOME\'\n' +
+                                'env variable.'));
     }
     return d.promise;
 };


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org