OnJava8-Examples/Ant-Common.xml

93 lines
3.2 KiB
XML
Raw Normal View History

2015-04-27 21:27:42 -07:00
<project>
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}
Thinking in Java Director's Cut by Bruce Eckel
Code available at http://www.MindView.net
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>
<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"/>
<attribute name="msg" default=""/>
2015-04-26 13:01:40 -07:00
<sequential>
2015-04-30 14:29:32 -07:00
<echo>Running: ${chapter} @{cls}&#13;</echo>
<echo file="${antoutput}" append="true">Running: ${chapter} @{cls}&#13;</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-04-27 21:27:42 -07:00
</java>
2015-04-30 14:29:32 -07:00
<echo file="${antoutput}" append="true">Finished: ${chapter} @{cls}&#13;</echo>
<echo file="${antoutput}" append="true">@{msg}&#13;</echo>
<echo file="${antoutput}" append="true">--------------------------------&#13;</echo>
2015-04-26 13:01:40 -07:00
</sequential>
</macrodef>
<condition property="version1.8">
<equals arg1="1.8" arg2="${ant.java.version}"/>
</condition>
<target name="net_mindview_util">
<javac includeantruntime="false"
classpath="${java.class.path};${basedir};${basedir}/.."
srcdir="${basedir}/../net/mindview/util/">
<compilerarg value="-Xmaxerrs"/>
<compilerarg value="10"/>
</javac>
</target>
<target
depends="net_mindview_util"
description="Build all classes in this directory"
name="build">
<fail message="Java 8 required" unless="version1.8"/>
2015-04-30 14:29:32 -07:00
<echo file="${antoutput}" append="true" message="Building '${chapter}'&#13;"/>
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-04-30 14:29:32 -07:00
<echo file="${antoutput}" append="true" message="Build '${chapter}' succeeded&#13;"/>
2015-04-26 13:01:40 -07:00
</target>
<target description="delete all byproducts" name="clean">
<delete>
<fileset dir="${basedir}" casesensitive="yes">
<include name="**/*.class" />
<include name="**/*Output.txt" />
<include name="**/log.txt" />
<include name="failures" />
<exclude name="*.java"/>
2015-05-01 00:12:15 -07:00
<exclude name="DogsAndRobots.py PythonLists.py"/>
<exclude name="Copyright.txt Templates.cpp InstantiateGenericType.cpp Mixins.cpp"/>
<exclude name="DogsAndRobots.cpp VendingMachineInput.txt Trash.dat DDTrash.dat VTrash.dat log.prop"/>
<exclude name="Face*.gif"/>
<exclude name="build.xml"/>
</fileset>
2015-04-26 13:01:40 -07:00
</delete>
<echo message="clean successful"/>
</target>
</project>