<?xml version="1.0"?>
<!--

  Ant Buildfile for MOA Common component

  $Id$

-->
<project name="moa.common" default="package" basedir=".">
  <property environment="env"/>
  <property name="src" value="src"/>
  <property name="res" value="res"/>
  <property name="tmp" value="tmp"/>
  <property name="compile" value="${tmp}/compile"/>
  <property name="dist" value="${tmp}/dist"/>
  <property name="lib" value="lib"/>
  <property name="lib.jaxp" value="${lib}/jaxp-1.2_01"/>
  <property name="lib.jaxen" value="${lib}/jaxen-1.0"/>
  <property name="lib.xerces" value="${lib}/xerces-j-2.4.0"/>
  <property name="lib.xalan" value="${lib}/xalan-j-2.5.1"/>
  <property name="lib.iaik-jce" value="${lib}/iaik-jce-3.0.6"/>
  <property name="lib.jsse" value="${lib}/jsse-1.0.3_03"/>
  <property name="lib.junit" value="${lib}/junit-3.8.1"/>
  <property name="lib.commons-logging" value="${lib}/commons-logging-1.0.4"/>
  <property name="compile-classpath" value="
                   ${lib.jaxp}/jaxp-api.jar;
                   ${lib.jaxp}/dom.jar;
                   ${lib.xerces}/xercesImpl.jar;
                   ${lib.jaxen}/jaxen-core.jar;
                   ${lib.jaxen}/jaxen-dom.jar;
                   ${lib.jaxen}/saxpath.jar;
                   ${lib.xalan}/xalan.jar;
                   ${lib.iaik-jce}/iaik_jce_full.jar;
                   ${lib.jsse}/jcer.jar;
                   ${lib.jsse}/jnet.jar;
                   ${lib.jsse}/jsse.jar;
                   ${lib.junit}/junit.jar;
                   ${lib.commons-logging}/commons-logging-api.jar"/>
                   
  <!-- set up directories etc. -->
  <target name="init">
    <tstamp/>
    <dirname property="dist.moa-common-jar" file="${env.MOA_COMMON_JAR}"/>
    <dirname property="dist.moa-common-test-jar" 
             file="${env.MOA_COMMON_TEST_JAR}"/>
    <mkdir dir="${tmp}"/>
    <mkdir dir="${compile}"/>
    <mkdir dir="${dist.moa-common-jar}"/>
    <mkdir dir="${dist.moa-common-test-jar}"/>
  </target>

  <!-- compile everything -->
  <target name="compile" depends="init">
    <javac destdir="${compile}" classpath="${compile-classpath}" debug="on">
      <src path="${src}"/>
    </javac>
  </target>

  <!-- package jar file -->
  <target name="package" depends="compile">
    <jar destfile="${env.MOA_COMMON_JAR}">
      <fileset dir="${compile}" excludes="test/**"/>
      <fileset dir="${res}"/>
    </jar>
    <jar destfile="${env.MOA_COMMON_TEST_JAR}">
      <fileset dir="${compile}"/>
      <fileset dir="${res}"/>
    </jar>
  </target>
  
  <!-- distribute everything -->
  <target name="dist-all" depends="package"/>
  
  <!-- clean temporary files -->
  <target name="clean">
    <delete dir="${tmp}"/>
  </target>
</project>