<!--

   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.

-->
<project name="RasterizerTask" default="help" basedir=".">
    <!-- ================================================================= -->
    <!-- 
         This is a build project for RasterizerTask task.

         Use compile target to compile source code and help target to 
         display all available targets.

         Author: Henri Ruini
    -->
    <!-- ================================================================= -->

    <!-- == Global properties ============================================ -->
    <property name="root" value="${basedir}" />
    <!-- root: Root directory of all the other directories. -->
    <property name="lib" value="${root}/../../lib" />
    <!-- lib: Directory where the library files (jars etc.) are located. -->
    <property name="src" value="${root}/sources" />
    <!-- src: Directory for source files. -->
    <property name="build" value="${root}/build" />
    <!-- build: Directory for build results. -->
    <property name="build.classes" value="${build}/classes" />
    <!-- build.classes: Directory for compiled classes. -->
    <property name="doc" value="${root}/doc" />
    <!-- doc: Directory for documentation. -->
    <property name="doc.api" value="${doc}/javadoc" />
    <!-- doc.api: Directory for javadocs. -->



    <!-- == Targets ====================================================== -->
    <target name="help"
        description="Displays usage information.">
        <echo message="SVG Rasterizer Task build file."/>
        <echo message="Available targets are:"/>
        <echo message="  compile --> Compiles the source code."/>
        <echo message="  jar     --> Builds the JAR distribution."/>
        <echo message="  javadoc --> Generates Javadoc documentation."/>
        <echo message="  clean   --> Deletes generated directories."/>
    </target>

    <target name="prepare">
        <echo message="Using ${ant.version}."/>
        <tstamp/>
    </target>

    <target name="compile" depends="prepare"
        description="Compiles source files.">
        <mkdir dir="${build.classes}" />
        <!-- Compile code. -->
        <javac srcdir="${src}" destdir="${build.classes}" />
    </target>

    <target name="jar" depends="prepare, compile"
        description="Creates a JAR package.">

        <mkdir dir="${build}/lib" />
        <jar jarfile="${build}/lib/RasterizerTask.jar"
            basedir="${build.classes}"
            excludes="**/.svn/"
            includes="**/*.class">
        </jar>
    </target>

    <target name="javadoc" depends="prepare"
        description="Generates Javadoc documentation.">
        <!-- Clean and (re)create the javadocs directory. -->
        <delete dir="${doc.api}" />
        <mkdir dir="${doc.api}" />
        <!-- Create javadocs. -->
        <javadoc destdir="${doc.api}"
            packagenames="org.apache.tools.ant.*"
            version="false"
            author="false"
            windowtitle="Rasterizer Task Javadoc"
            doctitle="Rasterizer Task API Specification"
            bottom="Copyright &#169; 2001-2002 Apache Software Foundation. All Rights Reserved.">
            <sourcepath>
                <pathelement path="${src}" />
                <pathelement path="${root}/../../sources" />
            </sourcepath>
            <group title="SVG Rasterizer Task" packages="org.apache.tools.ant.taskdefs.optional.RasterizerTask" />
        </javadoc>
    </target>

    <target name="clean"
        description="Deletes directories created by this script.">
        <delete dir="${doc}" />
        <delete dir="${build}" />
    </target>

</project>

