How to update an application using air packages
In this tutorial we are going to run through how to update an application that has been setup to use the AIR Package Manager.
This assumes you have got your AIR project running with apm
. If you haven’t have a look at the following tutorials:
Updating a project that has been setup with apm is one of the most powerful things about the AIR Package Manager.
Previously you would have had to go to the site distributing the ANE, download the ANE, check for updates to any dependencies and download them. Then you would have to check the documentation and sift through your manifest additions and info additions to check if any updates are required. This is all before you can even start to check for any code changes required. Obviously it was a painful process and one we at distriqt were all too aware of.
So lets look at what we do with apm.
In this example I have 2 packages installed:
My Application@1.0.0 /Users/marchbold/work/myapp
├──com.distriqt.facebook.Core@9.3.1
└──com.distriqt.IDFA@5.0.31
Outdated Packages
Firstly we can quickly see if there is an update available by using the outdated command:
apm outdated
This check the installed packages for updates in the repository:
$ apm outdated
identifier installed available
com.distriqt.facebook.Core 9.3.1 9.3.2
com.distriqt.IDFA 5.0.31 5.0.31
From this we can see that there is a new version of the com.distriqt.facebook.Core package available. It is a patch release (last digit in the sem ver) so will only contain bug fixes and minor updates and shouldn’t require any changes to the API (though there may be manifest changes or other such additions).
Using outdated isn’t necessary, it is just information that you can use to decide whether you want to update or not.
Update Packages
Now that we know there is an update and we have decided to update our packages we move to the update command.
Open up a terminal in the project directory, and run the help update process to print out the details on the update command:
$ apm help update
apm update
update the installed packages in your project
apm update apm check for a new release of the apm client and update if available
apm update update all dependencies in your project
apm update <foo> update the <foo> dependency in your project
You will see there are several options here, the first is to update the apm
client (more on this later). The other commands allow you to update packages. If you pass a parameter you can specify a package to update, eg:
apm update com.distriqt.IDFA
would check to see if there are any updates to the IDFA extension and install them if available.
Alternatively you can just run update without any parameters:
apm update
This process will firstly check with the repository for the latest versions of all your packages and then update them as required.
Lets run this now.
apm update
You will see apm going through and checking the versions of all the extensions, uninstalling old and unused extensions, then installing the newer versions.
Once complete you should be able to list your installed packages and see:
My Application@1.0.0 /Users/marchbold/work/myapp
├──com.distriqt.IDFA@5.0.31
└──com.distriqt.facebook.Core@9.3.2
Here we can see the facebook package is now at the updated 9.3.2 release.
Finalising
When you update (or install) a package you should always regenerate your application descriptor. This makes sure any changes to the android manifest or the ios info additions and entitlements are correctly updated in your build.
$ apm generate app-descriptor src/MyApplication-app.xml
✓ Merge tool available
Android package name: air.com.my.app
✓ Android manifest merge
✓ iOS additions merge complete
✓ iOS entitlements merge complete
✓ App descriptor generated: /Users/marchbold/work/myapp/src/MyApplication-app.xml
Now we can return to our application and check it builds and runs as expected.
Summary
Updating is easy with apm, simply run:
apm update
and then regenerate your application descriptor:
apm generate app-descriptor
and you are done!
Advanced: Updating APM
It is worth ensuring you have the latest version of apm installed. This is done through a specific form of the apm update command:
apm update apm
This will list out the current version and then check for the latest. It will then download any updates to the apm application and install.
apm: v0.0.8-beta
✓ Found new release: 0.0.9-beta
✓ Install complete
If you have the latest you will see something like the following:
apm: v0.0.9-beta
✓ Already at latest version
Thanks for reading and if you have any questions you can reach out at the apm discussion forum.
Top comments (0)