<?xml version="1.0"?>
<!-- BUILD.XML complex backuptozip build that copies files to website for upload. -->
<!-- Build with ANT zippost jet -->
<!-- Compile and jar backuptozip using ANT -->
<!-- Invoke with [ant clean] to erase class files and start over. -->
<!-- Invoke with [ant compile] to just compile. -->
<!-- Invoke with [ant javadoc] to generate javadoc. -->
<!-- Invoke with [ant jar] to compile and create jar files. -->
<!-- Invoke with [ant postjar] to post jars to the mindprod website. -->
<!-- Invoke with [ant jet] to create JET executables. -->
<!-- Invoke with [ant zip] to create source code zip files. -->
<!-- Invoke with [ant postzip] to post zip file to the mindprod website. -->
<!-- For details of ANT use, see http://mindprod.com/jgloss/ant.html -->

<!-- D E F I N I T I O N S -->
<!-- ANT.project.dir is com/mindprod/backuptozip -->
<!-- basedir is E:/ -->
<project name="backuptozip" basedir="E:/" default="jar">

<!-- extensions for zip. Case sensitive! -->
<property name="distributed.exts" value="**/*.au,**/*.asm,**/*.bat,**/*.btm,**/*.c,**/*.class,**/*.cpp,**/*.css,**/*.csv,**/*.dll,**/*.gif,**/*.h,**/*.hpp,**/*.htm,**/*.html,**/*.ico,**/*.ION,**/*.ion,**/*.jar,**/*.java,**/*.jnlp,**/*.jpg,**/*.look,**/*.png,**/*.properties,**/*.ser,**/*.sln,**/*.txt,**/*.use,**/*.vcproj,**/*.xml" />

<!-- dirs we to exclude from zip. Case sensitive! -->
<property name="nondistributed" value="**/jetpdb/**,**/Debug/**,**/Release/**" />

<!-- C L E A N -->
<target name="clean">
<echo message="    :::    backuptozip    :::    deleting files to force regeneration." />
  <delete>
    <fileset dir="com/mindprod/backuptozip" includes="**/*.class" />
    <fileset dir="com/mindprod/backuptozip" includes="**/*.jar" />
    <fileset dir="com/mindprod/backuptozip" includes="backuptozip11.zip" />
  </delete>
</target>

<!-- C O M P I L E -->
<target name="compile">
<echo message="    :::    backuptozip    :::    compiling Java tree with target=1.6" />
  <javac source="1.6" target="1.6" srcdir="com/mindprod/backuptozip" sourcepath="${basedir}" classpath="${basedir}" debug="on" includeAntRuntime="false">
    <compilerarg value="-Xlint:unchecked" />
    <compilerarg value="-Xlint:fallthrough" />
    <compilerarg value="-Xlint:deprecation" />
  </javac>
</target>

<!-- J A V A H -->
<target name="javah" depends="compile">
  <!-- nothing to do -->
</target>

<!-- G A T H E R -->
<target name="gather" depends="compile">
<echo message="    :::    backuptozip    :::    gathering files to build jar/zip." />
  <!-- prepare backuptozip.use precis from two pieces -->
    <concat destfile="com/mindprod/backuptozip/backuptozip.use" fixlastline="yes">
      <filelist dir="com/mindprod/backuptozip" files="version.txt,use.txt" />
    </concat>

  <!-- test if manual in HTML for jar/zip exists to be copied. -->
    <available property="has.manualtopackagedir" file="E:/mindprod/application/backuptozip.manual.html" />
    <antcall target="copy.manualtopackagedir" />

  <!-- test if 16x16 icon for jar/zip exists to be copied. -->
    <available property="has.icon16topackagedir" file="E:/mindprod/image/icon16/backuptozip.png" />
    <antcall target="copy.icon16topackagedir" />

  <!-- test if 32x32 icon for jar/zip exists to be copied. -->
    <available property="has.icon32topackagedir" file="E:/mindprod/image/icon32/backuptozip.png" />
    <antcall target="copy.icon32topackagedir" />

  <!-- test if 32x32 gif icon for jar/zip exists to be copied. -->
    <available property="has.icon32giftopackagedir" file="E:/mindprod/image/icon32/backuptozip.gif" />
    <antcall target="copy.icon32giftopackagedir" />

  <!-- test if 32x32 gif icon for jar/zip exists to be copied. -->
    <available property="has.icon32giftojardir" file="E:/mindprod/image/icon32/backuptozip.gif" />
    <antcall target="copy.icon32giftojardir" />

  <!-- test if Windows ico icon for jar/zip exists to be copied. -->
    <available property="has.icotopackagedir" file="E:/mindprod/image/ico/backuptozip.ico" />
    <antcall target="copy.icotopackagedir" />

  <!-- test if approx 48x48 icon for jar/zip exists to be copied. -->
    <available property="has.icon48topackagedir" file="E:/mindprod/image/icon48/backuptozip.png" />
    <antcall target="copy.icon48topackagedir" />

  <!-- test if approx 64x64 icon for jar/zip exists to be copied. -->
    <available property="has.icon64topackagedir" file="E:/mindprod/image/icon64/backuptozip.png" />
    <antcall target="copy.icon64topackagedir" />

  <!-- test if 64x64 gif icon for jar/zip exists to be copied. -->
    <available property="has.icon64giftopackagedir" file="E:/mindprod/image/icon64/backuptozip.gif" />
    <antcall target="copy.icon64giftopackagedir" />

  <!-- test if 64x64 gif icon for jar/zip exists to be copied. -->
    <available property="has.icon64giftojardir" file="E:/mindprod/image/icon64/backuptozip.gif" />
    <antcall target="copy.icon64giftojardir" />

  <!-- test if approx 128x128 icon for jar/zip exists to be copied. -->
    <available property="has.icon128topackagedir" file="E:/mindprod/image/icon128/backuptozip.png" />
    <antcall target="copy.icon128topackagedir" />

  <!-- test if ASP PAD XML for jar/zip exists to be copied. -->
    <available property="has.padtopackagedir" file="E:/mindprod/pad/backuptozip.xml" />
    <antcall target="copy.padtopackagedir" />

  <!-- test if ASP pad html for jar/zip exists to be copied. -->
    <available property="has.paddesctopackagedir" file="E:/mindprod/pad/backuptozip.html" />
    <antcall target="copy.paddesctopackagedir" />

  <!-- test if HTML to run for jar/zip exists to be copied. -->
    <available property="has.runhtmltopackagedir" file="E:/mindprod/application/backuptozip.html" />
    <antcall target="copy.runhtmltopackagedir" />

  <!-- test if screenshot for jar/zip exists to be copied. -->
    <available property="has.screenshottopackagedir" file="E:/mindprod/image/screenshot/backuptozip.png" />
    <antcall target="copy.screenshottopackagedir" />

  <!-- test if splash gif for jar/zip exists to be copied. -->
    <available property="has.splashtopackagedir" file="E:/mindprod/image/splash/backuptozip.gif" />
    <antcall target="copy.splashtopackagedir" />

  <!-- test if splash gif for jar/zip exists to be copied. -->
    <available property="has.splashtojardir" file="E:/mindprod/image/splash/backuptozip.gif" />
    <antcall target="copy.splashtojardir" />
</target>

  <!-- copy manual in HTML for jar/zip now that we know it exists. -->
    <target name="copy.manualtopackagedir" if="has.manualtopackagedir">
      <copy file="E:/mindprod/application/backuptozip.manual.html" todir="com/mindprod/backuptozip" failonerror="false" overwrite="true" />
      <copy file="E:/mindprod/mindprod.css" todir="com/mindprod/backuptozip" failonerror="false" overwrite="true" />
      <copy file="E:/mindprod/jdisplay.css" todir="com/mindprod/backuptozip" failonerror="false" overwrite="true" />
    </target>

  <!-- copy 16x16 icon for jar/zip now that we know it exists. -->
    <target name="copy.icon16topackagedir" if="has.icon16topackagedir">
      <copy file="E:/mindprod/image/icon16/backuptozip.png" tofile="com/mindprod/backuptozip/backuptozip.icon16.png" failonerror="false" overwrite="true" />
    </target>

  <!-- copy 32x32 icon for jar/zip now that we know it exists. -->
    <target name="copy.icon32topackagedir" if="has.icon32topackagedir">
      <copy file="E:/mindprod/image/icon32/backuptozip.png" tofile="com/mindprod/backuptozip/backuptozip.icon32.png" failonerror="false" overwrite="true" />
    </target>

  <!-- copy 32x32 gif icon for jar/zip now that we know it exists. -->
    <target name="copy.icon32giftopackagedir" if="has.icon32giftopackagedir">
      <copy file="E:/mindprod/image/icon32/backuptozip.gif" tofile="com/mindprod/backuptozip/backuptozipicon32.gif" failonerror="false" overwrite="true" />
    </target>

  <!-- copy 32x32 gif icon for jar/zip now that we know it exists. -->
    <target name="copy.icon32giftojardir" if="has.icon32giftojardir">
      <copy file="E:/mindprod/image/icon32/backuptozip.gif" tofile="E:/mindprod/application/backuptozipicon32.gif" failonerror="false" overwrite="true" />
    </target>

  <!-- copy Windows ico icon for jar/zip now that we know it exists. -->
    <target name="copy.icotopackagedir" if="has.icotopackagedir">
      <copy file="E:/mindprod/image/ico/backuptozip.ico" tofile="com/mindprod/backuptozip/backuptozip.ico" failonerror="false" overwrite="true" />
    </target>

  <!-- copy approx 48x48 icon for jar/zip now that we know it exists. -->
    <target name="copy.icon48topackagedir" if="has.icon48topackagedir">
      <copy file="E:/mindprod/image/icon48/backuptozip.png" tofile="com/mindprod/backuptozip/backuptozip.icon48.png" failonerror="false" overwrite="true" />
    </target>

  <!-- copy approx 64x64 icon for jar/zip now that we know it exists. -->
    <target name="copy.icon64topackagedir" if="has.icon64topackagedir">
      <copy file="E:/mindprod/image/icon64/backuptozip.png" tofile="com/mindprod/backuptozip/backuptozip.icon64.png" failonerror="false" overwrite="true" />
    </target>

  <!-- copy 64x64 gif icon for jar/zip now that we know it exists. -->
    <target name="copy.icon64giftopackagedir" if="has.icon64giftopackagedir">
      <copy file="E:/mindprod/image/icon64/backuptozip.gif" tofile="com/mindprod/backuptozip/backuptozipicon64.gif" failonerror="false" overwrite="true" />
    </target>

  <!-- copy 64x64 gif icon for jar/zip now that we know it exists. -->
    <target name="copy.icon64giftojardir" if="has.icon64giftojardir">
      <copy file="E:/mindprod/image/icon64/backuptozip.gif" tofile="E:/mindprod/application/backuptozipicon64.gif" failonerror="false" overwrite="true" />
    </target>

  <!-- copy approx 128x128 icon for jar/zip now that we know it exists. -->
    <target name="copy.icon128topackagedir" if="has.icon128topackagedir">
      <copy file="E:/mindprod/image/icon128/backuptozip.png" tofile="com/mindprod/backuptozip/backuptozip.icon128.png" failonerror="false" overwrite="true" />
    </target>

  <!-- copy ASP PAD XML for jar/zip now that we know it exists. -->
    <target name="copy.padtopackagedir" if="has.padtopackagedir">
      <copy file="E:/mindprod/pad/backuptozip.xml" todir="com/mindprod/backuptozip" failonerror="false" overwrite="true" />
    </target>

  <!-- copy ASP pad html for jar/zip now that we know it exists. -->
    <target name="copy.paddesctopackagedir" if="has.paddesctopackagedir">
      <copy file="E:/mindprod/pad/backuptozip.html" tofile="com/mindprod/backuptozip/backuptozip.paddesc.html" failonerror="false" overwrite="true" />
    </target>

  <!-- copy HTML to run for jar/zip now that we know it exists. -->
    <target name="copy.runhtmltopackagedir" if="has.runhtmltopackagedir">
      <copy file="E:/mindprod/application/backuptozip.html" todir="com/mindprod/backuptozip" failonerror="false" overwrite="true" />
      <copy file="E:/mindprod/mindprod.css" todir="com/mindprod/backuptozip" failonerror="false" overwrite="true" />
      <copy file="E:/mindprod/jdisplay.css" todir="com/mindprod/backuptozip" failonerror="false" overwrite="true" />
    </target>

  <!-- copy screenshot for jar/zip now that we know it exists. -->
    <target name="copy.screenshottopackagedir" if="has.screenshottopackagedir">
      <copy file="E:/mindprod/image/screenshot/backuptozip.png" tofile="com/mindprod/backuptozip/backuptozip.screenshot.png" failonerror="false" overwrite="true" />
    </target>

  <!-- copy splash gif for jar/zip now that we know it exists. -->
    <target name="copy.splashtopackagedir" if="has.splashtopackagedir">
      <copy file="E:/mindprod/image/splash/backuptozip.gif" tofile="com/mindprod/backuptozip/backuptozipsplash.gif" failonerror="false" overwrite="true" />
    </target>

  <!-- copy splash gif for jar/zip now that we know it exists. -->
    <target name="copy.splashtojardir" if="has.splashtojardir">
      <copy file="E:/mindprod/image/splash/backuptozip.gif" tofile="E:/mindprod/application/backuptozipsplash.gif" failonerror="false" overwrite="true" />
    </target>

<!-- J A R -->
<!-- Make apache-ant-1.7.1\lib\GenJar.jar known to ANT -->
<!-- See http://mindprod.com/jgloss/genjar.html for details -->
<taskdef resource="genjar.properties" />

<target name="jar" depends="gather">
<echo message="    :::    backuptozip    :::    genjar finding dependencies and creating jar." />
  <genjar jarfile="com/mindprod/backuptozip/backuptozip.jar">
    <!-- include main class and all its dependencies -->
    <class name="com.mindprod.backuptozip.BackupToZip" />
    <!-- Extra classes and properties to include in backuptozip.jar -->
    <!-- We include the entire truezip-6.jar, even resource properties. -->
    <!-- Unfortunately classfilter exclude has no effect on library -->
    <!-- Configure with location of truezip-6.jar -->
    <library jar="E:/Program Files/Java/jdk1.6.0_18/jre/lib/ext/truezip-6.jar" />
    <!-- define the manifest -->
    <manifest>
      <attribute name="Main-Class" value="com.mindprod.backuptozip.BackupToZip" />
    </manifest>
  </genjar>

  <!-- J A R C H E C K -->
  <exec executable="jarcheck.exe"  dir="com/mindprod/backuptozip" output="nul:" logError="true" failonerror="true">
    <arg value="backuptozip.jar" />
    <arg value="1.1" />
    <arg value="1.6" />
  </exec>
  <!-- J A R L O O K -->
  <exec executable="jarlook.exe" dir="com/mindprod/backuptozip" output="com/mindprod/backuptozip/backuptozip.look">
    <arg value="backuptozip.jar" />
  </exec>
</target>

<!-- P O S T J A R -->
<target name="postjar" depends="jar">
  <!-- nothing to do -->
</target>

<!-- P R E J E T -->
<target name="prejet">
<echo message="    :::    backuptozip    :::    avoid regenerating Jet executable if already done." />
  <uptodate property="jet.uptodate" srcfile="com/mindprod/backuptozip/backuptozip.jar" targetfile="com/mindprod/backuptozip/backuptozip.exe" />
</target>

<!-- J E T -->
<!-- Requires Excelsior JET native Java compiler jc.exe on the path -->
<!-- See http://mindprod.com/jgloss/jet.html for details -->
<target name="jet" depends="prejet" unless="jet.uptodate">
<echo message="    :::    backuptozip    :::    jet compiling." />
  <exec executable="jc.exe" dir="com/mindprod/backuptozip">
    <arg value="-DECOR=" />
    <arg value="backuptozip.jar" />
  </exec>
  <!-- copy exe to E:/sys -->
  <copy file="com/mindprod/backuptozip/backuptozip.exe" todir="E:/sys" />
</target>

<!-- P R E J A V A D O C . -->
<target name="prejavadoc">
<echo message="    :::    backuptozip    :::    avoid regenerating Javadoc if already done." />
  <uptodate property="javadoc.uptodate" targetfile="com/mindprod/backuptozip/javadoc/index.html">
    <srcfiles dir="com/mindprod/backuptozip" includes="**/*.java" />
  </uptodate>
</target>

<!-- J A V A D O C -->
<target name="javadoc" depends="prejavadoc" unless="javadoc.uptodate">
<echo message="    :::    backuptozip    :::    generating Javadoc." />
  <!-- prepare javadoc -->
  <javadoc
    author="true"
    destdir="com/mindprod/backuptozip/javadoc"
    packagenames="com.mindprod.backuptozip.*"
    sourcepath="E:/"
    use="true"
    version="true" />
</target>

<!-- Z I P -->
<target name="zip" depends="javadoc,jar">
<echo message="    :::    backuptozip    :::    preparing zip distributable." />
  <!-- Remove references to separate foot files. -->
  <exec executable="prunefoot.exe" failifexecutionfails="false" dir="com/mindprod/backuptozip">
    <arg value="backuptozip.html" />
    <arg value="backuptozip.manual.html" />
  </exec>
  <zip destfile="com/mindprod/backuptozip/backuptozip11.zip" duplicate="preserve" filesonly="true" includes="${distributed.exts}" excludes="${nondistributed}">
    <!-- zipfileset includes all subdirs as well -->
    <zipfileset dir="com/mindprod/backuptozip" prefix="com/mindprod/backuptozip" includes="${distributed.exts}" excludes="${nondistributed}" />
    <zipfileset dir="com/mindprod/common11" prefix="com/mindprod/common11" includes="${distributed.exts}" excludes="${nondistributed}" />
    <zipfileset dir="com/mindprod/ledatastream" prefix="com/mindprod/ledatastream" includes="${distributed.exts}" excludes="${nondistributed}" />
    <zipfileset dir="com/mindprod/common13" prefix="com/mindprod/common13" includes="${distributed.exts}" excludes="${nondistributed}" />
    <zipfileset dir="com/mindprod/common15" prefix="com/mindprod/common15" includes="${distributed.exts}" excludes="${nondistributed}" />
    <!-- Extra classes and properties to include in the Zip -->
    <zipfileset dir="com/mindprod/commandline" prefix="com/mindprod/commandline" includes="${distributed.exts}" excludes="${nondistributed}" />
    <zipfileset dir="com/mindprod/filter"      prefix="com/mindprod/filter"      includes="${distributed.exts}" excludes="${nondistributed}" />
    <zipfileset dir="com/mindprod/hunkio"      prefix="com/mindprod/hunkio"      includes="${distributed.exts}" excludes="${nondistributed}" />
  </zip>

  <!-- Z I P L O O K -->
  <exec executable="jarlook.exe" dir="com/mindprod/backuptozip" output="com/mindprod/backuptozip/zip.look">
    <arg value="backuptozip11.zip" />
  </exec>
</target>

<!-- P O S T Z I P -->
<target name="postzip" depends="zip,postjar">
<echo message="    :::    backuptozip    :::    posting zip to website." />
  <!-- copy precis to website -->
  <copy file="com/mindprod/backuptozip/backuptozip.use" tofile="E:/mindprod/precis/backuptozip.txt" overwrite="true" />
  <!-- copy zip to website -->
  <copy file="com\mindprod\backuptozip/backuptozip11.zip" todir="E:/mindprod/zips" overwrite="true" />
  <!-- delete old zip distributable from project and website -->
  <delete file="com/mindprod/backuptozip/backuptozip10.zip" failonerror="false" />
  <delete file="E:/mindprod/zips/backuptozip10.zip" failonerror="false" />
</target>
</project>