Wednesday, July 4, 2007

Running Flex Builder's incremental compiler from ANT

by Dirk.
here

If you're using ANT inside Flex Builder 2 to compile your Flex 2/AS3 application you've probably noticed that invoking mxmlc from inside ANT is not as fast as running the integrated compiler - even if incremental is set to true. This is because mxmlc gets loaded and initialized every time you build whereas the internal builder stays in the VM.

Fortunately, the builder used in Flex Builder 2 extends the core IncrementalProjectBuilder class and Eclipse contributes its own ANT task to invoke it. So if you're using ANT inside Eclipse simply use the task to invoke the internal Flex 2 compiler. You should see same compilation times as running it by hand. The only thing you have to do is to tell ANT to run in the same VM as Eclipse, otherwise it won't now about the Workspace (Run --> External Tools... --> Ant build --> your build file --> JRE --> check "Run in the same VM as the Workspace")

A basic ANT file to invoke the incremental build process in the current workspace is:










to invoke the builder for a given project it's:





Of course, this is not Flex 2 specific, it works for all projects that use incremental project builders.

No comments: