breautek opened a new pull request, #1606:
URL: https://github.com/apache/cordova-android/pull/1606

   <!--
   Please make sure the checklist boxes are all checked before submitting the 
PR. The checklist is intended as a quick reference, for complete details please 
see our Contributor Guidelines:
   
   http://cordova.apache.org/contribute/contribute_guidelines.html
   
   Thanks!
   -->
   
   ### Platforms affected
   
   Android / Gradle Argument pass through
   
   ### Motivation and Context
   <!-- Why is this change required? What problem does it solve? -->
   <!-- If it fixes an open issue, please link to the issue here. -->
   
   gradle expects a specific usage which Cordova doesn't conform to.
   
   ```
   $ gradle --help
   
   USAGE: gradle [option...] [task...]
   ```
   
   Currently we append the gradle arguments at the end of the gradle argument 
list, but option arguments are suppose to appear before the task(s).
   
   Closes https://github.com/apache/cordova-android/issues/1604
   
   Additionally, while testing I also discovered that arguments that requires 
multiple values (e.g. `--warning-mode all`) doesn't get passed through 
properly, yielding an argument array that looks like:
   
   ```javascript
   [ "--warning-mode all" ]
   ````
   
   when the expect array should look like:
   
   ```javascript
   [ "--warning-mode", "all" ]
   ```
   
   ### Description
   <!-- Describe your changes in detail -->
   
   - Re-ordered the gradle argument array creation so that options appears 
before the task.
   - Corrected tests who assumed the task will appear at index 0. Tasks will 
always appear at the end of the array now and have been updated accordingly 
with that specific expectation.
   - Added a dependency to 
[string-argv](https://www.npmjs.com/package/string-argv). `nopt` does not fit 
here because it expects that you know what your CLI arguments are. However 
since these arguments are gradle arguments, it's better if we can parse them 
and pass them through. This package handles quotations and such to ensure a 
proper argv array is created.
   
   ### Testing
   <!-- Please describe in detail how you tested your changes. -->
   
   Ran `npm test` and manually tested in hello world app using commands such as:
   
   `cordova build android --minSdkVersion 30 -- --gradleArg="--stacktrace"`
   
   `cordova build android --minSdkVersion 30 -- --gradleArg="--stacktrace 
--warning-mode all"`
   
   ### Checklist
   
   - [x] I've run the tests to see all new and existing tests pass
   - [x] I added automated test coverage as appropriate for this change
   - [x] Commit is prefixed with `(platform)` if this change only applies to 
one platform (e.g. `(android)`)
   - [x] If this Pull Request resolves an issue, I linked to the issue in the 
text above (and used the correct [keyword to close issues using 
keywords](https://help.github.com/articles/closing-issues-using-keywords/))
   - [x] I've updated the documentation if necessary
   


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