<!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at
   
         http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<!--
    $Id$
-->
<project name="JNet" default="all" basedir=".">

<!-- ========== Initialize Properties ===================================== -->

  <property file="build.properties"/>                <!-- Component local   -->


<!-- ========== External Dependencies ===================================== -->

  <!-- The directories corresponding to your necessary dependencies -->
  <property name="junit.home"              value="/usr/local/junit3.8.1"/>
  <property name="junit.jar"               value="${junit.home}/junit.jar"/>


<!-- ========== Component Declarations ==================================== -->

  <!-- The name of this component -->
  <property name="component.name"          value="jnet"/>

  <!-- The primary package name of this component -->
  <property name="component.package"       value="org.apache.commons.jnet"/>

  <!-- The title of this component -->
  <property name="component.title"         value="Commons JNet"/>

  <!-- The current version number of this component -->
  <property name="component.version"       value="1.0.0-SNAPSHOT"/>

  <!-- The base directory for compilation targets -->
  <property name="build.home"              value="target"/>

  <!-- The base directory for component sources -->
  <property name="source.home"             value="src/main/java"/>


<!-- ========== Compiler Defaults ========================================= -->

  <!-- source JDK version (should be same as maven.compile.source) -->
  <property name="compile.source"          value="1.3"/>

  <!-- target JDK version (should be same as maven.compile.target) -->
  <property name="compile.target"          value="1.3"/>

  <!-- Should Java compilations set the 'debug' compiler option? -->
  <property name="compile.debug"           value="true"/>

  <!-- Should Java compilations set the 'deprecation' compiler option? -->
  <property name="compile.deprecation"     value="false"/>

  <!-- Should Java compilations set the 'optimize' compiler option? -->
  <property name="compile.optimize"        value="true"/>

  <!-- Construct compile classpath -->
  <path id="compile.classpath">
    <pathelement location="${build.home}/classes"/>
  </path>

<!-- ========== Executable Targets ======================================== -->


  <target name="all" depends="clean,jar,javadoc" description="Clean and build jar"/>

  <target name="clean" description="Clean build directory">
    <delete    dir="${build.home}"/>
  </target>

  <target name="init" description="Initialize">
    <echo message="-------- ${component.title} ${component.version} --------"/>
    <mkdir dir="${build.home}"/>
  </target>

  <target name="compile" depends="init" description="Compile component">
    <mkdir dir="${build.home}/classes"/>
    <javac  srcdir="${source.home}"
           destdir="${build.home}/classes"
             source="${compile.source}"
             target="${compile.target}"
             debug="${compile.debug}"
       deprecation="${compile.deprecation}"
          optimize="${compile.optimize}">
      <classpath refid="compile.classpath"/>
    </javac>
  </target>

  <target name="jar" depends="compile" description="Create Jar">

    <mkdir dir="${build.home}/classes/META-INF"/>
    <copy file="LICENSE.txt" tofile="${build.home}/classes/META-INF/LICENSE.txt"/>
    <copy file="NOTICE.txt"  tofile="${build.home}/classes/META-INF/NOTICE.txt"/>

    <manifest file="${build.home}/MANIFEST.MF">
        <attribute name="Specification-Title"      value="${component.title}"/>
        <attribute name="Specification-Version"    value="${component.version}"/>
        <attribute name="Specification-Vendor"     value="The Apache Software Foundation"/>
        <attribute name="Implementation-Title"     value="${component.title}"/>
        <attribute name="Implementation-Version"   value="${component.version}"/> 
        <attribute name="Implementation-Vendor"    value="The Apache Software Foundation"/>
        <attribute name="Implementation-Vendor-Id" value="org.apache"/>
        <attribute name="X-Compile-Source-JDK"     value="${compile.source}"/>
        <attribute name="X-Compile-Target-JDK"     value="${compile.target}"/>
    </manifest>

    <jar    jarfile="${build.home}/commons-${component.name}-${component.version}.jar"
            basedir="${build.home}/classes"
           manifest="${build.home}/MANIFEST.MF"/>
  </target>

  <target name="javadoc" depends="compile" description="Create Javadoc documentation">
    <mkdir dir="${build.home}/apidocs"/>
    <tstamp>
        <format property="current.year" pattern="yyyy"/>
    </tstamp>
    <javadoc sourcepath="${source.home}"
                destdir="${build.home}/apidocs"
           packagenames="org.apache.commons.*"
                 author="true"
                private="true"
                version="true"
               doctitle="&lt;h1&gt;${component.title} (Version ${component.version})&lt;/h1&gt;"
            windowtitle="${component.title} (Version ${component.version})"
                 bottom="Copyright (c) 2002-${current.year}  Apache Software Foundation"
           classpathref="compile.classpath" />
  </target>

</project>

