While the Flex tools, or Sprouts + MTasc make CI integration easy, if you are on a platform or project which requires an FLA file, and thus compilation in Flash CS, you may find yourself in a bind as we did.
Here is a recipe to get unstuck on Windows - tested on Windows 7:
- Install Flash CS on the target machine.
- The target machine must be set up as a slave node. The hudson service on windows can not run Flash CS and will fail or hang when trying. The JNLP Hudson launcher running on the node will work, and this can be the same machine as the hudson service.
- Set up a JSFL file to open and compile the FLA to a SWF.
- Set up a hudson job restricted to the slave node(s) with CS5, check out the project, and then run the Flash CS5 executable from the command line.
- To Be Completed - parse the errors output.
Installing Flash CS
I used CS5. It should be licensed of course, and the trialware nags, or occasional survey popup may throw this. They are not seen too often though.
Be sure to take note of where the Flash CS executable lives - you will need to reference this in your Hudson job.
Setting up a slave node
On the hudson dashboard, go to manage hudson, select manage nodes.
Select New node from the left hand menu, name the node and then download the webstart client. This should be ready to hook up with the hudson service although you may need to make firewall rules to allow it through.
var doc = fl.openDocument("file:);
This will open the named file. Note that a relative path can be used after 3 slashes, which is essential for Hudson.
It will then export the SWF file, and then save the compiler error log.
Finally it will ensure that CS exits too. The last step is optional as it may be more efficient to leave CS open and merely open/close documents instead. Note the paths should be relative to the location of the JSFL file and not the root of the project (that is, not the CWD - CS is fairly agnostic of a current working directory).
You should test run this from a command line with the JSFL file as the only parameter to the CS5 Executable.
>"C:\program files\Adobe\Flash CS5\Flash.exe build.jsfl"
Once on the job configuration page, you will need to restrict this to nodes that are able to run CS5 - the root hudson node will not be able to do this due to service/desktop interaction restrictions. Tick "Restrict where this project can be run" and type the slave node name into the location expression box that appears.
After configuring where to get the project (source control etc), you then need to add the command line from above as a Batch file build step.
Error parsing - it is worth noting that while this automates compilation, it does not catch errors/warnings. These are being saved into a log, and it is worth setting up a simple script to parse them and throw an error stopping that hudson buil if they are encountered. At a later time I will revisit this part of the system.