Tag Archives: ant

ant + svn = love

Back in December, I built a system where my SVN post-commit hook automatically updated a file containing revision info for an application I’m writing.

Well, a few things got shuffled in our ant buildfile and that script stopped working. Not because it was bad… just because files moved around and nobody thought to update it.

My group is currently moving away from allowing Flex Builder to handle our compilation and to just using ant on both dev workstations and for server-side deploys. This got me fiddling with ant a bit more this morning and resulted in my stumbling across the SvnAnt ant task. A bit more fiddling, and I now have ant generating the version.xml files for us at build/deploy time in stead of relying on the shell script.

SvnAnt is cool. It can perform most svn operations for you from within your ant builds. This means you could automatically push builds to a server or use ant to expedite the creation of new repositories, or whatever.

My adventures with SvnAnt have born two neat little toys:

  1. I now have a build target that automatically updates both the current repository AND my classpath repository (in case I forget to poke one or the other).
  2. I also have a build target that extracts revision versions and builds my xml data file for me. No more stale files on the dev side of things and the ant version is much more robust – it works even when we move files around 🙂

installing svnant

I downloaded SvnAnt and dumped the jar files into a /lib dir in my repository. This simplifies builds tremendously if the jar files are always kept close to the build.xml file.

I added a few lines near the beginning of my buildfile:

This loads the jar files and preps the <svn/> tasks for use.


This calls the svn update first and then continues on to execute the normal build (where “build_all” is a valid target, of course).

In my case, I have a classpath repository that I also want to update when performing this target. The location of my classpath is defined as as3ClassPath in my build.properties file, so I just add <update dir="{as3ClassPath}"/> to my svn tag, then it updates both repos for me if needed.


The version.xml generation code is likewise very painless to use.

Note that I use $$’s to escape the $’s in my output and that I use html entity codes for my >/< chars.

The result is that every time I run the build, we get a file called version.xml containing xml that (if indented for human readability) looks something like:

So… I like it. It makes me happy. There’s a lot more that the ant task can do. Take a look at the docs for more info.


So… it appears that sometimes the SvnAnt stuff isn’t behaving quite as well as it should. Namely, it fails to use the java svn interface that I thought was being included in the svnjavahl.jar file in the package… but apparently not.

If you have this problem, just make sure you have a modern version of the svn cli utilities installed. For those of you running windows + TortoiseSVN, this just means you’ll also need to download and install svn-1.4.3-setup.exe or whatever the current version may be at the time of reading 😉

If that doesn’t work, well, I’ve figured out how to make the thing work w/the JavaHL interface. Download svn-win32-1.4.3_javahl.zip (or current version, of course), and drop the dll contained in the zip file into your C:\Windows\System32 folder. Then restart your IDE, and voila.

snakenstein revisited

This morning, a job posting went across the MUD-Dev meta list. Well, two postings, really, but the one that interested me was an entry-level game programmer position with Three Rings – the Puzzle Pirates people. They are an open-source house that develops in Java under Debian. They use Ant and have a pretty cool open networking library (matchmaking, etc…) called Game Gardens.

Part of the job posting mentioned that short-listed applicants would be asked to develop a small game in the library. So, I’ve been poking around with it today and think I have a pretty decent grasp on how they’re doing things.

In preparation for playing with the library further, I am planning on writing a networked version of the old snake game. I figure since it was the first graphical program I ever wrote (Turbo Pascal, back in the summer of ’93 or so), it’s a good candidate.

My first playable (single-player) draft of the basic game took about 2 hours to write up since I kept getting distracted by Penny 😉 I’ve got a jar file available for download here. It is pretty ugly at present and doesn’t keep score (other than growing your snake). Every time you crash, it will ask if you want to play again – until you click no, at which point the program will just sit there until you close it.

It doesn’t use Game Gardens yet, that’ll be the project for tomorrow. I have plans for allowing for various types of power-ups and a population of up to 4 snakes on the field (one starting from each cardinal direction on the map). We will require the players to collect assorted eggs until a key appears. Grabbing the key will open the exit, go through exit to next map. Maps will have various silly little patterns of walls on them. If I get to keep playing with the thing, we will probably add different sorts of walls – moving obstacles, etc… I also have ideas for actual sprites to use, but that’s not a major priority – the game runs just fine in blocks of colour.