» Are you looking for FLV Player?

haXe & Eclipse build settings

16 January 2006 | filed under flash, software | 2 comments

I’ve recently started exploring Nicolas Cannasse’s latest innovation: haXe. You can work with this new programming language in Eclipse using the HXDT plugin. I’ve been working on some basic build settings to enable easy compilation of haXe projects from within Eclipse.

If you’re new to haXe, I recommend you check out the official website first.

Next, what software do you need to get to know haXe using Eclipse?

  • haXE (the haXe compiler)
  • Eclipse (the editor we all love)
  • HXDT (haXe plugin for Eclipse)

After installing these apps (I’m not going into the details in this article, it’s all pretty straightforward), the first thing that came to my attention was the fact that the HXDT plugin doesn’t (yet) support haXe compiler integration. That means that you cannot click ‘Run’ or ‘Debug’ and have HXDT instruct haXe to compile your project and run it for you.

You will need to make a seperate External Tools > Program profile in Eclipse for each haXe project you will be creating with HXDT to get this to work. I will share my settings here, perhaps they come in handy when you start playing around with haXe. Click the thumbnail on the left to see the settings I’m using.

I have included the last line (the ‘Arguments line’) for easy copy-paste below. Note that the -main Hello part refers to my main class file, you have to change that setting to reflect your project.

CODE:
  1. -cp “${project_loc}” -swf ${project_loc}\bin\hello.swf -fplayer 8 -main Hello

There’s one thing I haven’t yet done: automatically launch the .swf file that is generated with this task. Perhaps it would be possible to do that using ANT, but I haven’t had time to figue that part out yet.

By the way, the guys working on HXDT recently posted a nice list of improvements for HXDT version 0.2.0, including compiler integration, making this solution obsolete. Until then, this solution may streamline your workflow with haXe a bit.

 

2 Responses to “haXe & Eclipse build settings”

  1. obiwan says:

    Actually you really don’t need to crete one external tool per project.
    You can pass variables to a .sh script like ${project-name} when executing it from the eclipse external tools menu.

    So you just need one script which takes project name and path as paramaters, what eclipse can do.

  2. obiwan says:

    to be more precise : create an external with /bin/sh as location, ${project_loc} as a working directory, and use the -c option of sh, so in the arguments you can ut something like : -c “/Users/me/Sites/Eclipse/.compilation-bash-scripts/buildAndRun.sh ${project_loc} ${project_name}”

    When doing something like this, the buildAndRun.sh file you created will receive ${project_loc} and ${project_name} as two variables that will be accessible as $1 and $2 in the .sh script…

    Dunno if i’m really clear, sorry for my english i’m french :p… but it’s actually a really good way to avoid creating one external tool per project.

Leave a Reply