<?xml version="1.0"?>
<!-- BUILD.XML complex wassup 2.6 build that copies files to website for upload. -->
<!-- Build with ANT postzip jet -->
<!-- Compile and jar wassup 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/wassup -->
<!-- basedir is E:/ -->
<project name="wassup" 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="    :::    wassup    :::    deleting files to force regeneration." />
  <delete>
    <fileset dir="com/mindprod/wassup" includes="**/*.class" />
    <fileset dir="com/mindprod/wassup" includes="**/*.jar" />
    <!-- leave Jet *.exe. Old versions are still useful during the build. -->
    <fileset dir="com/mindprod/wassup" includes="wassup26.zip" />
  </delete>
</target>

<!-- C O M P I L E -->
<target name="compile">
<echo message="    :::    wassup    :::    compiling Java tree with target=1.8" />
  <javac source="1.8" target="1.8" srcdir="com/mindprod/wassup" 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="    :::    wassup    :::    gathering files to build jar/zip." />
  <!-- prepare wassup.use precis from two pieces -->
    <concat destfile="com/mindprod/wassup/wassup.use" fixlastline="yes">
      <filelist dir="com/mindprod/wassup" files="version.txt,use.txt,versionhistory.txt" />
    </concat>
    <copy file="E:/mindprod/applet/wassup.html" todir="com/mindprod/wassup" failonerror="false" quiet="true" overwrite="true" />
    <copy file="E:/mindprod/applet/wassup.manual.html" todir="com/mindprod/wassup" failonerror="false" quiet="true" overwrite="true" />
    <copy file="E:/mindprod/image/ico/wassup.ico" tofile="E:/mindprod/applet/wassup.ico" failonerror="false" quiet="true" overwrite="true" />
    <copy file="E:/mindprod/image/icon128/wassup.png" tofile="com/mindprod/wassup/wassup.icon128.png" failonerror="false" quiet="true" overwrite="true" />
    <copy file="E:/mindprod/image/icon16/wassup.png" tofile="com/mindprod/wassup/wassup.icon16.png" failonerror="false" quiet="true" overwrite="true" />
    <copy file="E:/mindprod/image/icon32/wassup.png" tofile="com/mindprod/wassup/wassup.icon32.png" failonerror="false" quiet="true" overwrite="true" />
    <copy file="E:/mindprod/image/icon48/wassup.png" tofile="com/mindprod/wassup/wassup.icon48.png" failonerror="false" quiet="true" overwrite="true" />
    <copy file="E:/mindprod/image/icon64/wassup.png" tofile="com/mindprod/wassup/wassup.icon64.png" failonerror="false" quiet="true" overwrite="true" />
    <copy file="E:/mindprod/image/screenshot/wassup.png" tofile="com/mindprod/wassup/wassup.screenshot.png" failonerror="false" quiet="true" overwrite="true" />
    <copy file="E:/mindprod/jdisplay.css" todir="com/mindprod/wassup" failonerror="false" quiet="true" overwrite="true" />
    <copy file="E:/mindprod/mindprod.css" todir="com/mindprod/wassup" failonerror="false" quiet="true" overwrite="true" />
    <copy file="E:/mindprod/pad/wassup.xml" todir="com/mindprod/wassup" 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="    :::    wassup    :::    genjar finding dependencies and creating jar." />
  <genjar jarfile="com/mindprod/wassup/wassup.jar">
    <!-- include main class and all its dependencies -->
    <class name="com.mindprod.wassup.Wassup" />
    <!-- define the manifest -->
    <manifest>
      <attribute name="Main-Class" value="com.mindprod.wassup.Wassup" />
      <attribute name="Application-Name" value="Wassup" />
      <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/wassup/wassup.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/wassup" failonerror="true" overwrite="true" />

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

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

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

<!-- Z I P -->
<target name="zip" depends="jar">
<echo message="    :::    wassup    :::    preparing zip distributable." />
  <!-- Remove references to separate foot files. -->
  <exec executable="prunefoot.exe" failifexecutionfails="false" dir="com/mindprod/wassup">
    <arg value="wassup.html" />
    <arg value="wassup.manual.html" />
  </exec>
  <zip destfile="com/mindprod/wassup/wassup26.zip" duplicate="preserve" filesonly="true" includes="${distributed.exts}" excludes="${nondistributed}">
    <!-- zipfileset includes all subdirs as well -->
    <zipfileset dir="com/mindprod/wassup" prefix="com/mindprod/wassup" 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}" />
  </zip>

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

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