Monthly Archives: April 2003

All Good Things …

My Dad had a way with words. When we would arrive home from some journey, he would always announce “Home again to old St Mallow …”. It always marked the end of our journey, though I’ve no idea where he got that saying from.

Today his journey has ended. He is home again – rest in peace.

RedHat 9

I installed RedHat 9 tonight. It’s nice, although a little trouble with PPP and fonts – sorted out now, I think. I noticed a funny little typo in the installer slide show. Apparently at RedHat training you can “lean more”. Sounds good to me.

Maven v Ant Article

IBM Developer works site has an article on Maven (via Sam Ruby)

It’s an interesting article (although the layout on Mozilla is a little strange). It includes a comparison between Maven and Ant. I don’t agree with everything Charles has to say but that’s probably due to my mindset – you should make up your own mind. He is right that Maven and Ant target different aspects of the build process (or problem as he calls it). I tend to think of Maven as an Ant 4GL.

I haven’t had time to really study how Maven works. Maybe when it goes to 1.0 I’ll set aside some time and try to write up some thoughts.

Lawn Bowls

Cortex, where I work, is four years old and on Friday we celebrated by going to play lawn bowls (Diggers on the park). It was a change of pace from the usual Cortex social occasion. Our guide characterised lawn bowls as “low, slow, with the flow” and so it turned out to be.

I think the results were essentially random – too long, too short, too far to the right or too far to the left. It was lots of fun. I’d say it is a sport where it is easy to be OK and hard to be good. I’ll be ready to try it again in about 20 years

How to Clover Ant

Clovering Ant is a little more complicated that clovering a regular Java project because Clover itself is running within Ant as a compiler adapter. We only want the Clovered Ant to be used for the test run. All other Ant operations needs to be done with a non-clovered Ant, or they’ll affect the results.

Luckily the standard build system for Ant works this way anyway. When Ant is built, a bootstrap version of Ant is built to actually do the full Ant build. We can use the bootstrap Ant as the non-clovered Ant to clover the main Ant build.

I have an Ant build file, clover.xml, which does everything for me. The steps are

  1. bootstrap Ant
  2. build -f clover.xml complete

In the second step, there are a few other targets we can use besides the "complete" target. These give different variations.

I’ll briefly explain each of the targets in the build.

  • The taskdefs define the ant-contrib and clover tasks. The ant-contrib foreach task is only used in the generation of historical data. This only has to be done once
  • setup – sets up the clover properties with the clover-setup task.
  • clover – This target does the work for a single clover run. The ant tasks clean up any old builds, build the code and build the test code. The clean and test code builds do not inherit properties preventing the clover build.compiler value from affecting these operations. The build operation on the other hand picks up the clover properties and references, so that the build.compiler property is set in the sub-build, thereby enabling Clover in the compilation. The current Ant installation is then removed. Before you use this build, your should obviously make sure it is OK to remove the current installation of Ant. Any optional libraries are copied to the install and the rest of Ant installed with the final Ant call. Once the clovered Ant is installed, it is used to run the Ant test suite, generating the clover database
  • core, all – these two targets are similar to the clover target. The differences are that these targets, clean out the clover database and also generate a clover history point at the end of the run. Additionally, the core target has a patternset so that it only clovers the Ant core, leaving out the optional tasks.
  • complete – sets the date for the history generation to the current date, does a core run, a full run and then generates the reports.
  • report – this target generates three Clover reports. It starts by setting up a common format to be used by all the reports and then generating the historical and current reports.
  • generate-history – this target uses the coreach task to generate a history point for a set of dates. The list includes a point for each month back to 2001.
  • genfordate – this does the generation of a single history point. It uses the date of the history point to checkout the version of Ant from CVS appropriate to the date and then uses the "core" and "all" targets for the actual test run.

If you are using the generate-history target you will not be able to use build.sh to do the build because CVS updates will continually change it. You will need to make a copy of the script prior to the build and use that copy instead.

It was pretty interesting to run this and watch a few years of Ant development come and go in a few hours. It’s also impressive that this same basic setup can work back to early 2001. It’s not perfect, of course, since some things (such as test.haltonfailure) only work on more recent builds.

When you are finished, you’ll want to do a final CVS update to get back to the current HEAD version.

That’s all there is to clovering Ant. The principles should be applicable to other projects, especially the generation of the historical reports.