cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Billau (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (CB-5016) add then rm of dependent plugin as top level plugin breaks environment
Date Fri, 11 Oct 2013 13:00:48 GMT

     [ https://issues.apache.org/jira/browse/CB-5016?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Mike Billau closed CB-5016.
---------------------------

       Resolution: Fixed
    Fix Version/s: 3.2.0

Thanks Braden for the merge and commit!
Set fix version to 3.2 since that's the next release we should see this. 

Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/d4a9e893
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/d4a9e893
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/d4a9e893

Branch: refs/heads/master
Commit: d4a9e89302f78a4377ddb00c80258e1edd965ccc
Parents: 399f63d
Author: mbillau <mike.billau@gmail.com>
Authored: Thu Oct 10 15:49:34 2013 -0400
Committer: Braden Shepherdson <braden.shepherdson@gmail.com>
Committed: Thu Oct 10 16:58:42 2013 -0400


> add then rm of dependent plugin as top level plugin breaks environment 
> -----------------------------------------------------------------------
>
>                 Key: CB-5016
>                 URL: https://issues.apache.org/jira/browse/CB-5016
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugman
>         Environment: Windows 7
>            Reporter: Mike Billau
>             Fix For: 3.2.0
>
>
> Removing a dependent plugin that was installed as a default top level plugin breaks the
environment because during plugin add, the plugin name gets added to plugins/platform.json
under "installed_plugins" and not  under "dependent_plugins". However, in plugin rm, the plugin
code gets fully removed from the work space but the name is left in "installed_plugins" because
the tools search for it in "dependent_plugins."
> *Scenario 1* - Install the dependent plugin first
> cordova create Sample && cd Sample
> cordova platform add android
> cordova plugin add org.apache.cordova.file
> cordova plugin add org.apache.cordova.file-transfer (depends on File)
> cordova plugin ls
> [org.apache.cordova.file, org.apache.cordova.file-transfer]
> *Now if you look at platforms/android.json, you will see that both plugins were added
to "installed_plugins"*:
> cat platforms/android.json
> {noformat}
>     "installed_plugins": {
>         "org.apache.cordova.file": {
>             "PACKAGE_NAME": "io.cordova.hellocordova"
>         },
>         "org.apache.cordova.file-transfer": {
>             "PACKAGE_NAME": "io.cordova.hellocordova"
>         }
>     },
>     "dependent_plugins": {}
> {noformat}
> This leaves us in an invalid state when you go to remove the file-transfer plugin because
for some reason it removes both the file-transfer and file plugin code, but it does not remove
the file entry from "installed_plugins".
> cordova plugin rm org.apache.cordova.file-transfer
> cat platforms/android.json:
> {noformat}
> "installed_plugins":{"org.apache.cordova.file":{"PACKAGE_NAME":"io.cordova.hellocordova"}},"dependent_plugins":{}}
> {noformat}
> but:
> cordova plugin ls
> [No plugins added. Use cordova plugin add <plugin>]
> and:
> cordova build (and cordova prepare, etc.) 
> [Error: ENOENT, no such file or directory, "C:\.........plugins\org.apache.cordova.file]
> *Scenario 2* - Install the lower level plugin and let plugman automatically install the
dependencies:
> cordova create Sample2 && cd Sample2
> cordova platform add android
> cordova plugin add org.apache.cordova.file-transfer (depends on File, it will automatically
get pulled down and installed)
> cordova plugin ls
> [org.apache.cordova.file, org.apache.cordova.file-transfer]
> *Now if you look, /platforms/android.json will be different than in Scenario 1*
> cat platforms/android.json:
> {noformat}
>     "installed_plugins": {
>         "org.apache.cordova.file-transfer": {
>             "PACKAGE_NAME": "io.cordova.hellocordova"
>         }
>     },
>     "dependent_plugins": {
>         "org.apache.cordova.file": {
>             "PACKAGE_NAME": "io.cordova.hellocordova"
>         }
>     }
> {noformat}
> You can see that now the File plugin is listed as a dependent_plugin. This is great,
because now when you remove file-transfer, it will also remove file plugin:
> cordova plugin rm org.apache.cordova.file-transfer
> cat plugins/android.js:
> {noformat}
>     "installed_plugins": {},
>     "dependent_plugins": {}
> {noformat}
> and cordova build android will work just fine. 
> So the problem here seems to be that if a dependent plugin was added manually, it will
be added under installed_plugins and not dependent_plugins. Later when the consuming plugin
is deleted, the tools delete the plugin code from the workspace but are not able to remove
this plugin from the installed_plugins entry (presumably because it searches in the dependent_plugin
object.) This leaves the project in a broken state because *plugin ls* does not show the installed
plugin, but the tools will try to copy the file at MyApp/plugins/org.apache.cordova.****,
whatever is listed in plugins/android.json file.
> I think the fix would be:  When doing plugin uninstall, only remove plugins from the
workspace if:
> 1) the plugin is detected to be a dependent plugin, (already being done since *cordova
plugin rm org.apache.cordova.file-transfer removes the org.apache.cordova.file code) and
> 2. the plugin is listed in "dependent_plugins" section of  /plugins/platform.json



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message