<?xml version="1.0"?>

<!DOCTYPE book [

<!-- default sources -->
<!ENTITY % ent._shared SYSTEM "../_shared/_shared.ant-ent.xml">
%ent._shared;
]>


<project name="GroboUtilsWebsite" default="main" basedir=".">
    &inc._shared;
    
    
    <!-- directories -->
<!--    <property name="dirs.api-docs" value="${basedir}/docs" /> -->
    <property name="dirs.import" value="${basedir}/import" />
    <property name="dirs.outdir" value="${basedir}/out" />
    <property name="dirs.xdocs" value="${basedir}/xdocs" />

    <property name="libs.xalan" value="${libs.xalan.current}" />
    
    <property name="input.style.dir.relative" value="xdocs/style" />
    <property name="input.style.relative"
        value="${input.style.dir.relative}/style.xsl" />
    <property name="input.style.absolute"
        value="${basedir}/${input.style.relative}" />
    
    <!-- Targets -->
    <target name="main" >
        <echo>
****************************************************
Use target 'deploy' to build the website.
****************************************************
        </echo>
    </target>
    
    
    
    <target name="deploy" depends="init,clean,docs,copies,unzip" />

    <target name="clean">
        <delete dir="${dirs.outdir}" failonerror="no" />
        <delete file="${input.style.dir.relative}/input-summary.xml" />
    </target>
    
    <target name="init">
        <tstamp/>
    </target>
    
    <target name="docs" depends="init">
        <!-- create the base document part -->
        
        <style
            basedir="${_shared.xdoc.dir.tmp}"
            destdir="${dirs.xdocs}"
            force="yes"
            style="${dirs.xdocs}/allprojects.xsl"
            includes="summary.xml"
            extension="1.xml"
        >
            <classpath>
                <pathelement location="${libs.xalan}" />
            </classpath>
        </style>
        <copy file="${dirs.xdocs}/summary1.xml"
            tofile="${dirs.xdocs}/allprojects.xml"
            overwrite="true" />
        <delete file="${dirs.xdocs}/summary1.xml" />
        <antcall target="subdocs">
            <param name="arg-subdir" value="" />
        </antcall>
        <delete file="${dirs.xdocs}/allprojects.xml" />
        
        <!-- Note: need to automate this! -->
        <antcall target="subproject">
            <param name="proj" value="codecoverage" />
        </antcall>
        <antcall target="subproject">
            <param name="proj" value="pmti" />
        </antcall>
        <antcall target="subproject">
            <param name="proj" value="testing-autodoc" />
        </antcall>
        <antcall target="subproject">
            <param name="proj" value="testing-junit" />
        </antcall>
        <antcall target="subproject">
            <param name="proj" value="testing-mbtf" />
        </antcall>
        <antcall target="subproject">
            <param name="proj" value="testing-tp" />
        </antcall>
        <antcall target="subproject">
            <param name="proj" value="uicapture" />
        </antcall>
        <antcall target="subproject">
            <param name="proj" value="util-classes" />
        </antcall>
        <antcall target="subproject">
            <param name="proj" value="util-datastruct" />
        </antcall>
        <antcall target="subproject">
            <param name="proj" value="util-io" />
        </antcall>
        <antcall target="subproject">
            <param name="proj" value="util-states" />
        </antcall>
        <antcall target="subproject">
            <param name="proj" value="util-thread" />
        </antcall>
        <antcall target="subproject">
            <param name="proj" value="util-xml" />
        </antcall>
    </target>
    
    <!-- Create documents in the sub-packages.
         Arguments: arg-subdir
      -->
    <target name="subdocs">
        <copy file="${_shared.xdoc.dir.tmp}/summary.xml"
            tofile="${input.style.dir.relative}/input-summary.xml"
            overwrite="true"/>
        <mkdir dir="${dirs.outdir}/${arg-subdir}" />
        <style
            basedir="${dirs.xdocs}/${arg-subdir}"
            destdir="${dirs.outdir}/${arg-subdir}"
            force="yes"
            style="${input.style.absolute}"
            includes="*.xml"
        >
            <classpath>
                <pathelement location="${libs.xalan}" />
            </classpath>
        </style>
        <delete file="${input.style.dir.relative}/input-summary.xml" />
    </target>
    
    
    <target name="subproject-1">
        <available property="subproject.exists"
            file="${basedir}/../${proj}/deploy" type="dir" />
    </target>
    <target name="subproject" depends="subproject-1" if="subproject.exists">
        <mkdir dir="${dirs.outdir}/${proj}" />
        <copy todir="${dirs.outdir}/${proj}" flatten="yes">
            <fileset dir="${basedir}/../${proj}/deploy/">
                <include name="*/docs/**" />
                <exclude name="*/docs/api/**" />
            </fileset>
        </copy>
    </target>

    
    
    <target name="copies" depends="init" >
        <antcall target="copy-dir">
            <param name="copy-source" value="${dirs.import}/samples" />
            <param name="copy-dest" value="samples" />
        </antcall>
        <antcall target="copy-dir">
            <param name="copy-source" value="${dirs.import}/test" />
            <param name="copy-dest" value="docs" />
        </antcall>
        <antcall target="copy-dir">
            <param name="copy-source" value="${dirs.import}/images" />
            <param name="copy-dest" value="images" />
        </antcall>
        <copy todir="${dirs.outdir}" >
            <fileset dir="${dirs.import}">
                <include name="*" />
            </fileset>
        </copy>
    </target>
    
    <target name="copy-dir" depends="init" >
        <mkdir dir="${dirs.outdir}/${copy-dest}" />
        <copy todir="${dirs.outdir}/${copy-dest}" overwrite="yes">
            <fileset dir="${copy-source}">
                <include name="*" />
                <include name="**/*" />
                <exclude name="**/CVS/*" />
                <exclude name="**/CVS/**/*" />
            </fileset>
        </copy>
    </target>
    
    <target name="unzip" >
        <mkdir dir="${dirs.outdir}/docs" />
        <mkdir dir="${dirs.outdir}/docs/java" />
        <!--
        <antcall target="unzip-groboutils-docs-old">
            <param name="version" value="0.9.0" />
        </antcall>
        <antcall target="unzip-groboutils-docs-old">
            <param name="version" value="0.9.1a" />
        </antcall>
        <antcall target="unzip-groboutils-docs-old">
            <param name="version" value="0.9.1b" />
        </antcall>
        <antcall target="unzip-groboutils-docs-old">
            <param name="version" value="0.9.1c" />
        </antcall>
        -->
        <antcall target="unzip-groboutils-docs-old">
            <param name="version" value="0.9.1d" />
        </antcall>
        
        <mkdir dir="${dirs.outdir}/docs/testing" />
        <!--
        <antcall target="unzip-testing-docs-old">
            <param name="version" value="0.9.0" />
        </antcall>
        <antcall target="unzip-testing-docs">
            <param name="version" value="0.9.1" />
        </antcall>
        -->
        <antcall target="unzip-testing-docs">
            <param name="version" value="0.9.2" />
        </antcall>
        
        <!--
        <antcall target="unzip-groboutils-docs">
            <param name="version" value="1.0.0a" />
        </antcall>
        -->
        
        <antcall target="unzip-groboutils-docs">
            <param name="version" value="1" />
        </antcall>
        
        <antcall target="unzip-groboutils-docs">
            <param name="version" value="2" />
        </antcall>
    </target>
    
    <target name="unzip-groboutils-docs-old" >
        <mkdir dir="${dirs.outdir}/docs/java/${version}" />
        <unzip src="${dirs.import}/javadoc/GroboUtils-doc-${version}.zip"
            dest="${dirs.outdir}/docs/java/${version}"
            overwrite="yes" />
    </target>
    
    <target name="unzip-groboutils-docs" >
        <mkdir dir="${dirs.outdir}/docs/projects/${version}" />
        <unzip src="${dirs.import}/javadoc/GroboUtils-${version}-doc.zip"
            dest="${dirs.outdir}/docs/projects/${version}"
            overwrite="yes" />
    </target>
    
    <target name="unzip-testing-docs-old" >
        <mkdir dir="${dirs.outdir}/docs/testing/${version}" />
        <unzip src="${dirs.import}/javadoc/GroboTesting-doc-${version}.zip"
            dest="${dirs.outdir}/docs/testing/${version}"
            overwrite="yes" />
    </target>
    
    <target name="unzip-testing-docs" >
        <mkdir dir="${dirs.outdir}/docs/testing/${version}" />
        <unzip src="${dirs.import}/javadoc/GroboTesting-${version}-doc.zip"
            dest="${dirs.outdir}/docs/testing/${version}"
            overwrite="yes" />
    </target>
    
    
</project>
