Ant rocks. I’m now using it to automate the (ever-increasingly complex) build process for my book. Since I spend so much time complaining about things I hate, I thought I’d expound briefly on something I like.

For those of you who maintain development projects manually, and have ever missed a step and released something that didn’t compile/install/run/whatever, you owe it to yourself to check out Ant. It allows you to define an unlimited number of targetsin your project and define dependencies between them. For instance, I build versions of my book in HTML, PDF, Word, and text, and so each of these are separate targets. The HTML target does four things:

  <target name="html" depends="init">
    <copy todir="${html}">
      <fileset dir="${css}">
        <include name="*.css"/>
      </fileset>
    </copy>
  
    <copy todir="${html}/images">
      <fileset dir="${images}">
        <include name="**/*.${png}"/>
      </fileset>
    </copy>
  
    <java classname="com.icl.saxon.StyleSheet" fork="yes">
      <arg line="-ds ${xml}/diveintopython.xml ${xsl}/html.xsl"/>
      <classpath>
        <pathelement path="${saxon}"/>
      </classpath>
    </java>
  
    <exec executable="python" failonerror="yes">
      <arg line="${py}/colorize.py ${html}"/>
    </exec>
  </target>

Now, I used to have .bat files to do all this sort of thing, but Ant offers several advantages:

Try Ant. It will rock your world.

§

Respond privately

I am no longer accepting public comments on this post, but you can use this form to contact me privately. (Your message will not be published.)



§

firehosecodeplanet

© 2001–present Mark Pilgrim