Some Useful Flex/AIR Tidbits

Posted in Adobe, AIR, Flex on April 22nd, 2008 by dan

Recently I had the “pleasure” of learning the ins and outs of building Flex and AIR applications via the SDK on a Linux machine.  I wanted to do this for some of the libraries that underpin my project so that they could be built and tested automatically.  So, I setup SVN, Trac and CruiseControl on a Ubuntu VM on my mac.  To get started there are tons of resources about getting SVN and Trac setup under Apache on Ubuntu so, just Google for them.  Setting up CruiseControl was really easy thanks to their good documents, I started with the source distro but, do whatever works.

Now, onto why I’m posting today, along the way I found some annoying things about how FlexBuilder played with the SDK.  For instance, the .flexLibProperties file that is hidden in your FB project, is not the right format to be taken in as a parameter to “compc” ( the library compiler, which seems to require a list of class names to include ), so I wrote a quick Python script to convert that file into a config file that is readable by compc.  Here is how to include it in your Ant script:


<target name="setupClassList">
    <exec executable="python" failonerror="yes">
        <arg line="${helperDir}/classFileConverter.py ${lib_root_dir}/.flexLibProperties classes.xml"/>
    </exec>
</target>


 

It takes in two parameters so you can manipulate the output location of the new file.
Another odd part is that the application descriptor for an AIR project doesn’t get correctly populated.  FB itself fills in the <content> tag for you when it goes to compile.  If you look in your source directory the application descriptor has this string, “[This value will be overwritten by Flex Builder in the output app.xml]” instead of the name of the SWF.  One more little python script:


<exec executable="python" failonerror="yes">
    <arg line="${helperDir}/appDescrFix.py ../bin-debug/${app_descriptor}"/>
</exec>



 

Of course, I am going to give you the scripts!  Here are the links:
.flexLibProperties Converter
Application Descriptor Fixer

 

If someone knows a much easier way to do this just using the command line tools and/or Ant, I’d love to hear it!