<project name="benow-xml" default="all" basedir=".">



  <property name="app.name"      value="benow-xml"/>
  <property name="app.version"   value="1.0"/>
  <property name="lib.home" value="lib/java"/>
  <property name="build.home"    value="build/java"/>

  <property name="compile.debug"       value="true"/>
  <property name="compile.deprecation" value="false"/>
  <property name="compile.optimize"    value="true"/>

  <path id="compile.classpath">
    <fileset dir="${lib.home}">
      <include name="*.jar"/>
    </fileset>
    <pathelement path="${build.home}"/>
  </path>


  <target name="all" depends="compile"
   description="Clean build and dist, then compile"/>

  <target name="clean"
   description="Delete old build directories">
    <delete dir="${build.home}" quiet="yes"/>
    <delete quiet="yes">
      <fileset dir="." includes="**/*~" defaultexcludes="no"/>
    </delete>

   <delete dir="${dist.home}"/>
  </target>

  <target name="compile" depends="prepare"
   description="Compile Java sources">

    <!-- Compile Java classes as necessary -->
    <javac srcdir="src/java"
          destdir="${build.home}"
           debug="${compile.debug}"
        deprecation="${compile.deprecation}"

        optimize="${compile.optimize}">
        <classpath refid="compile.classpath"/>
    </javac>

  </target>

  <target name="dist" depends="javadoc"
   description="Create binary distribution">
  </target>

  <target name="jar" depends="compile"
   description="Create binary distribution">
    <mkdir dir="${lib.home}"/>

    <delete file="${app.name}.jar"/>

    <java classname="org.benow.java.scanner.ClassScanner" failonerror="true" fork="false">
      <classpath refid="compile.classpath"/>
    </java>

    <mkdir dir="${lib.home}/t"/>
    <copy todir="${lib.home}/t">
      <fileset dir="${build.home}"/>
    </copy>
    <copy todir="${lib.home}/t/META-INF" failonerror="false" file="etc/resources.list"/>
    <jar jarfile="${app.name}.jar" basedir="${lib.home}/t">
			<manifest>
				<attribute name="Built-By" value="${user.name}" />
				<attribute name="Main-Class" value="org.benow.xml.ClassMaker"/>
				<attribute name="Switcher-Default" value="Launcher"/>
			</manifest>
    </jar>
    <delete dir="${lib.home}/t"/>

    
  </target>


  <target name="javadoc" depends="compile"
   description="Create Javadoc API documentation">

    <delete dir="docs/api"/>
    <mkdir          dir="docs/api"/>
    <javadoc sourcepath="src"
                destdir="docs/api"
            windowtitle="BeNOW Documentation"
               doctitle="BeNOW Documentation"
           packagenames="ca.reachable.*,test.*">
      <link href="http://benow.ca/docs/jdk1.4/api/"/>
      <link href="http://benow.ca/docs/xalan-j_2_0_D5/"/>
      <link href="http://benow.ca/docs/xerces-1_2_3/"/>
      <link href="http://benow.ca/docs/xerces-1_2_3/"/>
      <link href="http://benow.ca/docs/jsdk2.2b/"/>
      <classpath refid="compile.classpath"/>
    </javadoc> 

  </target>



<!-- ==================== Prepare Target ================================== -->

<!--

  The "prepare" target is used to create the "build" destination directory,
  and copy the static contents of your web application to it.  If you need
  to copy static files from external dependencies, you can customize the
  contents of this task.

  Normally, this task is executed indirectly when needed.

-->

  <target name="prepare">

    <!-- Create build directory and copy static content -->
    <mkdir  dir="${build.home}"/>

    <!-- Copy static files from external dependencies as needed -->

  </target>


</project>
