<?xml version="1.0"?>
<!-- BUILD.XML complex bio 2.9 build that copies files to website for upload. -->
<!-- Build with ANT postzip jet -->
<!-- Compile and jar bio using ANT -->
<!-- Invoke with [ant clean] to erase class files and start over. -->
<!-- Invoke with [ant compile] to just compile. -->
<!-- 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. -->
<!-- Using Apache ANT version 1.10.1 -->
<!-- For details of ANT use, see http://mindprod.com/jgloss/ant.html -->
<!-- This script does not build any *.asm files. -->

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

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

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

<!-- C L E A N -->
<target name="clean">
<echo message="    :::    bio    :::    deleting files to force regeneration." />
  <delete>
    <fileset dir="com/mindprod/bio" includes="**/*.class" />
    <fileset dir="com/mindprod/bio" includes="**/*.jar" />
    <!-- leave Jet *.exe. Old versions are still useful during the build. -->
    <fileset dir="com/mindprod/bio" includes="bio29.zip" />
  </delete>
</target>

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

<!-- J A V A H must do ant javah to rebuild *.h files. -->
<target name="javah" depends="compile">
  <!-- there is no jni -->
</target>

<!-- G A T H E R -->
<target name="gather" depends="compile">
<echo message="    :::    bio    :::    gathering files to build jar/zip." />
  <!-- prepare bio.use precis from two pieces -->
    <concat destfile="com/mindprod/bio/bio.use" fixlastline="yes">
      <filelist dir="com/mindprod/bio" files="version.txt,use.txt,versionhistory.txt" />
    </concat>
    <copy file="E:/mindprod/applet/bio.html" todir="com/mindprod/bio" failonerror="false" quiet="true" overwrite="true" />
    <copy file="E:/mindprod/applet/bio.manual.html" todir="com/mindprod/bio" failonerror="false" quiet="true" overwrite="true" />
    <copy file="E:/mindprod/image/ico/bio.ico" tofile="E:/mindprod/applet/bio.ico" failonerror="false" quiet="true" overwrite="true" />
    <copy file="E:/mindprod/image/icon128/bio.png" tofile="com/mindprod/bio/bio.icon128.png" failonerror="false" quiet="true" overwrite="true" />
    <copy file="E:/mindprod/image/icon16/bio.png" tofile="com/mindprod/bio/bio.icon16.png" failonerror="false" quiet="true" overwrite="true" />
    <copy file="E:/mindprod/image/icon32/bio.png" tofile="com/mindprod/bio/bio.icon32.png" failonerror="false" quiet="true" overwrite="true" />
    <copy file="E:/mindprod/image/icon48/bio.png" tofile="com/mindprod/bio/bio.icon48.png" failonerror="false" quiet="true" overwrite="true" />
    <copy file="E:/mindprod/image/icon64/bio.png" tofile="com/mindprod/bio/bio.icon64.png" failonerror="false" quiet="true" overwrite="true" />
    <copy file="E:/mindprod/image/screenshot/bio.png" tofile="com/mindprod/bio/bio.screenshot.png" failonerror="false" quiet="true" overwrite="true" />
    <copy file="E:/mindprod/jdisplay.css" todir="com/mindprod/bio" failonerror="false" quiet="true" overwrite="true" />
    <copy file="E:/mindprod/mindprod.css" todir="com/mindprod/bio" failonerror="false" quiet="true" overwrite="true" />
    <copy file="E:/mindprod/pad/bio.xml" todir="com/mindprod/bio" failonerror="false" quiet="true" overwrite="true" />
</target>

<!-- J A R -->
<!-- Make F:\Program Files (x86)\apache-ant-1.10.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="    :::    bio    :::    genjar finding dependencies and creating jar." />
  <genjar jarfile="com/mindprod/bio/bio.jar">
    <!-- include main class and all its dependencies -->
    <class name="com.mindprod.bio.Bio" />
    <!-- Extra classes and properties to include in bio.jar -->
    <!-- Spell out each extra file individually to be included in the jar -->
    <resource file="com/mindprod/bio/han.jpg" package="com.mindprod.bio" />
    <resource file="com/mindprod/bio/shamrock.png" package="com.mindprod.bio" />
    <!-- define the manifest -->
    <manifest>
      <attribute name="Main-Class" value="com.mindprod.bio.Bio" />
      <attribute name="Application-Name" value="Bio" />
      <attribute name="Permissions" value="all-permissions" />
    </manifest>
  </genjar>

  <!-- S I G N -->
  <!-- get _your_ password from set jarsignerpassword=sesame -->
  <!-- get _your_ code-signing certificate from set cert=mindprodcert2017rsa -->
  <property environment="env" />
  <signjar jar="com/mindprod/bio/bio.jar"
    alias="${env.cert}" keystore="${env.keystore}/.keystore" storepass="${env.jarsignerpassword}"
    tsaurl="http://sha256timestamp.ws.symantec.com/sha256/timestamp" />
  <!-- bundle public key of code signing certificate for zip. -->
  <copy file="E:/mindprod/applet/${env.cert}.cer" todir="com/mindprod/bio" failonerror="true" overwrite="true" />

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

<!-- P O S T J A R -->
<target name="postjar" depends="jar">
<echo message="    :::    bio    :::    posting jar to website." />
  <!-- copy jar(s) to website -->
  <copy file="com/mindprod/bio/bio.jar" todir="E:/mindprod/applet" />
</target>

<!-- P R E J E T -->
<target name="prejet">
<echo message="    :::    bio    :::    avoid regenerating Jet executable if already done." />
  <uptodate property="jet.uptodate" targetfile="com/mindprod/bio/bio.exe">
    <srcfiles dir="com/mindprod/bio" includes="*.jar"/>
    </uptodate>
</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="    :::    bio    :::    jet compiling." />
  <exec executable="jc.exe" dir="com/mindprod/bio">
    <arg value="-DECOR=" />
    <arg value="bio.jar" />
  </exec>
  <!-- copy bio.exe to E:/sys -->
  <copy file="com/mindprod/bio/bio.exe" todir="E:/sys" />
</target>

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

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

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