Monday, May 21, 2007

Design pattern of build.xml

I read Philip's code of project hackystat-sensorbase-uh and was quite pleased with the design pattern of build configuration. Basically build.xml is very light-weight. It does the following tasks only:
  • Define environment variable prefix
  • Check java version (5 and 6 are required)
  • Check ANT version (1.7 is required)
  • Check JUNIT version (4.3.1 is required)
  • Check RESTLET_HOME
  • Check JAXB_HOME
  • Define compile classpath
  • Define compile task
It is amazing small compare to Jupiter's build.xml, which has 825 lines. It does include build files: checkstyle.build.xml, junit.build.xml, sclc.build.xml etc. to do the extra work. Each of them only depends on build.xml. You can find a line like the following in them:

<import file="build.xml"/>

I experimented this configuration design pattern on jupiter. It worked surprisingly well. Very nice work!

No comments: