Flite Careers

Flash Build Automation

At Flite we have week long sprints. In other words, every week we release new code. In order to maintain such a quick development cycle we rely on automated build and test processes. These processes help us catch bugs early and ensure that each week’s release is as problem-free as possible. Since we use Flash as part of our Core Ad Runtime, we had to find a way to add it to our automation suite.

Flash SWFs are compiled code that are deployed as binary files, but compilation and testing isn’t as straightforward to automate. While individual classes can be compiled, the desired output is usually one binary with the dependant classes compilied within. Unit tests cannot be run headlessly as they require Flash Player to run a compiled swf. We solved these problems with Jenkins and Rake.


Jenkins is a build automation tool. For Flash we take advantage of a few key features.

  1. The ability to receive commands via URL. We take advantage of this by creating post-commit hooks in our git projects.
  2. The ability to run remote nodes. This gives us a windowed environment where we can run scripts and run Flash Player.
  3. Automatic reporting on issues. If something fails, we can be alerted right away.


Rake, a ruby build tool, gives us us the flexibility to script our own compilation, test, optimization, and deployment tasks which can be run via the command line or by Jenkins’ Rake integration. Compling, testing, and deploying our Flash assets is as simple as running a Rake task. Our tasks are designed to work locally as well as remotely, meaning that individual developers also gain the benefits of an easy interface to manage our Flash projects. There are even some IDEs that have Rake intergration.

We originally used Ant to handle many of the same tasks, but we quickly found that maintaining the build.xml file was inefficient. Every new Flash asset required copying and pasting in a new block of XML in more than one place for each discrete task.


Instead of maintaining a list of files to compile, we use ActionScript annotations (metadata tags) to indicate which files we need to build. Our rake build task recursively searches our project directories for ActionScript files that contain a custom annotation:


The task can optionally build specific files when a directory or file name is passed in as a parameter. Adding a new SWF is as easy as adding the annotation. We also use annotations to help determine what type of file we are building, where it should be deployed, and which, if any, external libraries we need to include at compile time.

Here is a sample rake task


We use FlexUnit to run unit tests. Our rake test task runs the tests (the task actually defers to ant to run FlexUnit for now) and will abort if anything fails. Every hour, and whenever an updated is detected, Jenkins kicks off tests on a node running Safari or Chrome.

Optimization and Deployment

Since our Ad file sizes need to be kept small we run all our SWFs through a bytecode reducer. We use our rake “reduce” and “deploy” tasks to copy the reduced SWFs prior to deployment. The script then deploys all assets to the proper environment (Development, QA, or Production). Since our build and test tasks run before these, we feel confident that the deployed SWFs are in a releasable state. There are certain non-automated tasks we like to perform to verify manually before each release, but we continuously attempt to reduce the need for manual verification.


We have developed some simple ruby tools to help with annotation parsing and swf compiling.

We use the arbitrarily chosen “Build” annotation, but something else might better suite your environment.


These tools have improved Flash development at Flite. With automated build and test processes we feel confident about our weekly releases. If anything does go wrong during compilation or testing we are able to respond quickly. We are no longer dependent on the Flash IDE which means no more FLA files in version control. Local development has also improved, allowing individual engineers to focus on building assets and tests instead of worrying about build details. These tools have also helped us to discover further ways to optimize our SWF output and Core Runtime. All of these enhancements are then passed along as improved performance for all those who view Flite Ads.