View Ryan Knight's profile on LinkedIn


Recent Posts



Entries in Flex (10)



Joa Ebert posted a very interesting blog post about Compiling ActionScript in The Enterprise and I thought it would be interesting to explain what I did a while ago as part of the Anvil Flex Open Source Project to speed up compiling Flex 3 applications.   I should say we, because I had a lot of help from James Ward in building this.  Anvil Flex was desinged somewhat like a portal server and the application was then broken down into smaller sub-applications or "modules" (in the orginizational context and not the flex context).   Each module was designed so the it could be compiled and tested in a stand alone context.  There was also several common libraries that where shared with the entire application

About 6 months into this project compile times for the entire application where exceding 20 minutes and it was nearly impossible to do continuous integration.  One of the main problems with the flex compilers is each part of the compilation process (mxmlc, compc, opimizer, etc.) requires you to start a separate JVM, compile that small part of code and then shutdown the JVM.  Not only does starting and stoping the JVM take time, you also lose all the compilation information when you shut down. 

To solve this problem we build a custom Java compilation program called Taz that called directly into the Flex compiler classes, since the Flex compiler is written in Java.  It consited of the following steps:

1 - We designed a heirarchial build system in Ant that would allow you to build any part of the tree and it's descendets automatically.

2 - The common libraries and modules each had there own Ant build files that described their dependecies.

3 - On building the application we would first walk the tree and build a dependcy heirarchy in memory of what modules and libraries need to be built.

4 - Then as we compiled each library we would cache any pre-processing and loaded libraries that could be reused throughout the compilation process.

The result was compile times dropped from 20 plus minutes to around 4 minutes!    Then for continuous integration builds we set-up multiple builds that would first compile the individual modules and common libraries and then build the entire application.  This would prevent a single module from breaking the build of all the other modules.

A very interesting and logic next step would be to take this process and allow the compilation process on individual developers machines to use the latest libraries built remotely.  For example if a developer was working on module A that depended on module B they could specify to grab latest pre-built module B and any common libraries off a remote machine, like the last known good build from the continuous integration server.  You could also distribute the build across machines this way.

A final note,  a lot of people don't like Ant and say Maven is the build system of the future.  Acutally part of the reason I stop working on Anvil is the entire build process was in Ant and I also thought the trend was to using Maven for builds.  Then on my last project we used Maven extensively and I know believe that Ant actually might be better solution for compiling large and complicated Flex Applications.  One of the reasons I didn't like the Maven build system was a large part of our build process actually used Ant behind the scenes for everything that could not be easily done in Maven.  Yes, Flex Mojos and such can help compile a fairly standard Flex project, but when you project reaches a certain point of complexity that starts to fall apart.  Things such as bundling custom resource files, including special assets in the final build, linking common library files, etc.  it gets complicated really fast! 

I had previously said that the Anvil Flex project was dead, but the code lives on in sourceforge. If there is any interested this build process could be extracted out into a separate, stand alone project.



The Flex SDK team finally decided to fix the problem with Adobe Air Auto-Update in Flex SDK version 3.5a.  Here are the notes from QA on the bug:

The Flex team has updated the 3.5 SDK with a small update that addresses this issue. The refreshed build, SDK 3.5a, has only a few files modified in order to fix this issue and this change does not affect the signing and caching of the SDK 3.5 RSLs originally released in December.

We encourage all developers using SDK 3.5 to upgrade their build to SDK 3.5a to continue their development. The SDK 3.5a build can be found in the “Latest Milestone Release Build” table here: http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+3



After spending a long time yesterday trying to get the Adobe Air Auto-Update to work I realized it was a bug with Flex SDK 3.5.  What happens under Flex SDK 3.5 when you run the auto-update is you only see a blank / gray screen pop-up with no wording.   At first I thought it was my code so I tried it using Greg Wilson's sample.  Compiled under Flex SDK 3.5 it doesn't work at all, but then I tried it under 3.4 it works great. I have filed a bug with Adobe, so please vote for it so we can get a quick fix -http://bugs.adobe.com/jira/browse/SDK-24919



I decided to to file a number of bugs for issues we have been seeing with flex builder.  I have posted them here in hopes you will go vote for them.  This is only some of the many issues we are seeing using Flash Builder.

Allow multiple instances of an AIR app to run at the same time. - There was a previous issue for this which was closed, so I created a new issue with more details.

Need to be able to navigate to classes and methods that implement an interface

Flex Server ate my bin! - This bug was already in the system, but looks like it is stuck on waiting on Info -  Hopefully voting on it will get it moving.

After changing a project type from Flex Server I still can not set my output folder in Flex Build Path

Multiple runnable Air applications in the same project using locale causes tabs display name to be null

Should be able to navigate into script source with Go to Definition Looking through the bug database it looks like several of the renaming bugs have recently been fixed, so maybe renaming will work in the latest release.


End of Life for Anvil Flex

I have decided to stop development on anvil flex.  It had a good 2 year run, but it's sorely out of date.  Mostly it has been replaced by other frameworks.  Flex has made dramatic changes in the past several years and made a lot of anvil out of date.  The Spring BlazeDS project provides much better back-end support and integration.  On the Flex side the biggest downside is most of the data is passed using custom events.  Today I would rewrite this using something like Swiz. It has been really interesting developing anvil flex and I have learned a lot.  Probably the biggest lesson is how hard it is to keep an open source project up to date.  It gives you a much deeper appreciation for major open source projects and the amount of commitment it takes. Some parts of anvil flex are still useful.  It allows dynamically loading and managing modules.  It also has a unique portal framework.  The code will remain available on sourceforge and provides some good sample projects.