airsdk / apm

AIR Package Manager
https://repository.airsdk.dev/
MIT License
61 stars 10 forks source link

execute uninstall didn't remove anes from the description's file #93

Closed jimmymjing closed 2 years ago

jimmymjing commented 2 years ago

Hi, I'm trying to uninstall the facebook ane by calling uninstall, and here's the output:

$ apm uninstall com.distriqt.facebook.Core
Uninstall package : com.distriqt.facebook.Core
✓ Removed package : com.distriqt.facebook.Core                                  
Uninstall package : com.jetbrains.kotlin
✓ Removed package : com.jetbrains.kotlin
Uninstall package : com.android.installreferrer
✓ Removed package : com.android.installreferrer                                 
Uninstall package : androidx.core
androidx.core :: Required by another package - skipping uninstall
Uninstall package : com.distriqt.Bolts
✓ Removed package : com.distriqt.Bolts
Uninstall package : com.distriqt.Core
com.distriqt.Core :: Required by another package - skipping uninstall

I tried to regenerate the description file and these anes are also listed in the extensions section.

marchbold commented 2 years ago

Thanks for reporting this, I'll look into it.

What version are you using?

jimmymjing commented 2 years ago

I'm using 1.1.1-alpha

marchbold commented 2 years ago

This is happening due to the logic around the extensions node when generating the app xml. Currently we take the approach that we only add extensions to this list (never remove) when generating the app xml, as the extension may be a local / external / custom extension that wasn't delivered through apm.

This is one of the concerns we had originally around the app xml generation about what to use as the "template".

I think to resolve this one the simplest approach is to pass the app xml into the uninstall command, eg:

apm uninstall com.distriqt.facebook.Core src/MyApp-app.xml

So at uninstall time we can process the app xml as well.

The more involved resolution would be to change the logic behind the extensions node generation to remove any extensions not installed via apm. For this to work we would have to add a config for other non-airpackage extensions.


The original idea here was to use the config/application-descriptor.xml as the base template and only have the external extensions in there. So what you can try is copying your app xml to this location, removing the android / iphone nodes and just having the base AIR content in there. If you have any local extensions, add them into the extensions node but not any that are installed via apm. This way when a package is uninstalled it would no longer be added into the generated descriptor.

But the problem we saw with this (and why we have not encouraged this approach) is the issue with maintaining 2 app descriptors. The one that you use to generate your app, and are probably working on eg MyApp-app.xml, and the one that apm uses to generate this file. If you make changes to MyApp-app.xml but not the config//... then apm could overwrite your changes.


Potentially we should implement both of the solutions.

marchbold commented 2 years ago

Actually I've come up with a better approach using the new "lock" file which should be seamless for the user. Will release this with the 1.1 update later today.