<!-- 

This build script will create a directory called burn that is
_almost_ suitable for burning onto a CD.  However, there
are a number of things that should be done to this directory
before actually burning:

The PDFs in the print directory need to be manually generated.
Use the content of foo.pdf.contents to generate foo.pdf, and
and then delete the foo.pdf.contents directory.

The powerpoint and packages directory should be populated
with whatever you want to populate it with.  The
packages directory is typically filled with Linux installers
and a clean AspectJ installer.
-->

<project name="build" default="burn" basedir=".">
  <description>
    Build a CD image containing AspectJ exercises.
  </description>

  <!-- CUSTOMIZE THESE PROPERTIES -->

  <!-- this directory should hold a clean unpacked AspectJ release -->
  <property name="aj.home" value="c:/apps/aspectj" />

  <!-- this is the name of the event -->
  <property name="aj.event" value="oopsla2004" />

  <!-- NO CUSTOMIZABLE PROPERTIES BELOW HERE -->

  <property name="burndir" value="burn" />
  <property name="eventdir" value="${burndir}/aj-${aj.event}" />
  <property name="packagedir" value="${burndir}/packages" />
  <property name="printdir" value="${burndir}/print" />
  <property name="powerpointdir" value="${burndir}/powerpoint" />

  <!-- now real targets -->
  <target name="burn" depends="clean,skeleton,event,answers,printables" />

  <target name="printables" depends="skeleton">
    <delete dir="${printdir}/answers.pdf.contents" />
    <mkdir dir="${printdir}/answers.pdf.contents" />
    <copy toDir="${printdir}/answers.pdf.contents">
      <fileset dir="answers" includes="*.java" excludes="Answer.java"/>
    </copy>

    <delete dir="${printdir}/exercises.pdf.contents" />
    <mkdir dir="${printdir}/exercises.pdf.contents" />
    <copy toDir="${printdir}/exercises.pdf.contents" file="index.html" />
    <copy toDir="${printdir}/exercises.pdf.contents" file="figures_classes.gif" />
    <copy toDir="${printdir}/exercises.pdf.contents" file="${aj.home}/doc/quick.pdf" />

    <delete dir="${printdir}/install.pdf.contents" />
    <mkdir dir="${printdir}/install.pdf.contents" />
    <copy toDir="${printdir}/install.pdf.contents" file="install.txt" />
  </target>

  <target name="answers" depends="skeleton">
    <zip destfile="${packagedir}/${aj.event}-answers.zip">
      <zipfileset dir="answers"
        prefix="aj-${aj.event}/answers"
	includes="*.java"
	excludes="Answer.java"
      />
    </zip>
  </target>

  <target name="event" depends="tools,exercises">
    <filter token="aj.event" value="${aj.event}" /> 
    <copy file="install.txt" toDir="${eventdir}" filtering="yes" />
  </target>

  <target name="exercises" depends="skeleton">
    <copy toDir="${eventdir}">
      <fileset dir="."
        includes="junit.jar,base.lst,guibase.lst,*.html,support/**/*.java,figures/**/*.java,tests/**/*.java,answers/Answer.java"
      />
    </copy>
  </target>

  <target name="tools" depends="skeleton">
    <mkdir dir="${eventdir}/aspectj" />
    <filter token="aj.event" value="${aj.event}" /> 

    <copy toDir="${eventdir}/aspectj">
      <fileset dir="${aj.home}" excludes="bin/**" />
    </copy>
    <copy toDir="${eventdir}/aspectj/bin" filtering="yes">
      <fileset dir="scripts" excludes="setpaths*" />
    </copy>
    <copy toDir="${eventdir}" filtering="yes">
      <fileset dir="scripts" includes="setpaths*" />
    </copy>
    <fixcrlf srcDir="${eventdir}"
      includes="setpaths.bat,aspectj/bin/ajbrowser.bat,aspectj/bin/ajc.bat"
      eol="crlf" />
    <fixcrlf srcDir="${eventdir}"
      includes="setpaths.sh,setpaths.csh,aspectj/bin/ajbrowser,aspectj/bin/ajc"
      eol="lf" />
  </target>

  <target name="skeleton">
    <mkdir dir="${burndir}" />
    <mkdir dir="${eventdir}" />
    <mkdir dir="${packagedir}" />
    <mkdir dir="${printdir}" />
    <mkdir dir="${powerpointdir}" />
  </target>

  <target name="clean">
    <delete dir="burn" />
  </target>

  <target name="javaclean">
    <delete dir="burn" />
  </target>

</project>

