Stop Coding!

The Unofficial Flex Compiler Blog

Configuring FDT to use the HellFire compiler

with 14 comments

Now that HFCD supports Apache Ant, Flex IDEs other than Flex Builder (e.g. FDT and IntelliJ IDEA) can take advantage of some of the core functionalities of HFCD to improve build performance. In this post I’m going to briefly describe how to configure FDT to use HFCD. I hope to do IntelliJ IDEA in the next post.

First of all, the HFCD installers target Flex Builder. So, if you use FDT, you have to install HFCD manually. Well, it’s really not that bad. Instead of downloading the installers, you download the zip archive (hfcd_3.x.x.zip or hfcd_4.x.x.zip) from stopcoding.org.

Unzip the archive file and run ‘ant client server’ from the command-line.

To start the HFCD server, run ‘hfcd’ in the HFCD_HOME/server/bin directory.

Now, start FDT.

Some developers are already familiar with using Ant in FDT. So, it’s not absolutely necessary to follow my instructions here. But I would do it like the following:

1. Assume that my FDT workspace is empty. For this demo, create the legendary HelloWorld project.

2. Create a generic project called “HFCD Build”. Add a file called “build.xml” to the “HFCD Build” project.

After step 1-2, your FDT workspace directory structure should look like this:

3. build.xml is empty. Let’s add the following code to build.xml.

<?xml version="1.0"?>
<project name="FDT" default="main" basedir=".">
    <taskdef name="hfcd" classname="hellfire.tools.ant.HFCD"/>
    <property name="helloworld.dir" value="${basedir}/../HelloWorld"/>
    <target name="main">
        <hfcd>
            <watcher>
                <fileset dir="${helloworld.dir}"/>
            </watcher>
            <application id="HelloWorld.swf"
                output="${basedir}/HelloWorld.swf"
                description="Building HelloWorld.swf">
                <fileset file="${helloworld.dir}/src/HelloWorld.mxml"/>
                <configuration>
                    --default-size 550 400
                    --default-frame-rate 31
                    --default-background-color 0xFFFFFF
                </configuration>
            </application>
        </hfcd>
    </target>
    <target name="clean">
        <delete failonerror="false">
            <fileset file="${basedir}/HelloWorld.swf"/>
        </delete>
        <hfcd clean="true"/>
    </target>
    <target name="close">
        <hfcd close="true" gc="true"/>
    </target>
</project>

4. Add build.xml to the “Ant” view. Since build.xml uses a 3rd-party ant task, you have to configure how FDT runs the build script and where to locate the ant task definition. Right-click on the build file in the “Ant” view and select “2 Ant Build…”.

5. The “Main” tab shows that ${workspace_loc:/HFCD Build/build.xml} is the build file.

6. In the “Refresh” tab, check “Refresh resources upon completion.” and select “The entire workspace”.

7. In the “Build” tab, disable “Build before launch”.

8. In the “Classpath” tab, click “Add External JARs…” and select hfcd-ant-tasks.jar in the HFCD_HOME/client/lib directory.

9. In the “JRE” tab, select “Run in the same JRE as the workspace”.

Now, you’re all set. Check again to make sure that hfcd is actually running. Then in the “Ant” view, double-click the “main” target. You should see the ant output in the “Console” view…

and HelloWorld.swf in the “HFCD Build” directory. Note that in the “HFCD Build” directory, there is a new directory called “build.hfcd”. This directory stores the list of files that have already been uploaded to HFCD and the build reports. If you delete this directory, all the files and directories specified in the <watcher> task will be uploaded again the next time you run the build script.

As you add more projects to the FDT workspace, you should add <application> and <library> tasks to the same build.xml file – add the tasks within the same <hfcd> task in the “main” target. For more information on the ant task syntax, please check out my previous post.

Written by Clement Wong

January 19, 2010 at 4:52 pm

14 Responses

Subscribe to comments with RSS.

  1. Hi Clement,

    I am afraid I having difficulty following your directions as I am stuck on:

    “…. and run ‘ant client server’ from the command-line.”

    I unsure how to go about this step as I don’t know where to find the ‘ant client server’ or what I ought to enter into the command-line.
    (the zip doesn’t seem to contain any of file with a similar name)

    I will deal with the following steps once I understand the first one clearly but I think that:
    “To start the HFCD server, run ‘hfcd’ in the HFCD_HOME/server/bin directory.”
    might make me ask a question or two :o)

    Thanks in advance.

    George
    [I use OSX Snow Leopard, Eclipse Java EE IDE for Web Developers (which includes ANT) and FDT 3.5 (plug-in)]

    George

    January 20, 2010 at 3:07 pm

    • Hi George,

      Since you use Snow Leopard, I can give you more specific steps here. Assume that you downloaded hfcd_3.5.0.zip.

      1. double-click hfcd_3.5.0.zip in Finder.
      2. In Finder, move the hfcd_3.5.0 directory to /Applications.
      3. Open a Terminal window.
      4. Type “cd /Applications/hfcd_3.5.0” in the Terminal window.
      5. Type “ant client server” in the Terminal window.

      There is a file called “build.xml” in /Applications/hfcd_3.5.0. When you run ant in the hfcd_3.5.0 directory (which is pre-installed on Snow Leopard), ant looks for build.xml by default and runs the script.

      Once “ant client server” is done. You should see “server” in the hfcd_3.5.0 directory.

      6. cd /Applications/hfcd_3.5.0/server/bin
      7. ./hfcd

      Hope this helps.

      Clement Wong

      January 20, 2010 at 3:27 pm

  2. That is brilliant!

    I have it compiling the HelloWorld example.

    Thanks Clement, nicely done :o)

    I am going to have a look adapting the build file to see how I can compile one of my current projects. I am intrigued to see how HFCD compilation affects both compilation time and file size.

    George

    January 20, 2010 at 6:43 pm

  3. Hi Clement,
    Is it possible to use the HFCD view in FDT to automatically generate a build.xml file?
    Many thanks

    Riccardo Bartoli

    February 23, 2010 at 3:25 pm

    • Hi Riccardo,

      Sorry, it’s currently not possible. But I intend to add support for FDT in the near future. I just need to get HFCD for FB out the door first.

      Clement Wong

      February 24, 2010 at 12:07 pm

  4. Hi Clement, Is it possible to compile pure Actionscript projects with the HFCD? And what’s the advantage to have a separate project for the build.xml over having it within the same project? Kind regards, Uwe

    Uwe Holland

    March 18, 2010 at 2:53 pm

    • Hi Uwe, Yes, you can use HFCD to compile pure ActionScript project.

      In the build.xml file, you define a task and a number of and tasks. You use this task to build the entire workspace. That’s why putting the file outside of any project directories makes more sense than putting it in a particular project directory. Second reason is that you also want to be able to modify build.xml in Eclipse and putting it in a separate project makes it easy to access the file.

      Clement Wong

      March 18, 2010 at 3:06 pm

      • These are great news! Though as I tried to download the package there seems to be a problem with the link: http://stopcoding.org/hfcd/4/download/ Do you have an advice on how to download for me? Kind Regards, Uwe

        Uwe Holland

        March 27, 2010 at 12:42 pm

  5. Developers using FDT are so afraid checking Flex Builder. It is far better than FDT now

    brooklyn

    April 8, 2010 at 7:12 am

    • You are having a joke of course!

      George

      April 8, 2010 at 7:43 am

    • late April fools’ prank?

      Riccardo Bartoli

      April 8, 2010 at 12:49 pm

    • I think there is a reason why FDT is alive and well. From the perspective of building Flex apps, they are on a level playing field with HFCD. Actually, I’d go out on a limb to say that in some situations, FDT could outperform by a mile when using HFCD. Stay tuned if you want to know what I’m saying…

      Clement Wong

      April 9, 2010 at 10:04 am

  6. From installation guide for HFCD 3.x.x Plugin / Windows version: “7. If you install the HFCD Eclipse plugin on an Eclipse installation (not a Flex Builder installation), the
    HFCD Eclipse plugin should be in the “eclipse/dropins” directory.”

    When I install HFCD, this item don’t match! There is no file ( hellfire.admin.ui_3.0.0.jar) on droping folder. (Installation version detail: Eclipse Ganymede, Flex Buider 3.0.2, SDK 3.5.0, Windws 7 64Bits, HFCD 3.5.0 Plugin/Windows version).
    When I try to build, I get this error: “HFCD license data not found.”, even informing the evaluation license file during the installation.
    How can I fix this?

    Itamar Veloso Rezende Junior

    July 19, 2012 at 10:34 am


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: