rharrwwis opened a new issue #1249:
URL: https://github.com/apache/cordova-android/issues/1249


   # Bug Report
   
   ## Problem
   
   gradleArg is not being passed to the gradle command when it is creating the 
wrapper and I was using gradleArg=--project-cache-dir=/tmp because my project 
directory is on a Windows file server.  If I ran the gradle command manually 
with my --project-cache-dir everything worked fine, but I could not build using 
the cordova command directly. 
   
   ### What is expected to happen?
   Extra gradle arguments are passed through the command line to gradle using 
cordova commands.
   
   ### What does actually happen?
   It works except when cordova is creating the gradle wrapper during prepEnv.
   
   ## Information
   To get this to work I added an opts parameter to runGradleWrapper in 
ProjectBuilder.js.  This passed in the arguments successfully and I was able to 
generate an APK using a Mac device with my project folder existing on a Windows 
file server using the --gradleArg=--project-cache-dir=/tmp.
   
   
   ### Command or Code
   Added opts to ProjectBuilder.js:
   
       /*
       * This returns a promise
       */
       runGradleWrapper (gradle_cmd, opts) {
           var gradlePath = path.join(this.root, 'gradlew');
           var wrapperGradle = path.join(this.root, 'wrapper.gradle');
           if (fs.existsSync(gradlePath)) {
               // Literally do nothing, for some reason this works, while 
!fs.existsSync didn't on Windows
           } else if (opts.extraArgs) {
               return execa(gradle_cmd, ['-p', this.root, 'wrapper', '-b', 
wrapperGradle, opts.extraArgs], { stdio: 'inherit' });
           }
           else {
               return execa(gradle_cmd, ['-p', this.root, 'wrapper', '-b', 
wrapperGradle], { stdio: 'inherit' });
           }
       }
   
       prepEnv (opts) {
           var self = this;
           return check_reqs.check_gradle()
               .then(function (gradlePath) {
                   return self.runGradleWrapper(gradlePath, opts);
               }).then(function () {
                   return self.prepBuildFiles();
               }).then(() => {
   
   
   
   ### Environment, Platform, Device
   Mac OS with project on Windows file server (SMB).
   
   
   
   ### Version information
   <!--
   What are relevant versions you are using?
   For example:
   Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins
   Other Frameworks: Ionic Framework and CLI version
   Operating System, Android Studio, Xcode etc.
   -->
   
   
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [x] I searched for existing GitHub issues
   - [x] I updated all Cordova tooling to most recent version
   - [x] I included all the necessary information above
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to