<project name="build-site" default="docs" basedir=".">

    <!-- Initialization properties -->
    <property name="project.name" value="ant"/>
    <property name="docs.src"     location="xdocs"/>
    <property name="docs.dest"    location="docs"/>
    <property name="project.file" value="stylesheets/project.xml" />
    <property name="site.dir"     location="../jakarta-site2" />
    <property name="templ.path"   location="xdocs/stylesheets" />
    <property name="velocity.props"   location="${docs.src}/velocity.properties" />

    <path id="anakia.classpath">
        <fileset dir="${site.dir}/lib">
            <include name="*.jar"/>
        </fileset>
    </path>

    <target name="prepare">    
        <available classname="org.apache.velocity.anakia.AnakiaTask" 
                   property="AnakiaTask.present">
            <classpath refid="anakia.classpath"/>
        </available>
    </target>

    <target depends="prepare" name="prepare-error" unless="AnakiaTask.present">
        <echo>
            AnakiaTask is not present! Please check to make sure that 
            velocity.jar is in your classpath.
        </echo>
    </target>

    <target name="docs" depends="prepare-error" if="AnakiaTask.present">
        <taskdef name="anakia" classname="org.apache.velocity.anakia.AnakiaTask">
            <classpath refid="anakia.classpath"/>
        </taskdef>
        
        <anakia basedir="${docs.src}" destdir="${docs.dest}/"
             extension=".html" style="./site.vsl"
             projectFile="${project.file}"
             excludes="**/stylesheets/** faq.xml"
             includes="**/*.xml"
             lastModifiedCheck="true"
             templatePath="${templ.path}"
             velocityPropertiesFile="${velocity.props}">
        </anakia>

        <anakia basedir="${docs.src}" destdir="${docs.dest}/"
             extension=".html" style="./faq.vsl"
             projectFile="${project.file}"
             includes="faq.xml"
             lastModifiedCheck="true"
             templatePath="${templ.path}"
             velocityPropertiesFile="${velocity.props}">
        </anakia>
    </target>
    
    <target name="javadocs">
      <ant antfile="build.xml" target="dist_javadocs">
        <property name="dist.javadocs" value="${docs.dest}/manual/api" />
      </ant>
    </target>
    
    <target name="all" depends="docs, javadocs"/>
</project>
