<!-- This file contains common build targets for the SAND build.
 * Most people should modify their project's local build.xml file, not this
 * master file.
 * 
 * The primary entry point targets are:
 *     all          build everything that needs to be built.
 *     clean        clean up compiled code (.class, .jar, .war etc) for the
 *                  current project only.  Do not clean up generator output.
 *     deepclean    clean all projects in the build.
 *     cleangen     delete all generator output for the current project
 *     deepcleangen cleangen all projects in the build.
 *     scrub        clean and cleangen all projects in the build.
 *     help         print help message
 * 
 * For all primary entry points, the build constructs a minimum spanning
 * tree of the project dependency graph so it can gauge the effect of any
 * global scope generators.  To handle this efficiently, each primary entry 
 * point calls the SandBuildDriver, which walks the sandproject targets
 * to build the dependency graph.
 *
 * The secondary targets are used by the primary entry points to accomplish 
 * specific tasks within the current project.  These are:
 *     build.compile
 *     clean.compile
 *     build.jar
 *     clean.jar
 *     build.javadoc
 *     clean.javadoc
 *     build.warfile
 *     clean.warfile
 *
 * Developers can call the secondary targets directly to force actions on
 * the current project if needed.  Note that not all platforms will 
 * necessarily support a .war format, but this is common enough that it 
 * is factored into the main build (it's only called if you have a webapp
 * directory).
 *
 * The following optional hook targets are called if defined:
 *
 *     prebuild/preclean
 *     build/clean.pregen
 *     build/clean.postgen
 *     build/clean.precomp
 *     build/clean.postcomp
 *     build/clean.prejar
 *     build/clean.postjar
 *     build/clean.prewar
 *     build/clean.postwar
 *     build/clean.prejarcopy
 *     build/clean.postjarcopy
 *     build/clean.predoc
 *     build/clean.postdoc
 *     postbuild/postclean
 *
 * The platform build will typically define additional targets to handle
 * deployment of code.  For example:
 *     build.wardeploy
 *     clean.wardeploy
 * etc.  See the platform build.xml for details. 
 *
 * Projects which are extending the platform to support their own technology
 * interfaces must also handle deployment of those interfaces.  So for 
 * example if you were extending the platform/tools project to include your 
 * own custom Messager or Persister implementation, you would need to modify
 * platform/tools/build/build.xml to handle deployment.  To cleanly 
 * separate your customized build, we recommend you create MyCustomBuild.xml
 * and copy MyCustomBuild.xml -> build.xml in the prebuild target.
 -->


<!--
    ********************************************
    * Custom ant task definitions
    ******************************************** 
-->
<taskdef name="sandbuild" classname="org.sandev.sandbuild.BridgeAnt2SAND" />
<taskdef name="requiredproject" classname="org.sandev.sandbuild.RequiredProject"/>
<taskdef name="sandenvfile" classname="org.sandev.sandbuild.SandEnvFile"/>
<taskdef name="sandgenerator" classname="org.sandev.sandbuild.SandGenDecl"/>
<taskdef name="sandjavadoc" classname="org.sandev.sandbuild.SandJavadoc"/>
<taskdef name="sandmanifest" classname="org.sandev.sandbuild.SandManifest"/>
<taskdef name="sandui" classname="org.sandev.sandbuild.SandUIDeployment"/>
<taskdef name="sandpersist" classname="org.sandev.sandbuild.SandPersistDef"/>
<taskdef name="sandpackager" classname="org.sandev.sandbuild.SandPackager"/>


<!--
    ********************************************
    * Global properties
    ******************************************** 
-->
<property name="build.envdir" value="./env"/>
<property name="build.syncdir" value="./sync"/>
<property name="gen.classdir" value="./genclasses"/>
<property name="gen.envdir" value="./env"/>
<property name="gen.srcdir" value="./generate"/>
<property name="gen.javadocdir" value="./genjavadoc"/>
<property name="main.classdir" value="./classes"/>
<property name="main.envdir" value="../env"/>
<property name="main.srcdir" value="../src"/>
<property name="main.docsdir" value="../docs"/>
<property name="main.javadocdir" value="../docs/javadoc"/>
<property name="main.webappdir" value="../webapp"/>
<!-- next release of sandev.  Not sure if this will be a minor rev or
     a full release so going with a minor rev number for now.
 -->
<property name="publish.releasename" value="sandev_1_3"/>

<property name="taglets" value=
 "-taglet org.sandev.generator.tags.FieldTagDecimalize
  -taglet org.sandev.generator.tags.FieldTagDefault
  -taglet org.sandev.generator.tags.FieldTagEnumint
  -taglet org.sandev.generator.tags.FieldTagFlags
  -taglet org.sandev.generator.tags.FieldTagInvalid
  -taglet org.sandev.generator.tags.FieldTagRange
  -taglet org.sandev.generator.tags.FieldTagRef
  -taglet org.sandev.generator.tags.FieldTagStringlength
  -taglet org.sandev.generator.tags.FieldTagMetatype
  -taglet org.sandev.generator.tags.FieldTagDateFormat
  -taglet org.sandev.generator.tags.NodeTagImplement
  -taglet org.sandev.generator.tags.NodeTagCall
  -taglet org.sandev.generator.tags.NodeTagReceive
  -taglet org.sandev.generator.tags.NodeTagSend
  -taglet org.sandev.generator.tags.NodeTagSubscribe
  -taglet org.sandev.generator.tags.StructTagStructmessage
  -taglet org.sandev.generator.tags.StructTagSummaryfields
  -taglet org.sandev.generator.tags.StructTagVerbforms
  -taglet org.sandev.generator.tags.StructTagFieldlayout
  -taglet org.sandev.generator.tags.GeneralTagPrintname
  -taglet org.sandev.generator.tags.GeneralTagHelp"
/>

<!--
 ********************************************
 * Top-level and init/setup targets
 ******************************************** 
-->

<!-- 
This is where to set the properties the SAND build needs to do its work.
The target is referenced via "depends" rather than "antcall" to ensure that
the properties stick around.  By default these settings read from the
environment variables.  The values can also be set directly here.
-->
<target name="checkenv" unless="env.set">
    <!-- mark the local time so we can use it for reports -->
    <tstamp/>
    <!-- pull in the runtime environment variables for reference -->
    <property environment="runenv"/>

    <!-- ****************************************
            Start of general environment settings
         **************************************** -->

    <!-- main root for referencing between dependent projects -->
        <property name="SAND_HOME" value="${runenv.SAND_HOME}"/>
    <!-- need tools for code generators -->
        <property name="JAVA_LIB" value="${runenv.JAVA_HOME}/lib"/>
    <!-- servlets, mail, and JMS (runtime optional) -->
        <property name="J2EE_LIB" value="${runenv.J2EE_HOME}/lib"/>
    <!-- JMX management linkage -->
        <property name="JMX_LIB" value="${runenv.TOMCAT_HOME}/bin"/>
    <!-- The username,password for development db access -->
        <property name="LOCDB_USERPASS" value="${runenv.LOCDB_USERPASS}"/>

    <!-- ****************************************
            End of general environment settings
         **************************************** -->

    <!-- Set flag that tells this target not to run again -->
    <property name="env.set" value="true"/>
</target>


<!--
    ********************************************
    * Primary entry point targets
    ******************************************** 
-->

<target name="all" depends="checkenv">
    <sandbuild entry="all"/>
</target>

<target name="clean" depends="checkenv">
    <sandbuild entry="clean"/>
</target>

<target name="deepclean" depends="checkenv">
    <sandbuild entry="deepclean"/>
</target>

<target name="cleangen" depends="checkenv">
    <sandbuild entry="cleangen"/>
</target>

<target name="deepcleangen" depends="checkenv">
    <sandbuild entry="deepcleangen"/>
</target>

<target name="scrub" depends="checkenv">
    <sandbuild entry="scrub"/>
</target>

<!-- used for required project call optimization -->
<target name="standby">
    <sandbuild entry="standby"/>
</target>

<target name="help">
    <echo message="The primary entry point targets are:"/>
    <echo message="all          build everything that needs to be built."/>
    <echo message="clean        clean up compiled code (.class, .jar, .war etc) for the"/>
    <echo message="             current project only. Do not clean up generator output."/>
    <echo message="deepclean    clean all projects in the build."/>
    <echo message="cleangen     delete all generator output for the current project"/>
    <echo message="deepcleangen cleangen all projects in the build."/>
    <echo message="scrub        clean and cleangen all projects in the build."/>
    <echo message="help         print this help message"/>
</target>


<!--
    ********************************************
    * Secondary entry point targets
    ******************************************** 
-->

<target name="build.compile.generators">
  <antcall target="build.compile">
    <param name="classdir" value="${gen.classdir}" />
    <param name="srcdir" value="${gen.srcdir}" />
    <!-- genJarDir is set by the SandBuildDriver for all projects -->
    <param name="envdir" value="${genJarDir}" />
  </antcall>
</target>

<target name="clean.compile.generators">
  <antcall target="clean.compile">
    <param name="classdir" value="${gen.classdir}" />
  </antcall>
</target>


<target name="build.jar.generators">
  <antcall target="build.jar">
    <param name="jarname" value="${ant.project.name}_gen.jar" />
    <param name="classdir" value="${gen.classdir}" />
    <!-- genJarDir is set by the SandBuildDriver for all projects -->
    <param name="envdir" value="${genJarDir}" />
  </antcall>
</target>

<target name="clean.jar.generators">
  <antcall target="clean.jar">
    <param name="jarname" value="${ant.project.name}_gen.jar" />
    <!-- genJarDir is set by the SandBuildDriver for all projects -->
    <param name="envdir" value="${genJarDir}" />
  </antcall>
</target>


<target name="build.fulljavadoc.generators">
  <antcall target="build.javadoc">
    <!-- genJarDir is set by the SandBuildDriver for all projects -->
    <param name="envdir" value="${genJarDir}" />
    <param name="srcdir" value="${gen.srcdir}" />
    <param name="javadocdir" value="${gen.javadocdir}" />
    <param name="additional" value=" -quiet" />
  </antcall>
</target>

<target name="clean.javadoc.generators">
  <antcall target="clean.javadoc">
    <param name="javadocdir" value="${gen.javadocdir}" />
  </antcall>
</target>

<target name="build.incjavadoc.generators">
    <echo message="    skipped..."/>
<!--
    This work is deactivated for now, since index.html gets overwritten
    even with -noindex specified.  So effectively 
        generateJavadoc="update" 
    has the same behavior as 
        generateJavadoc="static"
    for this release.  There is a pretty long investigation associated
    with this for reference when we revisit.  It seems possible if we
    use a custom doclet.

  <antcall target="build.incjavadoc"> -->
    <!-- genJarDir is set by the SandBuildDriver for all projects --> <!--
    <param name="envdir" value="${genJarDir}" />
    <param name="srcdir" value="${gen.srcdir}" />
    <param name="javadocdir" value="${gen.javadocdir}" />
    <param name="additional" value=" -quiet" /> --> 
    <!-- changedGenSrc is set by the SandProject --> <!--
    <param name="srcfiles" value="${changedGenSrc}" />
  </antcall>
-->
</target>


<target name="build.compile.source">
  <antcall target="build.compile">
    <param name="classdir" value="${main.classdir}" />
    <param name="srcdir" value="${main.srcdir}" />
    <param name="envdir" value="${main.envdir}" />
  </antcall>
</target>

<target name="clean.compile.source">
  <antcall target="clean.compile">
    <param name="classdir" value="${main.classdir}" />
  </antcall>
</target>


<target name="build.jar.source">
  <antcall target="build.jar">
    <param name="jarname" value="${DeploymentPrefix}${ant.project.name}.jar" />
    <param name="classdir" value="${main.classdir}" />
    <param name="envdir" value="${main.envdir}" />
  </antcall>
</target>

<target name="clean.jar.source">
  <antcall target="clean.jar">
    <param name="jarname" value="${DeploymentPrefix}${ant.project.name}.jar" />
    <param name="envdir" value="${main.envdir}" />
  </antcall>
</target>


<target name="build.fulljavadoc.main" unless="no.mainjavadoc">
  <antcall target="build.javadoc">
    <param name="envdir" value="${main.envdir}" />
    <param name="srcdir" value="${main.srcdir}" />
    <param name="javadocdir" value="${main.javadocdir}" />
    <param name="additional" 
        value="${taglets} -tagletpath ${genJarDir}/basics_gen.jar -quiet" />
  </antcall>
</target>

<target name="clean.javadoc.main">
  <antcall target="clean.javadoc">
    <param name="javadocdir" value="${main.javadocdir}" />
  </antcall>
</target>

<target name="build.incjavadoc.main">
    <echo message="    skipped..."/>
<!--
    see comments under build.incjavadoc.generators
-->
</target>


<!--
    ********************************************
    * Working targets
    ******************************************** 
-->

                <!-- C O M P I L E -->

<!-- Compile source files into .class files -->
<!-- Parameters: -->
<!--    classdir: directory where compiled .class files go -->
<!--    srcdir: source directory of files to be compiled -->
<!--    envdir: .jar files to be added to compilation classpath -->
<!--    debug: javac flag -->
<target name="build.compile">
    <mkdir dir="${classdir}"/>
    <mkdir dir="${envdir}"/>
    <!-- For javac, memoryMaximumSize="128m" only works if using aforked VM.
         Set the ANT_OPTS environment variable to -Xmx128m instead. -->
    <javac srcdir="${srcdir}" destdir="${classdir}" 
           debug="${debug}" deprecation="on">
        <classpath>
            <pathelement path="${runenv.CLASSPATH}"/>
            <fileset dir="${envdir}">
                <include name="*.jar"/>
            </fileset>
            <fileset dir="${JAVA_LIB}">
                <include name="*.jar"/>
            </fileset>
            <fileset dir="${J2EE_LIB}">
                <include name="*.jar"/>
            </fileset>
            <fileset dir="${JMX_LIB}">
                <include name="*.jar"/>
            </fileset>
        </classpath>
    </javac>
</target>

<!-- Remove all .class files created by this project -->
<!-- Parameters: -->
<!--    classdir - directory where .class files go -->
<target name="clean.compile">
    <delete dir="${classdir}"/>
</target>


                <!-- J A R -->

<!-- Create the .jar file for the project -->
<!-- Parameters: -->
<!--    envdir - env directory, where jarfiles live -->
<!--    jarname - name of the jarfile to be created -->
<!--    classdir - directory to get .class files from for jar creation -->
<target name="build.jar">
    <mkdir dir="${envdir}"/>
    <jar jarfile="${envdir}/${jarname}" basedir="${classdir}"/>
</target>

<!-- Remove  the .jar file created by this project -->
<!-- Parameters: -->
<!--    envdir - env directory, where jarfiles live -->
<!--    jarname - name of the jarfile to delete -->
<target name="clean.jar">
    <!-- on windows, the file sometimes shows up as "in use" from the     -->
    <!-- previous generator pass, and can't be deleted.  We need to keep  -->
    <!-- going anyway.                                                    -->
    <delete file="${envdir}/${jarname}" failonerror="false"/>
</target>


                <!-- J A V A D O C -->

<!-- Build javadoc documentation -->
<!-- Parameters: -->
<!--    envdir: env directory. Everything from envdir goes in the javadoc classpath to avoid warnings -->
<!--    srcdir: source directory of files to be javadoc'ed -->
<!--    javadocdir: destination directory of javadoc files (created automatically by javadoc task) -->
<!--    packagenames: comma-separated list of packages to be javadoc'ed  -->
<!--    additional: any other parameters to pass through to javadoc -->
<target name="build.javadoc">
    <mkdir dir="${envdir}"/>
    <javadoc sourcepath="${srcdir}" 
        destdir="${javadocdir}" 
        failonerror="true"
        packagenames="${packagenames}"
        additionalparam="${additional}"
        maxmemory="128m"
        >
        <classpath>
            <pathelement path="${runenv.CLASSPATH}"/>
            <fileset dir="${envdir}">
                <include name="*.jar"/>
            </fileset>
            <fileset dir="${JAVA_LIB}">
                <include name="*.jar"/>
            </fileset>
            <fileset dir="${J2EE_LIB}">
                <include name="*.jar"/>
            </fileset>
            <fileset dir="${JMX_LIB}">
                <include name="*.jar"/>
            </fileset>
        </classpath>
    </javadoc>
</target>


<!-- like build.javadoc except it uses specific filenames -->
<target name="build.incjavadoc">
    <mkdir dir="${envdir}"/>
    <javadoc csvsourcefiles="${srcfiles}" 
        destdir="${javadocdir}" 
        failonerror="true"
        additionalparam="-noindex -notree -nonavbar -nohelp"
        >
        <classpath>
            <pathelement path="${runenv.CLASSPATH}"/>
            <fileset dir="${envdir}">
                <include name="*.jar"/>
            </fileset>
            <fileset dir="${JAVA_LIB}">
                <include name="*.jar"/>
            </fileset>
            <fileset dir="${J2EE_LIB}">
                <include name="*.jar"/>
            </fileset>
            <fileset dir="${JMX_LIB}">
                <include name="*.jar"/>
            </fileset>
        </classpath>
    </javadoc>
</target>


<!-- Clean all javadoc documentation -->
<!-- Parameters: -->
<!--    javadocdir - directory where javadoc files live -->
<target name="clean.javadoc">
    <delete dir="${javadocdir}"/>
</target>


                <!-- G E N E R A T E -->

<!-- SandBuildDriver target -->
<target name="generate">
  <mkdir dir="${main.envdir}"/>  <!-- verify existence -->
  <antcall target="generate.code">
    <param name="envdir" value="${main.envdir}" />
  </antcall>
</target>


<!-- Hard clean just the generator output.  If you get into a circular
build problem due to a partially compiled generator tag, use this
target to scrub just the generator classes so you can get back to
work.  This solves the problem where some partially compiled generator
classes are out of sync with others and the build doesn't make it
through the initial setup it needs.
-->
<target name="scrubgen" depends="checkenv">
  <delete dir="${SAND_HOME}/apps/basics/build/genclasses"/>
  <delete dir="${SAND_HOME}/apps/ui/build/genclasses"/>
  <delete file="${SAND_HOME}/apps/basics/build/env/basics_gen.jar"
          failonerror="false"/>
  <delete file="${SAND_HOME}/apps/basics/build/env/ui_gen.jar"
          failonerror="false"/>
</target>


<!-- run the generators. -->
<!-- 
 * Parameters set by SandBuildDriver:
 *   declFiles: a CSV list of all the struct and node declaration source files
 *   genPath: path to find generators.  The GenDriverDoclet needs to find the
 *            generator classes, and this parameter describes where those
 *            classes are.
-->
<target name="generate.code">
    <sandjavadoc csvsourcefiles="${declFiles}"
        failonerror="true">
        <doclet name="org.sandev.generator.GenDriverDoclet"
                path="${genPath}" />
        <classpath>
            <pathelement path="${runenv.CLASSPATH}"/>
            <fileset dir="${envdir}">
                <include name="*.jar"/>
            </fileset>
            <fileset dir="${JAVA_LIB}">
                <include name="*.jar"/>
            </fileset>
            <!-- these are not necessary to process simple struct or
                 node declarations, but a node declaration can extend
                 another class (for example HttpServlet), which javadoc
                 then needs to find.  So we load everything into the
                 classpath that we do for compilation. -->
            <fileset dir="${J2EE_LIB}">
                <include name="*.jar"/>
            </fileset>
            <fileset dir="${JMX_LIB}">
                <include name="*.jar"/>
            </fileset>
        </classpath>
    </sandjavadoc>
</target>


<!--
    ********************************************
    If there is a webapp directory, then we need to build a .war file for
    deployment.  Like .jar files, these are placed into the env directory. 
    ******************************************** 
-->

<target name="build.warfile">
  <antcall target="build.warfile.work">
    <param name="subproj" value="${main.webappdir}" />
    <param name="warname" value="${ant.project.name}" />
  </antcall>
</target>

<target name="clean.warfile">
  <antcall target="clean.warfile.work">
    <param name="subproj" value="${main.webappdir}" />
    <param name="warname" value="${ant.project.name}" />
  </antcall>
</target>

<!-- Parameters: -->
<!--    warname: base name for the .war file without the .war extension -->
<target name="build.warfile.work">
    <uptodate property="${warname}.uptodate" 
              targetfile="${main.envdir}/${DeploymentPrefix}${warname}.war">
        <srcfiles dir="${subproj}" excludes="META-INF/MANIFEST.MF"/>
    </uptodate>
    <antcall target="build.war"/>
</target>

<!-- if the war task finds a web.xml file in the WEB-INF directory it
     issues a warning.  So we have to to exclude it from the files
     and the specify it explicitely as a parameter. -->
<target name="build.war" unless="${warname}.uptodate">
    <mkdir dir="${subproj}/META-INF"/>
    <sandmanifest dir="${subproj}/META-INF" addClassPath="false"/>
    <mkdir dir="${subproj}/src" />
    <mkdir dir="${subproj}/WEB-INF" />
    <mkdir dir="${subproj}/WEB-INF/classes" />
    <mkdir dir="${subproj}/WEB-INF/lib" />
    <antcall target="build.compile">
      <param name="classdir" value="${subproj}/WEB-INF/classes" />
      <param name="srcdir" value="${subproj}/src" />
      <param name="envdir" value="${subproj}/WEB-INF/lib" />
    </antcall>
    <war destfile="${main.envdir}/${DeploymentPrefix}${warname}.war" 
         webxml="${subproj}/WEB-INF/web.xml"
         manifest="${subproj}/META-INF/MANIFEST.MF"
         basedir="${subproj}"
         excludes="WEB-INF/*,META-INF/*,src/**,DTD/**"/>
</target>

<target name="clean.warfile.work">
    <delete file="${subproj}/META-INF/MANIFEST.MF" failonerror="false"/>
    <delete dir="${subproj}/META-INF" failonerror="false"/>
    <antcall target="clean.compile">
      <param name="classdir" value="${subproj}/WEB-INF/classes" />
    </antcall>
    <delete dir="${subproj}/WEB-INF/lib" failonerror="false"/>
    <delete dir="${subproj}/sandui" failonerror="false"/>
    <!-- on windows, the file sometimes shows up as "in use" from the     -->
    <!-- previous generator pass, and can't be deleted.  We need to keep  -->
    <!-- going anyway.                                                    -->
    <delete file="${envdir}/${DeploymentPrefix}${warname}.war" failonerror="false"/>
</target>


<!--
    ********************************************
    Convenience targets
    ******************************************** 
-->
<!-- Nuke everything (including dependencies) and rebuild -->
<!-- Parameters: none -->
<target name="rebuild">
    <antcall target="deepclean"/>
    <antcall target="all"/>
</target>


<!--
    ********************************************
    Publication targets
    ********************************************
-->

<!-- Zip all docs and copy the zip to a web server -->
<target name="publish.docs" depends="checkenv,release.zip.docs">
    <input addproperty="publish.server" defaultvalue="sandev.org"
           message="server to publish to [sandev.org]:"/>
    <input addproperty="publish.username" defaultvalue="unspecified"
           message="web admin username [no default]:"/>
    <input addproperty="publish.password" defaultvalue="unspecified"
           message="web admin password [no default]:"/>
    <input addproperty="publish.remotedir" defaultvalue="sandev.org/html"
           message="remote dir [sandev.org/html]:"/>
    <scp todir="${publish.username}:${publish.password}@${publish.server}:${publish.remotedir}"
         trust="true">
        <fileset dir="${SAND_HOME}">
            <include name="sand.zip"/>
        </fileset>
    </scp>
    <delete file="${SAND_HOME}/sand.zip"/>
    <!-- Unpack the docs on the server -->
    <get src="http://${publish.server}/cgi-bin/unzip.cgi" 
        dest="${SAND_HOME}/unused.foo" 
        verbose="true"/> 
    <delete file="${SAND_HOME}/unused.foo"/>
</target>

<!-- Zip everything except CVS files and FTP the result to sourceforge -->
<target name="publish.release" depends="publish.release.zip">
    <taskdef name="ftp" classname="org.apache.tools.ant.taskdefs.optional.net.FTP"/>
    <ftp server="upload.sourceforge.net"
        userid="anonymous"
        password="build@sandservices.com"
        remotedir="incoming"
        depends="yes"
        passive="yes"
        ignoreNoncriticalErrors="yes"
        >
        <fileset dir="${SAND_HOME}/../">
            <include name="${publish.releasename}.zip"/>
        </fileset>
    </ftp>
    <delete file="${SAND_HOME}/../${publish.releasename}.zip"/>
    <echo message="don't forget to update publish.releasename in mainbuild.xml"/>
</target>

<!-- Zip all the open source code minus the CVS files -->
<target name="publish.release.zip" depends="scrub">
    <zip destfile="${SAND_HOME}/../${publish.releasename}.zip">
        <fileset dir="${SAND_HOME}/../">
            <include name="sand/apps/basics/**/*.*"/>
            <include name="sand/apps/ui/**/*.*"/>
            <include name="sand/apps/TaskHeap/**/*.*"/>
            <include name="sand/apps/docs/**/*.*"/>
            <include name="sand/deploy/TaskHeapDemo/**/*.*"/>
            <include name="sand/deploy/docs/**/*.*"/>
            <include name="sand/docs/**/*.*"/>
            <include name="sand/platform/**/*.*"/>
            <exclude name="cvs"/>
        </fileset>
    </zip>
</target>

<!-- zip only the open source docs into SAND_HOME/sand.zip -->
<target name="release.zip.docs" depends="checkenv">
    <zip destfile="${SAND_HOME}/sand.zip">
        <fileset dir="${SAND_HOME}/../">
            <include name="sand/*.html"/>
            <include name="sand/docs/**/*.*"/>
            <include name="sand/apps/docs/**/*.*"/>
            <include name="sand/apps/basics/docs/**/*.*"/>
            <include name="sand/apps/basics/build/**/*.xml"/> <!-- script links -->
            <include name="sand/apps/basics/**/genjavadoc/**/*.*"/>
            <include name="sand/apps/ui/docs/**/*.*"/>
            <include name="sand/apps/ui/**/genjavadoc/**/*.*"/>
            <include name="sand/apps/TaskHeap/docs/**/*.*"/>
            <include name="sand/apps/TaskHeap/**/genjavadoc/**/*.*"/>
            <include name="sand/apps/TaskHeap/src/**/*.java"/> <!-- examples -->
            <include name="sand/deploy/docs/**/*.*"/>
            <include name="sand/deploy/TaskHeapDemo/docs/**/*.*"/>
            <include name="sand/platform/**/docs/**/*.*"/>
            <include name="sand/platform/**/genjavadoc/**/*.*"/>
            <exclude name="cvs"/>
        </fileset>
    </zip>
</target>

<!-- zip all the docs into SAND_HOME/sand.zip -->
<target name="zip.docs" depends="checkenv">
    <zip destfile="${SAND_HOME}/sand.zip">
        <fileset dir="${SAND_HOME}/../">
            <include name="sand/**/docs/**/*.*"/>
            <include name="sand/**/genjavadoc/**/*.*"/>
            <include name="sand/*.html"/>
            <!-- for struct and node example links: -->
            <include name="sand/apps/TaskHeap/src/**/*.java"/>
            <!-- for build script links -->
            <include name="sand/**/build/**/*.xml"/>
            <exclude name="cvs"/>
        </fileset>
    </zip>
</target>

<!-- zip all the executable .jar/.war/.sar files into SAND_HOME/sandexe.zip -->
<target name="zip.exe" depends="checkenv">
    <zip destfile="${SAND_HOME}/sandexe.zip">
        <fileset dir="${SAND_HOME}/platform/tools/env">
            <include name="*.jar"/>
            <include name="*.war"/>
            <include name="*.sar"/>
        </fileset>
    </zip>
</target>


<!-- interactive convenience target for publish.spec -->
<target name="pubspec">
  <input addproperty="publish.server" defaultvalue="ftp.taskheap.com"
         message="Enter the server name [ftp.taskheap.com]:" />
  <input addproperty="publish.username" defaultvalue="webadmin"
         message="Enter the FTP username [webadmin]:" />
  <input addproperty="publish.password" defaultvalue="UNKNOWN"
         message="Enter the FTP username [UNKNOWN]:" />
  <input addproperty="publish.remotedir" defaultvalue="/opt/tomcat5/TaskHeap/output/${DeploymentPrefix}"
         message="Enter the server directory [/opt/tomcat5/TaskHeap/output/${DeploymentPrefix}/]:" />
  <antcall target="publish.spec" />
</target>


<!-- publish the functional spec docsite -->
<!-- Parameters: -->
<!--    publish.server - address of the destination system -->
<!--    publish.username - destination system FTP username -->
<!--    publish.password - destination system FTP password -->
<!--    publish.remotedir - remote directory for docsite -->
<target name="publish.spec" depends="checkenv">
    <taskdef name="ftp" classname="org.apache.tools.ant.taskdefs.optional.net.FTP"/>
    <echo message="sending funcspec docfiles"/>
    <ftp server="${publish.server}"
        userid="${publish.username}"
        password="${publish.password}"
        remotedir="${publish.remotedir}"
        depends="yes"
        passive="yes"
        ignoreNoncriticalErrors="yes"
        >
        <fileset dir="../docs/funcspec">
            <include name="*.*"/>
        </fileset>
    </ftp>
    <echo message="sending supporting images"/>
    <ftp server="${publish.server}"
        userid="${publish.username}"
        password="${publish.password}"
        remotedir="${publish.remotedir}/images"
        depends="yes"
        passive="yes"
        ignoreNoncriticalErrors="yes"
        >
        <fileset dir="../docs/funcspec/images">
            <include name="*.*"/>
        </fileset>
    </ftp>
</target>




<!--
*****************************************************************************
*****************************************************************************
*****************************************************************************
****                                                                     ****
****                   End of mainbuild.xml                              ****
****                                                                     ****
*****************************************************************************
*****************************************************************************
*****************************************************************************
-->

