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 2019/01/23 21:13:22 UTC

[GitHub] bramk commented on issue #636: Missing cordova_plugins.js after platform add/prepare

bramk commented on issue #636: Missing cordova_plugins.js after platform add/prepare
URL: https://github.com/apache/cordova-android/issues/636#issuecomment-456968194
 
 
   Took another look and found what seems to be the source of my problem, but still not sure how to proceed and/or solve this in the correct way.
   
   **Cordova Lib** during `prepare#restoreMissingPluginsForPlatform` calls `removePlugin` followed by `addPlugin` for each plugin to be installed  on the platform api. It sets `pluginOptions.usePlatformWww` to `true`, but **notice how it reuses that object for both calls**! This code has not changed in the last couple of releases.
   
   https://github.com/apache/cordova-lib/blob/a478ce39b44a957ba1f960f380c75b6353213aa4/src/cordova/prepare.js#L162-L170
   
   **Cordova Android** during `removePlugin` conditionally sets `uninstallOptions.usePlatformWww` to `false` and if it does during prepare the subsequent call to `addPlugin` will have that also receive that value. That particular logic has changed a lot over the last couple of releases.
   
   In `6.4.0` it seems the condition was never met due to a broken  `AndroidStudio.isAndroidStudioProject` check and therefore `uninstallOptions.usePlatformWww` was left thruthy.
   
   In `7.0.0` and beyond the `AndroidStudio.isAndroidStudioProject` was modified several times, in `7.1.4` it just defaults to `true` and in master it has been removed. In all these case it means that the condition is met and `uninstallOptions.usePlatformWww` is set to `false` for `removePlugin` and, in the prepare case, also the subsequent `addPlugin` call.
   
   https://github.com/apache/cordova-android/blob/a68f9fd752a25bb680da96414a3b956357c2dfcb/bin/templates/cordova/Api.js#L274-L277
   
   I think there is some code smell here? One could argue that Cordova lib should make a defensive copy, but tbh I also simply do not understand why  `usePlatformWww` is set to `false` at all in the `removePlugin` code.

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