OnJava8-Examples/Ant-Common.xml

98 lines
3.0 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?"/>
<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-26 13:01:40 -07:00
<sequential>
2015-04-27 21:27:42 -07:00
<echo>Running: ${chapter} @{cls}</echo>
<java
classname="@{cls}"
classpath="${java.class.path};${basedir};${basedir}/.."
2015-04-27 23:59:25 -07:00
dir="@{dirpath}"
failonerror="@{failOnError}"
2015-04-27 21:27:42 -07:00
fork="true">
2015-04-27 23:59:25 -07:00
<arg value="@{arguments}"/>
2015-04-27 21:27:42 -07:00
</java>
<echo>Finished: ${chapter} @{cls}</echo>
2015-04-26 13:01:40 -07:00
<echo>--------------------------------</echo>
</sequential>
</macrodef>
2015-04-27 14:31:25 -07:00
<macrodef name="jrunp">
<attribute name="cls" default="NOT SET"/>
<attribute name="dirpath" default="NOT SET"/>
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-27 14:31:25 -07:00
<sequential>
2015-04-27 21:27:42 -07:00
<echo>Running: ${chapter} @{cls}</echo>
2015-04-27 14:31:25 -07:00
<java
classname="@{cls}"
classpath="${java.class.path};${basedir};${basedir}/.."
dir="@{dirpath}"
2015-04-27 23:59:25 -07:00
failonerror="@{failOnError}"
2015-04-27 21:27:42 -07:00
fork="true">
<arg value="@{arguments}"/>
</java>
<echo>Finished: ${chapter} @{cls}</echo>
2015-04-27 14:31:25 -07:00
<echo>--------------------------------</echo>
</sequential>
</macrodef>
2015-04-26 13:01:40 -07:00
<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"/>
<echo message="Building '${chapter}'"/>
<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>
<echo message="Build '${chapter}' succeeded"/>
</target>
<target description="delete all byproducts" name="clean">
<delete>
<fileset dir="${basedir}" includes="**/*.class"/>
<fileset dir="${basedir}" includes="**/*Output.txt"/>
<fileset dir="${basedir}" includes="**/log.txt"/>
<fileset dir="${basedir}" includes="failures"/>
</delete>
<echo message="clean successful"/>
</target>
</project>