I keep advocating single-click builds and it’s time to put my money where my mouth is. This article will show you how to set up Flash Builder to rebuild and package an AIR Native Extension with one click.
Step 1: Create a build script that automates the ANE packaging
Automatic ANE Packaging walks you through making a build script and customizing it. You should have an Ant script in your AIR library project, which is an XML file with build instructions. It’s called build.xml in the example below:
Step 2: Add a builder to your Flash Builder project
Now you’ll get Flash Builder to run your script when you do Project > Build Project.
2.1. Open the Properties dialog of your AIR Library project and select Builders from the list on the left:
2.2. Click New… and create a new Ant Builder:
2.3. Inside the Edit Configuration dialog:
- Name your builder.
Tip: the name needs to be unique for your Flash Builder workspace. You can’t have two different projects, each using a builder with the same name. Go figure…
- Then select your build file – that would be the XML Ant script you prepared in Step 1.
Tip: Having your build script as part of your project and selecting it via Browse Workspace… would save you having to change paths if you share the project with colleagues or build it on a different machine.
2.4. OK the last dialog. You should now see your builder listed under the default Flex one. Tick the box next to it to select it. This will cause your build script to be executed when you do Project > Build Project in Flash Builder.
3. Try it out
That’s it. I know, hard to believe this last stage is so short, given the amount of work you did in putting the build script together.
Go on, try it. Select your project in Flash Builder and do Project > Build Project. I know… that’s technically two clicks. I really wish Flash Builder had a shortcut for building a single project, rather than just for Build All…
You should be able to see the script at work in the Console window (Window > Show View > Console):
At the end of all this there should be an ANE waiting for you. And where would that be? Well, wherever you set up your build script to create it.
4. Build/packaging errors?
Give us a shout in the comments below. We want to help and we don’t bite. Much.