2015-12-16 16:16:15 -07:00
|
|
|
<project xmlns:if="ant:if" xmlns:unless="ant:unless">
|
2015-04-26 13:01:40 -07:00
|
|
|
|
|
|
|
<property name="chapter" value="CHAPTER?"/>
|
2015-04-30 12:21:26 -07:00
|
|
|
<property name="antoutput" value="../Ant-output.txt"/>
|
2015-04-26 13:01:40 -07:00
|
|
|
|
|
|
|
<description>
|
|
|
|
Ant build.xml for the source code for chapter ${chapter}
|
2015-11-03 12:00:44 -08:00
|
|
|
Bruce Eckel On Java
|
2015-08-17 11:52:18 -06:00
|
|
|
Code available at https://github.com/BruceEckel/OnJava-Examples
|
2015-04-26 13:01:40 -07:00
|
|
|
See installation instructions in README.md
|
|
|
|
See copyright notice in CopyRight.txt
|
|
|
|
|
|
|
|
Ant available from http://ant.apache.org
|
|
|
|
|
|
|
|
To see options, type: ant -p
|
|
|
|
</description>
|
|
|
|
|
2015-12-15 11:47:04 -08:00
|
|
|
<condition property="version1.8">
|
|
|
|
<equals arg1="1.8" arg2="${ant.java.version}"/>
|
|
|
|
</condition>
|
|
|
|
|
|
|
|
|
|
|
|
<!--===========================================================-->
|
2015-04-26 13:01:40 -07:00
|
|
|
<macrodef name="jrun">
|
|
|
|
<attribute name="cls" default="NOT SET"/>
|
2015-04-27 23:59:25 -07:00
|
|
|
<attribute name="dirpath" default=""/>
|
2015-04-27 21:27:42 -07:00
|
|
|
<attribute name="arguments" default=""/>
|
2015-04-27 23:59:25 -07:00
|
|
|
<attribute name="failOnError" default="true"/>
|
2015-04-28 23:58:26 -07:00
|
|
|
<attribute name="timeOut" default="15000"/>
|
2015-04-29 17:17:02 -07:00
|
|
|
<attribute name="msg" default=""/>
|
2015-04-26 13:01:40 -07:00
|
|
|
<sequential>
|
2015-05-14 15:32:25 -07:00
|
|
|
<echo>[${chapter}] java @{cls} @{arguments} </echo>
|
|
|
|
<echo file="${antoutput}" append="true">[${chapter}] java @{cls} @{arguments} </echo>
|
2015-04-27 21:27:42 -07:00
|
|
|
<java
|
|
|
|
classname="@{cls}"
|
|
|
|
classpath="${java.class.path};${basedir};${basedir}/.."
|
2015-04-27 23:59:25 -07:00
|
|
|
dir="@{dirpath}"
|
|
|
|
failonerror="@{failOnError}"
|
2015-04-28 23:58:26 -07:00
|
|
|
fork="true"
|
2015-04-30 12:21:26 -07:00
|
|
|
timeout="@{timeOut}"
|
|
|
|
output="${antoutput}" append="true">
|
2015-04-28 14:17:58 -07:00
|
|
|
<arg line="@{arguments}"/>
|
2015-12-02 09:20:27 -08:00
|
|
|
<redirector
|
|
|
|
output="@{cls}.out"
|
|
|
|
error="@{cls}.err"
|
|
|
|
createemptyfiles="false"
|
|
|
|
append="false" />
|
2015-04-27 21:27:42 -07:00
|
|
|
</java>
|
2015-05-06 12:09:38 -07:00
|
|
|
<echo file="${antoutput}" append="true">[${chapter}] Finished: java @{cls} @{arguments} </echo>
|
2015-04-30 14:29:32 -07:00
|
|
|
<echo file="${antoutput}" append="true">@{msg} </echo>
|
|
|
|
<echo file="${antoutput}" append="true">-------------------------------- </echo>
|
2015-04-26 13:01:40 -07:00
|
|
|
</sequential>
|
|
|
|
</macrodef>
|
|
|
|
|
2015-12-15 11:47:04 -08:00
|
|
|
|
|
|
|
<!--===========================================================-->
|
2015-05-02 15:37:54 -07:00
|
|
|
<macrodef name="jrunconsole">
|
|
|
|
<attribute name="cls" default="NOT SET"/>
|
|
|
|
<attribute name="dirpath" default=""/>
|
|
|
|
<attribute name="arguments" default=""/>
|
|
|
|
<attribute name="failOnError" default="true"/>
|
|
|
|
<attribute name="timeOut" default="15000"/>
|
|
|
|
<attribute name="msg" default=""/>
|
|
|
|
<sequential>
|
2015-05-14 15:32:25 -07:00
|
|
|
<echo>[${chapter}] java @{cls} @{arguments} </echo>
|
|
|
|
<echo append="true">[${chapter}] java @{cls} @{arguments} </echo>
|
2015-05-02 15:37:54 -07:00
|
|
|
<java
|
|
|
|
classname="@{cls}"
|
|
|
|
classpath="${java.class.path};${basedir};${basedir}/.."
|
|
|
|
dir="@{dirpath}"
|
|
|
|
failonerror="@{failOnError}"
|
|
|
|
fork="true"
|
|
|
|
timeout="@{timeOut}"
|
|
|
|
>
|
|
|
|
<arg line="@{arguments}"/>
|
|
|
|
</java>
|
2015-05-06 12:09:38 -07:00
|
|
|
<echo append="true">[${chapter}] Finished: java @{cls} @{arguments} </echo>
|
2015-05-02 15:37:54 -07:00
|
|
|
<echo append="true">@{msg} </echo>
|
|
|
|
<echo append="true">-------------------------------- </echo>
|
|
|
|
</sequential>
|
|
|
|
</macrodef>
|
|
|
|
|
2015-12-16 16:16:15 -07:00
|
|
|
<macrodef name="execscript">
|
|
|
|
<attribute name="name"/>
|
|
|
|
<sequential>
|
|
|
|
<condition property="isWindows">
|
|
|
|
<os family="windows"/>
|
|
|
|
</condition>
|
|
|
|
|
|
|
|
<sequential if:true="isWindows">
|
|
|
|
<echo message="@{name}.bat"/>
|
|
|
|
<exec executable="cmd" dir=".">
|
|
|
|
<arg line="/c @{name}.bat"/>
|
|
|
|
</exec>
|
|
|
|
</sequential>
|
|
|
|
<sequential unless:true="isWindows">
|
|
|
|
<echo message="@{name}.sh"/>
|
|
|
|
<exec executable="sh" dir=".">
|
|
|
|
<arg line="@{name}.sh"/>
|
|
|
|
</exec>
|
|
|
|
</sequential>
|
|
|
|
</sequential>
|
|
|
|
</macrodef>
|
2015-04-26 13:01:40 -07:00
|
|
|
|
2015-12-15 11:47:04 -08:00
|
|
|
<!--===========================================================-->
|
|
|
|
<target name="base"
|
|
|
|
description="Build all common dependencies">
|
2015-05-02 15:37:54 -07:00
|
|
|
<javac includeantruntime="false"
|
|
|
|
classpath="${java.class.path};${basedir};${basedir}/.."
|
2015-11-11 20:20:04 -08:00
|
|
|
srcdir="${basedir}/../onjava/">
|
|
|
|
<compilerarg value="-Xmaxerrs"/>
|
|
|
|
<compilerarg value="10"/>
|
|
|
|
</javac>
|
|
|
|
<javac includeantruntime="false"
|
|
|
|
classpath="${java.class.path};${basedir};${basedir}/.."
|
|
|
|
srcdir="${basedir}/../com/">
|
2015-05-02 15:37:54 -07:00
|
|
|
<compilerarg value="-Xmaxerrs"/>
|
|
|
|
<compilerarg value="10"/>
|
|
|
|
</javac>
|
2015-12-15 11:47:04 -08:00
|
|
|
<javac includeantruntime="false"
|
|
|
|
classpath="${java.class.path};${basedir};${basedir}/.."
|
|
|
|
srcdir="${basedir}/../polymorphism/music/">
|
|
|
|
<compilerarg value="-Xmaxerrs"/>
|
|
|
|
<compilerarg value="10"/>
|
|
|
|
</javac>
|
2015-05-02 15:37:54 -07:00
|
|
|
<javac includeantruntime="false"
|
|
|
|
classpath="${java.class.path};${basedir};${basedir}/.."
|
|
|
|
srcdir="${basedir}/../typeinfo/pets/">
|
|
|
|
<compilerarg value="-Xmaxerrs"/>
|
|
|
|
<compilerarg value="10"/>
|
|
|
|
</javac>
|
2015-04-26 13:01:40 -07:00
|
|
|
<javac includeantruntime="false"
|
|
|
|
classpath="${java.class.path};${basedir};${basedir}/.."
|
2015-12-15 11:47:04 -08:00
|
|
|
srcdir="${basedir}/../collections/">
|
2015-04-26 13:01:40 -07:00
|
|
|
<compilerarg value="-Xmaxerrs"/>
|
|
|
|
<compilerarg value="10"/>
|
|
|
|
</javac>
|
2015-11-11 20:20:04 -08:00
|
|
|
<javac includeantruntime="false"
|
|
|
|
classpath="${java.class.path};${basedir};${basedir}/.."
|
2015-12-15 11:47:04 -08:00
|
|
|
srcdir="${basedir}/../generics/coffee/">
|
2015-11-11 20:20:04 -08:00
|
|
|
<compilerarg value="-Xmaxerrs"/>
|
|
|
|
<compilerarg value="10"/>
|
|
|
|
</javac>
|
2015-12-02 09:20:27 -08:00
|
|
|
<javac includeantruntime="false"
|
|
|
|
classpath="${java.class.path};${basedir};${basedir}/.."
|
2015-12-15 11:47:04 -08:00
|
|
|
srcdir="${basedir}/../enums/menu/">
|
2015-12-02 09:20:27 -08:00
|
|
|
<compilerarg value="-Xmaxerrs"/>
|
|
|
|
<compilerarg value="10"/>
|
|
|
|
</javac>
|
2015-04-26 13:01:40 -07:00
|
|
|
</target>
|
|
|
|
|
2015-12-15 11:47:04 -08:00
|
|
|
|
|
|
|
<!--===========================================================-->
|
|
|
|
<target name="build"
|
2015-04-26 13:01:40 -07:00
|
|
|
description="Build all classes in this directory"
|
2015-12-15 11:47:04 -08:00
|
|
|
depends="base">
|
2015-04-26 13:01:40 -07:00
|
|
|
<fail message="Java 8 required" unless="version1.8"/>
|
2015-05-02 15:37:54 -07:00
|
|
|
<echo message="Building '${chapter}' "/>
|
2015-04-30 14:29:32 -07:00
|
|
|
<echo file="${antoutput}" append="true" message="Building '${chapter}' "/>
|
2015-04-26 13:01:40 -07:00
|
|
|
<javac includeantruntime="false"
|
|
|
|
classpath="${java.class.path};${basedir};${basedir}/.."
|
|
|
|
debug="true"
|
2015-04-27 14:31:25 -07:00
|
|
|
excludes="${excludedfiles}"
|
2015-04-26 13:01:40 -07:00
|
|
|
srcdir="${basedir}">
|
|
|
|
<compilerarg value="-Xmaxerrs"/>
|
|
|
|
<compilerarg value="10"/>
|
|
|
|
</javac>
|
2015-05-02 15:37:54 -07:00
|
|
|
<echo message="Build '${chapter}' succeeded "/>
|
2015-04-30 14:29:32 -07:00
|
|
|
<echo file="${antoutput}" append="true" message="Build '${chapter}' succeeded "/>
|
2015-04-26 13:01:40 -07:00
|
|
|
</target>
|
|
|
|
|
2015-12-15 11:47:04 -08:00
|
|
|
|
|
|
|
<!--===========================================================-->
|
|
|
|
<target name="buildw"
|
2015-05-22 10:22:05 -07:00
|
|
|
description="Build all classes in this directory, enabling 'Unchecked' warnings"
|
2015-12-15 11:47:04 -08:00
|
|
|
depends="base">
|
2015-05-22 10:22:05 -07:00
|
|
|
<fail message="Java 8 required" unless="version1.8"/>
|
|
|
|
<echo message="Building '${chapter}' "/>
|
|
|
|
<echo file="${antoutput}" append="true" message="Building '${chapter}' "/>
|
|
|
|
<javac includeantruntime="false"
|
|
|
|
classpath="${java.class.path};${basedir};${basedir}/.."
|
|
|
|
debug="true"
|
|
|
|
excludes="${excludedfiles}"
|
|
|
|
srcdir="${basedir}">
|
|
|
|
<compilerarg value="-Xlint:unchecked"/>
|
|
|
|
<compilerarg value="-Xmaxerrs"/>
|
|
|
|
<compilerarg value="10"/>
|
|
|
|
</javac>
|
|
|
|
<echo message="Build '${chapter}' succeeded "/>
|
|
|
|
<echo file="${antoutput}" append="true" message="Build '${chapter}' succeeded "/>
|
|
|
|
</target>
|
|
|
|
|
2015-12-15 11:47:04 -08:00
|
|
|
<!--===========================================================-->
|
|
|
|
<target name="verifyclean"
|
|
|
|
description="delete ant verify output files" >
|
|
|
|
<delete>
|
|
|
|
<fileset dir="${basedir}" casesensitive="yes">
|
|
|
|
<include name="**/update_output.bat" />
|
|
|
|
<include name="**/validate_failures.txt" />
|
2015-12-16 13:50:01 -08:00
|
|
|
<include name="**/validate_successes.txt" />
|
2015-12-15 11:47:04 -08:00
|
|
|
<include name="**/strategies.txt" />
|
2015-12-16 13:50:01 -08:00
|
|
|
<include name="**/edit_errors.bat" />
|
2015-12-15 11:47:04 -08:00
|
|
|
</fileset>
|
|
|
|
</delete>
|
|
|
|
<echo message="verifyclean successful"/>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="verify"
|
2015-12-02 09:20:27 -08:00
|
|
|
description="Verify output; requires Python 3.5"
|
2015-12-15 11:47:04 -08:00
|
|
|
depends="verifyclean">
|
2015-12-02 09:20:27 -08:00
|
|
|
<exec dir="${basedir}" executable="python" failonerror="true">
|
|
|
|
<arg line="../verify_output.py" />
|
|
|
|
</exec>
|
|
|
|
</target>
|
|
|
|
|
2015-04-26 13:01:40 -07:00
|
|
|
</project>
|