magpiebrain

Sam Newman's site, a Consultant at ThoughtWorks

I’m currently working on a project with a relatively large (~2000 line) Ant build file, with several supplemental files. The first thing that’s struck me, is that something about the nature of Ant itself makes people treat it very differently from the code it’s building. Rules concerning consistency, testing, maintainability and even common sense seem to go out the window. Whilst it’s true that Ant doesn’t go out of its way to help us – there is little tool support and the XML syntax is fundamentally unsuited to a program (which is really what an Ant file is) – if developers engaged their brain a little more, they’d make life a little easier for everybody.

I’m going to revisit some of the problems with Ant at a later date, but today I’d like to focus on one particular annoyance – the use of the full stop in naming of targets and properties.

As I see it, there are three ways to use a full stop. Firstly, as a space:



  ...


Secondly as a way of defining a build hierarchy:



  ...



  ...


And finally, seemingly at random:



  ...



  ...


The main build file I’m working with has examples of all three. Personally I can accept either of the first two approaches, but please be consistent. In fact, please use the same rigour in creating your build files as you do when coding!

Advertisements

8 Responses to “Ant and the use of the full stop”

  1. Sam Newman

    I’m trying “scons”:http://www.scons.org/ out now, but it’s Java support is leaving a little to be desired. I should probably start by tring to build something small, rather than our existing codebase with the 2000 line ant file πŸ™‚

    Reply
  2. kief

    (Whips out ruler) – our main build file is 2817 lines, including the very occasional comment. Plus we’ve got a few other build files for testing and cvsing.

    Reply
  3. Sam Newman

    We have split some tasks out, but the very nature of spliting stuff out can lead to complexity. We need to rewrite the whole thing to be honest, but will do it bit by bit – we’ll create clean, new sub-ant files which we’ll make calls to, and let the rest of the file remain awful. Trying to clean up a 2000 ant file during active development in one fell swoop is a recipie for disaster

    Reply
  4. Sam Newman

    I kind of like period for hierarchy with camel case for spaces, as this fits with most peoples Java style, and ant is mostly used to build Java after all. Really though, I’d just like things to be consistent πŸ™‚

    Reply

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

Basic HTML is allowed. Your email address will not be published.

Subscribe to this comment feed via RSS

%d bloggers like this: