<?xml version="1.0" encoding="UTF-8"?>

<!--
**************************************************
Ant build file for the mobileok-servlet project.

Enter
 ant build
... on the command-line to compile the project.

Enter
 ant build-jar
... on the command-line to build the JAR package
 mobileok-servlet-1.0.jar

Note the project depends on the following
packages not included in the JAR:
- saxon9.jar
- commons-lang.jar
- the servlet package servlet.jar
- and the mobileOK Checker java library
(TODO: explain the above list more precisely)
**************************************************
-->
<project basedir="." default="build" name="mobileok-servlet">

  <description>mobileOK Checker HTTP servlet build script.</description>

  <property name="name" value="${ant.project.name}"/>
  <property name="version" value="1.0"/>
  <property name="jar" value="${name}-${version}.jar"/>
  <property name="war" value="${name}-${version}.war"/>
  <!--
      The servlet depends on the mobileOK Checker Java library.
      See: http://dev.w3.org/cvsweb/2007/mobileok-ref/
      Update the path according to the location of the library binaries.
  -->
  <property name="mobileok-checker-build" value="../../2007/mobileok-ref/build" />

  <path id="main.build.classpath">
    <pathelement path="${mobileok-checker-build}"/>
    <fileset dir="lib">
      <include name="*.jar"/>
    </fileset>
  </path>

  <target name="init">
    <tstamp/>
  </target>

  <target depends="init" name="build">
    <mkdir dir="build"/>
    <javac source="1.5"
	   target="1.5"
	   deprecation="true"
	   optimize="true"
	   debug="true"
	   destdir="build"
	   srcdir="src">
      <classpath refid="main.build.classpath"/>
    </javac>
    <java classname="org.w3c.mwi.mobileok.basic.xslt.XSLTCompiler" fork="true">
      <classpath>
	<path location="${mobileok-checker-build}"/>
	<path location="build"/>
	<path location="lib/saxon9.jar"/>
      </classpath>
      <arg line="build/org/w3c/mwi/mobileok/basic/servlet/xslt"/>
    </java>
    <java classname="org.w3c.mwi.mobileok.basic.xslt.XSLTCompiler" fork="true">
      <classpath>
	<path location="${mobileok-checker-build}"/>
	<path location="build"/>
	<path location="lib/saxon9.jar"/>
      </classpath>
      <arg line="build/org/w3c/mwi/mobileok/ext/directinput/xslt"/>
    </java>
    <copy todir="build">
      <fileset dir="src">
        <include name="**/*.xml"/>
	<include name="**/*.xsl"/>
	<include name="**/*.sxx"/>
      </fileset>
    </copy>
  </target>

  <target depends="init,build" name="build-jar">
    <jar jarfile="${jar}">
      <fileset dir="build"/>
    </jar>
  </target>

  <target depends="init,build" name="build-war">
    <war destfile="${war}" webxml="WEB-INF/web.xml">
      <classes dir="build"/>
      <lib dir="lib"/>
      <fileset dir="ui"/>
    </war>
  </target>

  <target depends="init" name="clean">
    <delete dir="build"/>
    <delete file="${jar}"/>
    <delete file="${war}"/>
  </target>

</project>

