<?xml version="1.0"?>
<project name="kawa-snapshot" default="all" basedir=".">
  <description>
     Batch build of Kawa with clean checkout from CVS.
     Gzipped tars for source and binary are created with timestamped file names.
     Those tars are uploaded via scp.
  </description>
  
  <target name="all" depends="clean, checkout, tar-source, build, copy-jar, check, tar-binary, upload"/>

  <target name="init" description="Set timestamped file name properties.">
     <tstamp>
       <format property="datecode" pattern="yyyyMMdd"/>
     </tstamp>
     <property name="source.tgz" value="kawa-${datecode}-src.tgz"/>
     <property name="binary.tgz" value="kawa-${datecode}-bin.tgz"/>
     <property name="kawa.jar" value="kawa-${datecode}.jar"/>
  </target>

  <target name="clean" description="Wipe out the local working copy of Kawa.">
     <delete dir="kawa"/>
  </target>

  <target name="checkout" description="Get a fresh checkout of Kawa from CVS.">
     <cvs cvsroot=":pserver:anoncvs@sources.redhat.com:/cvs/kawa" package="kawa" 
          command="checkout" failonerror="true"/>
  </target>

  <target name="tar-source" depends="init" description="Create a gzipped tar of the source files (including CVS stuff).">
     <!-- <tar destfile="${source.tgz}" basedir="." includes="kawa/**"
          defaultexcludes="no"
          longfile="gnu"  compression="gzip"/> -->
     <exec executable="tar" failonerror="true">
        <arg line="zcf ${source.tgz} kawa"/>
     </exec>
  </target>

  <target name="build" description="Configure and Make Kawa.">
     <exec dir="kawa" executable="/bin/sh" failonerror="true">
        <arg line="configure"/>
     </exec>
     <exec dir="kawa" executable="make" failonerror="true"/>
  </target>
  
  <target name="copy-jar" depends="init" description="Copy the Kawa jar to its datestamped name.">
     <copy tofile="${kawa.jar}" overwrite="true">
        <fileset dir="kawa" includes="kawa-*.jar"/>
     </copy>
  </target>

  <target name="check" description="Run the tests on the build.">
     <exec dir="kawa" executable="make" failonerror="true">
        <arg line="check"/>
     </exec>
  </target>

  <target name="tar-binary" depends="init" description="Create a gzipped tar of the build.">
     <!-- <tar destfile="${binary.tgz}" basedir="." includes="kawa/**"
          longfile="gnu"  compression="gzip"/> -->
     <exec executable="tar" failonerror="true">
        <arg line="zcf ${binary.tgz} kawa"/>
     </exec>
  </target>

  <target name="upload" depends="init">
     <exec executable="scp" failonerror="true">
       <arg line="${source.tgz} ${binary.tgz} ${kawa.jar} pagesmth@ftp.pagesmiths.com:public_html/kawa"/>
     </exec>
  </target>

</project>
