Archive for the Ant Category


Posted in Ant, Development, Php with tags , , , , on February 26, 2013 by andkrup

I am currently writing a batch of ant tasks for Php-development in Eclipse, using PDT.

The low-level nature of php makes the workflow of php-development highly indiviual, and any non-framework based workflow which works for one developer, is probably not going to work for the next dveloper. Each developer has his or her own set of (bad) habits. On the other hand, most of us develop a set of routines and our experiences enable us to know which patterns work in what situations.

This collection of tasks help me in my daily work.

It should be noted that some tasks takes for granted some idioms and coding, conventions if you will, that has proven helpful during my php developing experiences. A lot of these tasks will probably work great in conjunction with the code library PhpBasics (, and in the future both of these projects will probably merge into a set framework, god forbid


A3Tasks update

Posted in Actionscript, Ant, Java with tags , , , , on January 5, 2012 by andkrup

Finally had some time to work on the A3Tasks!

A3Tasks is a little set of Ant tasks for Flash development, made by me (hence the 3 A’s; Andkrups Ant tasks for Actionscript).

Have a look at the repository at bitbucket ( and tell me what you think.

Converting fla files to xfl and vice versa to simplify copying publish settings

Posted in Ant, Flash with tags , , , on August 23, 2011 by andkrup

A really nice feature of the xfl flash file format is that (mostly) everything is text-based.

Today I was working on a small landing page project with 1 fla file that is supposed to display small variations each week for the next 6 weeks. Some of the variations are changes in graphics, and the easiest solution was to create 7 different publish settings each with different compiler constants.

Copying a publish setting will copy all the current settings, bit for some reason, the library settings pointing to the swc files used, was not copied into the new publish setting.

Instead of tediously selecting and copying every compiler constants back and forth in 7 publish settings, it was much easier and faster to convert the fla file to xfl, and edit the PublishSettings.xml with a simple search and replace.

This way you can replace a text like this:


with a text like this.


in the PublishSettings.xml instead of risking carpal tunnel syndrome by copying each constant and clicking a lot of gui components in the gui.

Converting a fla file into a xfl file is as easy as unzipping the fla file – it’s a zip file with the *.fla extension. Converting back is rather obvious.

I use some ant tasks to streamline the process:

<target name="Convert Xfl to Fla">
<zip destfile="${dir.flash}/${}.fla" basedir="${dir.flash}/${}" />
<delete dir="${dir.flash}/${}" />

<target name="Convert Fla to Xfl">
<mkdir dir="${dir.flash}/${}" />
<unzip src="${dir.flash}/${}.fla" dest="${dir.flash}/${}" />
<delete file="${dir.flash}/${}.fla" />


Launching a separate Firefox instance from Ant, testing php files locally

Posted in Ant, Development with tags , , , on January 17, 2011 by andkrup

Darron Schall has a post about launching Firefox via Apache Ant on mac:

I found the post very useful, although the post was made 3 years ago, but where Darron used the task to test Swf files, I was interested in Launching Firefox in order to test php files locally and this had some unfortunate consequences.

My test-task includes copying all relevant project php-files to the local web servers www-location, then opening Firefox as described in above link. Last, a clean-up task can be invoked to remove the test files.

The problem is that Apache will lock the php-files when you test them because your request will require Apache to execute the php scripts, which means that the clean-up task cannot remove the files, because Apache has a lock on them.

Closing the tab in Firefox doesn’t help – you have to close the browser instance (I assume that Firefox somehow sends a ‘end-session’ signal that will make Apache release its file locks – I don’t really have an understand in this regard, but it works if you close the browser).

But if you do not want to close Firefox because you don’t want to close other tabs, you can combine the tips from this post:

By creating multiple Firefox profiles, you can open as many Firefox instances as you have profiles. This way you can open and close a separate ‘test’ Firefox instance that will allow Apache to release your test files from memory on closing the ‘test’-profile Firefox instance without requiring you to close your other tabs in your normal profile Firefox instance.

The arguments for ‘open’ should look like this:

open -n -a /Applications/ http://localhost/${}/ --args -P developer

, where ‘http://localhost/${}/’ is the web directory that just has been created and enabled for testing by a prior Ant task.

My ‘Test on localhost’ target looks like this:

<target name="Test on localhost" depends="Deploy to localhost">
 <property name="browser" value="open" />
<property name="browser.args" value=" -n -a /Applications/ http://localhost/${}/ --args -P developer" />
 <property name="browser" value="open" />
 <exec executable="${browser}" spawn="yes">
 <arg line="${browser.args}" />

, where the depending task ‘Deploy to localhost’ is the task that copies all files that I want to test to the localhost web directory, and the ‘–args -P developer’ part is the magic that enables Ant to launch Firefox as a separate application instance. The ‘developer’ argument indicates that I have created a new Firefox profile named ‘developer’

Automated Bitmap embedding with custom Ant Task

Posted in Actionscript, Ant, Development, eclipse, Java with tags , , , on January 14, 2011 by andkrup

I just made my own Ant Task:

The tutorial on apache ants homepage was very easy to follow and the work to do is really easy as well – if you can run Ant tasks in eclipse you can debug and run your java code as well.

This particular Task allows a user to specify a folder with image files which, when the task completes, each will be embedded in their own as3 class file.

It’s all very basic and there’s a lot of refinement to be done, for example there is a lot of stuff to add to support font embedding, and swf embedding is not supported at all. But this could help shave off some time embedding a lot of external assets without using the flash IDE.