<!-- DrJava Build Script -->
<!-- This build script is based on the template located at "trunk/misc/build-template.xml"
in the DrJava Subversion repository. In general, changes made to the script should be
reflected in the template as well. -->
<project name="drjava" default="help">
<!-- Don't use or inherit the CLASSPATH environment variable for anything -->
<property name="build.sysclasspath" value="ignore" />
<property environment="env" />
<property name="java14-home" value="${env.JAVA14_HOME}" />
<property name="clover-jar" value="${env.CLOVER_JAR}" />
<property name="launch4j-home" value="${env.LAUNCH4J_HOME}" />
<property name="findbugs-home" value="${env.FINDBUGS_HOME}" />
<!-- Extension containing various tools, including "for" and "if" -->
<taskdef resource="net/sf/antcontrib/antlib.xml" classpath="lib/buildlib/ant-contrib.jar"/>
<!-- Retroweaver task, used to convert Java 5.0 class files to be compatible with an earlier JVM;
also checks class references to insure that there are no dependencies on 1.5 APIs -->
<taskdef name="retroweaver" classpath="lib/buildlib/retroweaver-all-1.2.3.jar"
classname="com.rc.retroweaver.ant.RetroWeaverTask" />
<!-- Extension that defines the "extendclasspath" task. This should be a standard feature of Ant, but
as long as it's not, we can use this extension from the Clover developers. -->
<taskdef resource="com/cenqua/ant/antlib.xml" classpath="lib/buildlib/cenquatasks.jar" />
<!-- fornum task, used for test-repeat -->
<taskdef name="fornum" classname="edu.rice.cs.plt.ant.ForNumTask" classpath="lib/buildlib/plt-ant.jar" onerror="report" />
<!-- findbugs task -->
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="lib/buildlib/findbugs-ant.jar" />
<!-- launch4j task, used to create the Windows executable -->
<taskdef name="launch4j" classname="net.sf.launch4j.ant.Launch4jTask">
<classpath>
<pathelement location="${launch4j-home}/launch4j.jar" />
<pathelement location="${launch4j-home}/lib/xstream.jar" />
</classpath>
</taskdef>
<extendclasspath path="lib/buildlib/junit.jar" />
<!-- Load the property file if it exists -->
<if>
<isset property="drjava-props" />
<then>
<!-- drjava-props has been set, make sure the file exists -->
<available property="drjava-props-exists" file="${drjava-props}"/>
<fail message="Can't find property file ${drjava-props}." unless="drjava-props-exists" />
<property file="${drjava-props}"/>
</then>
</if>
<property name="readable-project-name" value="DrJava" />
<property name="src-working-dir" value="src/edu/rice/cs/drjava" />
<property name="main-class" value="edu.rice.cs.drjava.DrJava" />
<property name="svn-repository" value="https://drjava.svn.sourceforge.net/svnroot/drjava" />
<property name="is-development" value="yes" /> <!-- Development or stable release -->
<property name="tag-append" value="" /> <!-- "stable", "beta", or none -->
<!-- Default settings for properties -->
<property name="test-spec" value="*" />
<property name="test-repeat" value="1" />
<property name="test-timeout" value="1440" />
<property name="test-formatter" value="oneline" />
<property name="test-halt" value="false" />
<property name="test-drjava-config" value="testFiles/drjava.basic.config" />
<property name="test.drjava.config" value="${test.drjava.config}" />
<property name="benchmark-count" value="5" />
<property name="benchmark-skip" value="1" />
<property name="force-server" value="no" />
<property name="debug" value="void" />
<property name="plt.debug.log" value="${debug}" />
<property name="error" value="popup" />
<property name="plt.error.log" value="${error}" />
<property name="svn-working-dir" value="${basedir}" />
<property name="clean-can-fail" value="yes" />
<fileset id="libs" dir="lib" includes="*.jar" /> <!-- Only include jars that are at the top level (not in buildlib) -->
<!-- ************
Help Targets
************ -->
<target name="help" description="Print general build script information">
<echo message="----------------------------------------------------------------------" />
<echo message="${readable-project-name} Build Scripts" />
<echo message="----------------------------------------------------------------------" />
<echo message="Type 'ant -projecthelp' or 'ant -p' to see the list of targets." />
<echo message="Type 'ant options' to see the list of customizable options." />
<echo message="" />
<echo message="For this build file to function properly, the following environment" />
<echo message="variables may need to be defined (depending on the target invoked):" />
<echo message="JAVA14_HOME: Home folder of the Java 1.4 JRE or J2SDK" />
<echo message="PATH: 'svn' needs to refer to the Subversion client executable" />
<echo message="CLOVER_JAR: Location of the Clover jar file" />
<echo message="FINDBUGS_HOME: Location of the FindBugs installation" />
<echo message="LAUNCH4J_HOME: Location of the Launch4j installation (used to " />
<echo message=" generate a Windows application)." />
<echo message="" />
<echo message="Ant may also require the following, depending on your platform:" />
<echo message="JAVA_HOME: Location of the JDK (many targets here require Java 5+)" />
<echo message="ANT_HOME: Location of Ant" />
<echo message="Note that CLASSPATH will be ignored -- classes on the system classpath" />
<echo message="will not be visible during the build process." />
</target>
<target name="options" description="Print the list of customizable options">
<echo message="----------------------------------------------------------------------" />
<echo message="${readable-project-name} Build Script Customizable Options" />
<echo message="----------------------------------------------------------------------" />
<echo message="The following properties may be defined on the command line or in the" />
<echo message="ANT_ARGS environment variable (using '-Dname=value') for custom" />
<echo message="behavior:" />
<echo message="" />
<echo message="drjava-props: An external file defining a collection of properties to" />
<echo message=" load. The file contains 'name=value' pairs, one per" />
<echo message=" line, equivalent to '-Dname=value' at the command line" />
<echo message="test-drjava-config: Location of the DrJava configuration file to use" />
<echo message=" in tests (equivalent to setting the property" />
<echo message=" 'test.drjava.config';" />
<echo message=" default: testFiles/drjava.basic.config)" />
<echo message="test-spec: A matching string for filtering the tests to be run; may be" />
<echo message=" comma-delimited to run multiple test sets" />
<echo message="test-repeat: The number (>=1) of times the tests should be repeated" />
<echo message="test-timeout: A time limit (in minutes) for running a test set" />
<echo message="test-formatter: The kind of formatter to use for test results: one of" />
<echo message=" 'quiet', 'oneline', 'brief', 'plain', or 'xml'" />
<echo message=" (default: oneline)" />
<echo message="test-halt: Whether unit testing should stop after the *first* failure"/>
<echo message=" (default: no)" />
<echo message="benchmark-count: Number of revisions to test during benchmarking"/>
<echo message=" (default: 5)" />
<echo message="benchmark-skip: Number of 'PREV' updates to perform between benchmark" />
<echo message=" runs (default: 1)" />
<echo message="force-server: Whether the '-server' option should always be used when" />
<echo message=" running or testing (Default: no)" />
<echo message="debug: Type of the debug log when running or testing: one of 'stdout'," />
<echo message=" 'stderr', 'file', 'assert', 'popup', or 'void' (equivalent to" />
<echo message=" setting the property 'plt.debug.log'; default: void)" />
<echo message="error: Type of the error log when running or testing: one of 'stdout'," />
<echo message=" 'stderr', 'file', 'assert', 'popup', or 'void' (equivalent to" />
<echo message=" setting the property 'plt.error.log'; default: popup)" />
<echo message="clean-can-fail: Whether the failure of a 'clean' operation can halt" />
<echo message=" the build (default: yes)" />
</target>
<!-- ************
Build Target
************ -->
<target name="build" depends="test-14-in-15, jar-14"
description="Shortcut for 'test-14-in-15' and 'jar-14'">
</target>
<!-- *************************
Source-generating Targets
************************* -->
<property name="code-status-source" value="${src-working-dir}/CodeStatus.orig" />
<property name="code-status-target" value="${src-working-dir}/CodeStatus.java" />
<property name="version-source" value="${src-working-dir}/Version.orig" />
<property name="version-target" value="${src-working-dir}/Version.java" />
<target name="generate-source" depends="resolve-development-value, resolve-version-tag"
description="Generate the CodeStatus and Version source files">
<filter token="DEVELOPMENT" value="${development-value}" />
<filter token="DATE" value="${DSTAMP}" />
<filter token="TIME" value="${TSTAMP}" />
<echo message="Processing ${code-status-source}" />
<copy file="${code-status-source}" tofile="${code-status-target}" filtering="yes" />
<echo message="Processing ${version-source}" />
<copy file="${version-source}" tofile="${version-target}" filtering="yes" />
<!-- Any additional files to be generated may be processed here -->
</target>
<!-- Matches source files that are generated. Search is relative to the base directory
(NOT "src", since "src-working-dir" is defined relative to the base). This is used
by "clean". -->
<patternset id="generated-sources">
<include name="${code-status-target}" />
<include name="${version-target}" />
<!-- Additional generated sources should be listed here -->
</patternset>
<!-- *******************
Compilation Targets
******************* -->
<target name="compile" depends="compile-15" description="Shortcut for 'compile-15'">
</target>
<target name="compile-15" depends="generate-source, do-compile, copy-resources, unjar-libs"
description="Compile all source files (after generating the source)">
</target>
<target name="do-compile" depends="assert-15, resolve-java15-tools">
<echo message="Compiling src directory to classes/base and classes/test" />
<mkdir dir="classes/base" />
<mkdir dir="classes/test" />
<!-- Move any test classes back to base to prevent recompilation -->
<move todir="classes/base">
<fileset dir="classes/test" />
</move>
<javac srcdir="src" destdir="classes/base" source="1.5" target="1.5" sourcepath=""
debug="on" optimize="off" deprecation="on" includeAntRuntime="no" fork="yes">
<classpath>
<!-- TODO: Remove this dependency on tools.jar by refactoring and moving all the dependent
debugger code into the "platform" module -->
<pathelement location="${java15-tools}" />
<fileset refid="libs" />
<pathelement location="lib/buildlib/junit.jar" />
<pathelement location="classes/base" />
</classpath>
<compilerarg value="-Xlint" />
<!-- Ignore serial warnings, because they occur for every Throwable definition (among others) -->
<compilerarg value="-Xlint:-serial" />
<!-- Use the next line to compile against other sources, ignoring any unneeded classes.
This can be useful in creating a pruned version of a jar file for the lib directory.
(You must also clear the sourcepath="" option.)
<include name="${src-working-dir}/**/*.java" /> -->
</javac>
<move todir="classes/test">
<fileset dir="classes/base">
<include name="**/*Test.class" />
<include name="**/*Test$*.class" />
<include name="**/*TestCase.class" />
<include name="**/*TestCase$*.class" />
<!-- Additional test classes should be listed here -->
</fileset>
</move>
</target>
<target name="copy-resources">
<copy todir="classes/base">
<fileset dir="src">
<include name="**/LICENSE" />
<include name="**/README" />
<include name="**/*.gif" />
<include name="**/*.png" />
<include name="**/*.jpg" />
<include name="**/*.jpeg" />
<include name="**/*.properties" />
<!-- Additional resource files should be listed here -->
</fileset>
</copy>
</target>
<target name="unjar-libs">
<antcall target="do-unjar-libs">
<param name="generate-sourcedir" value="lib" />
<param name="generate-dir" value="classes/lib" />
</antcall>
</target>
<target name="do-unjar-libs" depends="check-generate-dir-from-dir" unless="already-generated">
<echo message="Unjarring jar files in the lib directory" />
<!-- Delete "classes/lib" in case it exists (but is out of date) -->
<delete dir="classes/lib" />
<mkdir dir="classes/lib" />
<unjar dest="classes/lib">
<fileset refid="libs" />
<patternset excludes="META-INF/**" />
</unjar>
</target>
<target name="compile-14" depends="compile-15, resolve-java14-runtime, resolve-java14-tools"
description="Create 1.4 versions of the classes (after compiling)">
<!-- Note: This target, in addition to checking 1.4 compatibility, serves to ensure that there are no dependencies
on test classes or JUnit classes in the base. If 1.4 compatibility is no longer needed, a similar dependency
check should probably still be done. -->
<echo message="Generating 1.4 versions of the classes directories (this may take a while after a large compile)" />
<!-- Convert lib classes -->
<mkdir dir="classes/lib-14" />
<retroweaver srcdir="classes/lib" destdir="classes/lib-14" target="1.4" verify="no" />
<copy todir="classes/lib-14">
<fileset dir="classes/lib" excludes="**/*.class" />
</copy>
<!-- Convert base classes -->
<mkdir dir="classes/base-14" />
<pathconvert property="retroweaver-base-classpath" dirsep="${file.separator}" pathsep="${path.separator}">
<path>
<pathelement location="${java14-runtime}" />
<pathelement location="${java14-tools}" />
<pathelement location="${clover-jar}" />
<pathelement location="classes/base-14" />
<pathelement location="classes/lib-14" />
</path>
</pathconvert>
<retroweaver srcdir="classes/base" destdir="classes/base-14" target="1.4" verify="yes"
classpath="${retroweaver-base-classpath}" />
<copy todir="classes/base-14">
<fileset dir="classes/base" excludes="**/*.class" />
</copy>
<!-- Convert test classes -->
<mkdir dir="classes/test-14" />
<pathconvert property="retroweaver-test-classpath" dirsep="${file.separator}" pathsep="${path.separator}">
<path>
<pathelement location="${java14-runtime}" />
<pathelement location="${java14-tools}" />
<pathelement location="${clover-jar}" />
<pathelement location="lib/buildlib/junit.jar" />
<pathelement location="classes/base-14" />
<pathelement location="classes/lib-14" />
<pathelement location="classes/test-14" />
</path>
</pathconvert>
<!-- We do not check references here, thus allowing 1.5 references in test classes -->
<retroweaver srcdir="classes/test" destdir="classes/test-14" target="1.4" verify="no" />
<copy todir="classes/test-14">
<fileset dir="classes/test" excludes="**/*.class" />
</copy>
<!-- Invoke rmic -->
<rmic base="classes/base-14" includeAntRuntime="no">
<include name="edu/rice/cs/drjava/model/repl/newjvm/InterpreterJVM.class" />
<include name="edu/rice/cs/drjava/model/repl/newjvm/MainJVM.class" />
<!-- Additional base RMI classes should be listed here -->
<classpath>
<pathelement location="${java14-tools}" />
<pathelement location="${clover-jar}" />
<pathelement location="classes/base-14" />
<pathelement location="classes/lib-14" />
</classpath>
</rmic>
<rmic base="classes/test-14" includeAntRuntime="no">
<include name="edu/rice/cs/util/newjvm/IntegratedMasterSlaveTest$TestMasterJVM.class" />
<include name="edu/rice/cs/util/newjvm/IntegratedMasterSlaveTest$CounterSlave.class" />
<!-- Additional test RMI classes should be listed here -->
<classpath>
<pathelement location="${java14-tools}" />
<pathelement location="${clover-jar}" />
<pathelement location="classes/base-14" />
<pathelement location="classes/test-14" />
<pathelement location="classes/lib-14" />
</classpath>
</rmic>
</target>
<!-- ***************
Testing Targets
*************** -->
<target name="test" depends="test-15" description="Shortcut for 'test-15'">
</target>
<target name="test-15" depends="compile-15"
description="Run all 5.0 tests under Java 5.0 (after compiling); use -Dtest-spec=... to filter">
<antcall target="iterate-tests">
<param name="do-test-target" value="do-test-15" />
</antcall>
</target>
<target name="test-14" depends="compile-14"
description="Run all 1.4 tests under Java 1.4 (after compiling); use -Dtest-spec=... to filter">
<antcall target="iterate-tests">
<param name="do-test-target" value="do-test-14" />
</antcall>
</target>
<target name="test-14-in-15" depends="compile-14, assert-15"
description="Run all 1.4 tests under Java 5.0 (after compiling); use -Dtest-spec=... to filter">
<antcall target="iterate-tests">
<param name="do-test-target" value="do-test-14-in-15" />
</antcall>
</target>
<target name="iterate-tests" depends="resolve-test-formatter-class">
<condition property="test-iteration-message">
<not>
<equals arg1="${test-repeat}" arg2="1" />
</not>
</condition>
<condition property="test-output-to-file" value="yes" else="no">
<equals arg1="${test-formatter}" arg2="xml" />
</condition>
<!-- Repeat tests 'test-repeat' times. -->
<fornum count="${test-repeat}" param="iteration">
<sequential>
<math result="iteration1" datatype="int"
operand1="@{iteration}" operation="+" operand2="1" />
<if>
<isset property="test-iteration-message" />
<then>
<!-- Output message -->
<echo message="" />
<echo message="Running iteration ${iteration1} of ${test-repeat}..." />
</then>
</if>
<trycatch>
<try>
<for list="${test-spec}" param="test-filter-string-iter">
<sequential>
<limit minutes="${test-timeout}" failonerror="true">
<antcall target="${do-test-target}">
<param name="test-filter-string" value="@{test-filter-string-iter}" />
</antcall>
</limit>
</sequential>
</for>
<if>
<istrue value="${test-output-to-file}" />
<then>
<mkdir dir="testResults/@{iteration}" />
</then>
</if>
</try>
<catch>
<property name="${do-test-target}-failed" value="true"/>
<fail if="${do-test-target}-failed" message="One or more unit tests failed."/>
</catch>
<finally>
<move todir="testResults/@{iteration}">
<fileset dir="${basedir}">
<include name="TEST*" />
</fileset>
</move>
</finally>
</trycatch>
</sequential>
</fornum>
</target>
<selector id="tests-to-run">
<and>
<filename name="**/*${test-filter-string}*/**" />
<filename name="**/*Test.class" />
</and>
</selector>
<target name="do-test-15"
depends="assert-15, resolve-java15-tools, resolve-jvm-args">
<echo message="Running all 5.0 tests matching '${test-filter-string}' under Java 5.0" />
<junit haltonfailure="${test-halt}"
failureproperty="do-test-15-failed"
fork="yes"
forkmode="perTest"
maxmemory="256M"
dir="${basedir}">
<classpath>
<pathelement location="${java15-tools}" />
<pathelement location="lib/buildlib/junit.jar" />
<pathelement location="lib/buildlib/plt-ant.jar" /> <!-- required for custom formatter -->
<pathelement location="${clover-jar}" />
<pathelement location="classes/test" />
<pathelement location="classes/base" />
<pathelement location="classes/lib" />
</classpath>
<assertions>
<enable />
</assertions>
<syspropertyset>
<propertyref prefix="plt." />
</syspropertyset>
<jvmarg line="${jvm-args}" />
<formatter classname="${test-formatter-class}" usefile="${test-output-to-file}" />
<batchtest>
<fileset dir="classes/test">
<selector refid="tests-to-run" />
</fileset>
</batchtest>
</junit>
<fail if="do-test-15-failed" message="One or more unit tests failed."/>
</target>
<target name="do-test-14"
depends="resolve-java14-exec, resolve-java14-tools, resolve-jvm-args, resolve-test-formatter-class">
<echo message="Running all 1.4 tests matching '${test-spec}' under Java 1.4" />
<echo message="WARNING: 1.4-compatible test classes are (intentionally) not checked for Java 5 API references." />
<echo message="If such references exist, these tests will probably fail." />
<junit haltonfailure="${test-halt}"
failureproperty="do-test-14-failed"
fork="yes"
forkmode="perTest"
maxmemory="256M"
jvm="${java14-exec}"
dir="${basedir}">
<classpath>
<pathelement location="${java14-tools}" />
<pathelement location="lib/buildlib/junit.jar" />
<pathelement location="lib/buildlib/plt-ant.jar" /> <!-- required for custom formatter -->
<pathelement location="${clover-jar}" />
<pathelement location="classes/test-14" />
<pathelement location="classes/base-14" />
<pathelement location="classes/lib-14" />
</classpath>
<assertions>
<enable />
</assertions>
<syspropertyset>
<propertyref prefix="plt." />
</syspropertyset>
<jvmarg line="${jvm-args}" />
<formatter classname="${test-formatter-class}" usefile="false" />
<batchtest>
<fileset dir="classes/test-14">
<selector refid="tests-to-run" />
</fileset>
</batchtest>
</junit>
<fail if="do-test-14-failed" message="One or more unit tests failed."/>
</target>
<target name="do-test-14-in-15"
depends="assert-15, resolve-java15-tools, resolve-jvm-args, resolve-test-formatter-class">
<echo message="Running all 1.4 tests matching '${test-spec}' under Java 5.0" />
<junit haltonfailure="${test-halt}"
failureproperty="do-test-14-in-15-failed"
fork="yes"
forkmode="perTest"
maxmemory="256M"
dir="${basedir}">
<classpath>
<pathelement location="${java15-tools}" />
<pathelement location="lib/buildlib/junit.jar" />
<pathelement location="lib/buildlib/plt-ant.jar" /> <!-- required for custom formatter -->
<pathelement location="${clover-jar}" />
<pathelement location="classes/test-14" />
<pathelement location="classes/base-14" />
<pathelement location="classes/lib-14" />
</classpath>
<assertions>
<enable />
</assertions>
<syspropertyset>
<propertyref prefix="plt." />
</syspropertyset>
<jvmarg line="${jvm-args}" />
<formatter classname="${test-formatter-class}" usefile="false" />
<batchtest>
<fileset dir="classes/test-14">
<selector refid="tests-to-run" />
</fileset>
</batchtest>
</junit>
<fail if="do-test-14-in-15-failed" message="One or more unit tests failed."/>
</target>
<target name="run" depends="run-15" description="Shortcut for 'run-15'">
</target>
<target name="run-15" depends="compile-15, assert-15, resolve-java15-tools, resolve-jvm-args"
description="Run the main class (5.0 version) under Java 5.0 (after compiling)">
<echo message="Running the DrJava application (5.0 classes in Java 5.0)" />
<java classname="${main-class}" fork="yes" spawn="yes">
<classpath>
<pathelement location="${java15-tools}" />
<pathelement location="classes/base" />
<pathelement location="classes/lib" />
</classpath>
<assertions>
<enable />
</assertions>
<syspropertyset>
<propertyref prefix="plt." />
</syspropertyset>
<jvmarg line="${jvm-args}" />
</java>
</target>
<target name="run-14" depends="compile-14, resolve-java14-exec, resolve-java14-tools, resolve-jvm-args"
description="Run the main class (1.4 version) under Java 1.4 (after compiling)">
<echo message="Running the DrJava application (1.4 classses in Java 1.4)" />
<java classname="${main-class}" jvm="${java14-exec}" fork="yes" spawn="yes">
<classpath>
<pathelement location="${java14-tools}" />
<pathelement location="classes/base-14" />
<pathelement location="classes/lib-14" />
</classpath>
<assertions>
<enable />
</assertions>
<syspropertyset>
<propertyref prefix="plt." />
</syspropertyset>
<jvmarg line="${jvm-args}" />
</java>
</target>
<target name="run-14-in-15" depends="compile-14, assert-15, resolve-java15-tools, resolve-jvm-args"
description="Run the main class (1.4 version) under Java 5.0 (after compiling)">
<echo message="Running the DrJava application (1.4 classses in Java 5.0)" />
<java classname="${main-class}" fork="yes" spawn="yes">
<classpath>
<pathelement location="${java15-tools}" />
<pathelement location="classes/base-14" />
<pathelement location="classes/lib-14" />
</classpath>
<assertions>
<enable />
</assertions>
<syspropertyset>
<propertyref prefix="plt." />
</syspropertyset>
<jvmarg line="${jvm-args}" />
</java>
</target>
<!-- ***************
FindBugs Target
Need to have FindBugs 1.3.1 installed and set the
FINDBUGS_HOME environment variable to that directory.
*************** -->
<target name="findbugs" depends="jar" description="Run findbugs 1.3.1 on the drjava code base creating the file findbugs.html">
<available property="findbugs-exists" file="${env.FINDBUGS_HOME}/lib/findbugs.jar" />
<fail message="FindBugs installation not found, or FINDBUGS_HOME environment variable not set."
unless="findbugs-exists" />
<delete file="${basedir}/findbugs.html" />
<findbugs home="${findbugs-home}"
output="html"
jvmargs="-Xmx512M"
failOnError="true"
outputFile="${basedir}/findbugs.html"
timeout="1800000"
excludeFilter="${basedir}/lib/buildlib/findbugs-filter.xml">
<auxClasspath path="${java15-tools}"/>
<sourcePath path="${basedir}/src"/>
<class location="${basedir}/${ant.project.name}-15.jar"/>
</findbugs>
</target>
<!-- ***********
Jar Targets
*********** -->
<target name="jar" depends="jar-15" description="Shortcut for 'jar-15'" />
<target name="jar-15" depends="compile-15, resolve-version-tag"
description="Create the 5.0 jar file with all classes and libs (compiling first)">
<jar jarfile="${ant.project.name}-15.jar">
<manifest>
<attribute name="Main-Class" value="${main-class}" />
<attribute name="Built-By" value="${user.name}" />
<attribute name="Build-Version" value="${version-tag}" />
</manifest>
<fileset dir="classes/lib" />
<fileset dir="classes/base" />
</jar>
</target>
<target name="jar-base-15" depends="compile-15, resolve-version-tag"
description="Create the 5.0 jar file without any support libs (compiling first)">
<jar jarfile="${ant.project.name}-base-15.jar">
<manifest>
<attribute name="Main-Class" value="${main-class}" />
<attribute name="Built-By" value="${user.name}" />
<attribute name="Build-Version" value="${version-tag}" />
</manifest>
<fileset dir="classes/base" />
</jar>
</target>
<target name="jar-14" depends="compile-14, resolve-version-tag"
description="Create the 1.4 jar file with all classes and libs (compiling first)">
<jar jarfile="${ant.project.name}.jar">
<manifest>
<attribute name="Main-Class" value="${main-class}" />
<attribute name="Built-By" value="${user.name}" />
<attribute name="Build-Version" value="${version-tag}" />
</manifest>
<fileset dir="classes/lib-14" />
<fileset dir="classes/base-14" />
</jar>
</target>
<target name="jar-base-14" depends="compile-14, resolve-version-tag"
description="Create the 1.4 jar file without any support libs (compiling first)">
<jar jarfile="${ant.project.name}-base-14.jar">
<manifest>
<attribute name="Main-Class" value="${main-class}" />
<attribute name="Built-By" value="${user.name}" />
<attribute name="Build-Version" value="${version-tag}" />
</manifest>
<fileset dir="classes/base-14" />
</jar>
</target>
<!-- *********************
Documentation Targets
********************* -->
<target name="javadoc" depends="generate-source, assert-15, resolve-java15-tools, resolve-version-tag"
description="Generate javadocs from the source folder (after generating the source)">
<antcall target="do-javadoc">
<param name="generate-sourcedir" value="src" />
<param name="generate-dir" value="docs/javadoc" />
</antcall>
</target>
<target name="do-javadoc" depends="check-generate-dir-from-dir" unless="already-generated">
<echo message="Generating javadocs" />
<delete dir="docs/javadoc" />
<mkdir dir="docs/javadoc" />
<javadoc sourcepath="src" packagenames="*" destdir="docs/javadoc"
access="protected" Use="yes" Version="yes" Author="yes" Windowtitle="${readable-project-name} API (${version-tag})">
<classpath>
<pathelement location="${java15-tools}" />
<fileset refid="libs" />
<pathelement location="lib/buildlib/junit.jar" />
</classpath>
<link href="http://java.sun.com/j2se/1.5/docs/api" />
<link href="http://junit.org/junit/javadoc/3.8.1" />
<link href="http://drjava.org/javadoc/plt" />
<link href="http://drjava.org/javadoc/javalanglevels" />
<link href="http://drjava.org/javadoc/dynamicjava" />
<!-- Additional external library APIs may be listed here -->
</javadoc>
</target>
<target name="clover" depends="clover-15" description="Shortcut for 'clover-15'">
</target>
<target name="clover-15" depends="clean, setup-clover, test-15, report-clover"
description="Generate a Clover test coverage report (using 'test-15')" />
<target name="clover-14" depends="clean, setup-clover, test-14, report-clover"
description="Generate a Clover test coverage report (using 'test-14')" />
<target name="clover-14-in-15" depends="clean, setup-clover, test-14-in-15, report-clover"
description="Generate a Clover test coverage report (using 'test-14-in-15')" />
<target name="report-clover" depends="resolve-version-tag">
<echo message="Generating Clover report" />
<clover-report>
<current outfile="docs/clover" title="${readable-project-name} Test Coverage (${version-tag})">
<format type="html" />
</current>
</clover-report>
<antcall target="clean-intermediate"> <!-- Remove instrumented class files -->
<param name="clean-can-fail" value="no" />
</antcall>
</target>
<target name="setup-clover" depends="assert-clover-jar-exists">
<!-- <property name="clover.license.path" value="${basedir}/lib/buildlib/clover.license"/> -->
<extendclasspath path="${clover-jar}" />
<taskdef resource="clovertasks" classpath="${clover-jar}" />
<mkdir dir="cloverdb" />
<clover-setup initString="cloverdb/clover.db">
<files>
<exclude name="**/*Test.java" />
<exclude name="**/*TestCase.java" />
<!-- Additional test sources should be listed here -->
</files>
</clover-setup>
</target>
<target name="benchmark" depends="benchmark-current, benchmark-previous, benchmark-report"
description="Generate a test performance report">
</target>
<target name="benchmark-current" depends="resolve-is-modified" if="is-modified">
<echo message="*****************************************" />
<echo message="Running benchmark tests on the local copy" />
<echo message="*****************************************" />
<mkdir dir="benchmarkResults/local" />
<trycatch>
<try>
<antcall target="compile-15" />
<antcall target="iterate-tests">
<param name="do-test-target" value="do-test-15" />
<param name="test-formatter" value="xml" />
</antcall>
</try>
<catch>
<property name="do-test-15-failed" value="true"/>
<fail if="do-test-15-failed" message="One or more unit tests failed."/>
</catch>
</trycatch>
<move todir="benchmarkResults/local" file="testResults" />
</target>
<target name="benchmark-previous">
<mkdir dir="benchmarkSources" />
<echo message="Checking out the Subversion head revision" />
<exec executable="svn" failonerror="yes">
<arg value="checkout" />
<arg value="--quiet" />
<arg value="--revision" />
<arg value="HEAD" />
<arg value="${svn-repository}/trunk/${ant.project.name}" />
<arg value="benchmarkSources" />
</exec>
<antcall target="benchmark-single-previous">
<param name="svn-working-dir" location="benchmarkSources" />
</antcall>
<math result="remaining-benchmark-count" datatype="int"
operand1="${benchmark-count}" operation="-" operand2="1" />
<fornum count="${remaining-benchmark-count}" param="iteration">
<sequential>
<antcall target="benchmark-revert" />
<antcall target="benchmark-single-previous">
<param name="svn-working-dir" location="benchmarkSources" />
</antcall>
</sequential>
</fornum>
<delete dir="benchmarkSources" />
</target>
<target name="benchmark-single-previous" depends="resolve-svn-revision">
<echo message="*****************************************" />
<echo message="Running benchmark tests on revision ${svn-revision}" />
<echo message="*****************************************" />
<!-- Change the build script text for builds that don't support test-output-to-file -->
<replaceregexp file="benchmarkSources/build.xml" flags="g"
match="<formatter.*usefile="false".*/>"
replace="<formatter type="xml" usefile="true"/>" />
<!-- Eliminate taskdefs, which are apparently inherited (Ant complains otherwise) -->
<replaceregexp file="benchmarkSources/build.xml" flags="gs"
match="<taskdef[^>]*>" replace="" />
<mkdir dir="benchmarkResults/${svn-revision}" />
<trycatch>
<try>
<!-- Must iterate tests *here* to support scripts that don't do test-repeat -->
<antcall target="iterate-tests">
<param name="do-test-target" value="do-test-previous" />
<param name="test-formatter" value="xml" />
<!-- test-output-to-file is not inferred in some build scripts -->
<param name="test-output-to-file" value="yes" />
</antcall>
<ant dir="benchmarkSources" target="clean" />
</try>
<catch>
<property name="do-test-failed" value="true"/>
<fail if="do-test-failed" message="One or more unit tests failed."/>
</catch>
</trycatch>
<exec executable="svn" dir="benchmarkSources" failonerror="yes">
<arg value="revert" />
<arg value="--quiet" />
<arg value="build.xml" />
</exec>
<move todir="benchmarkResults/${svn-revision}" file="testResults" />
</target>
<target name="do-test-previous">
<trycatch>
<try>
<ant dir="benchmarkSources">
<!-- compile in case it doesn't happen automatically -->
<target name="compile" />
<target name="test" />
<property name="test-repeat" value="1" />
</ant>
</try>
<catch>
<property name="do-test-failed" value="true"/>
<fail if="do-test-failed" message="One or more unit tests failed."/>
</catch>
<finally>
<move todir="${basedir}">
<fileset dir="benchmarkSources">
<include name="TEST*" />
</fileset>
</move>
</finally>
</trycatch>
</target>
<target name="benchmark-revert">
<echo message="Updating benchmarkSources to a previous revision" />
<fornum count="${benchmark-skip}" param="iteration">
<sequential>
<exec executable="svn" dir="benchmarkSources" failonerror="yes">
<arg value="update" />
<arg value="--revision" />
<arg value="PREV" />
</exec>
</sequential>
</fornum>
</target>
<target name="benchmark-report">
<mkdir dir="docs/benchmark" />
<!-- report should be generated in docs/benchmark -->
<echo message="Report generation not yet implemented" />
<delete dir="benchmarkResults" />
</target>
<!-- *************
Clean Targets
************* -->
<target name="clean" depends="clean-intermediate, clean-products"
description="Remove all build products; the result should match the intended Subversion contents">
</target>
<target name="clean-intermediate" unless="skip-clean">
<echo message="Deleting all intermediate build products" />
<delete dir="classes" failonerror="${clean-can-fail}" />
<delete dir="cloverdb" failonerror="${clean-can-fail}" />
<delete dir="testResults" failonerror="${clean-can-fail}" />
<delete dir="benchmarkSources" failonerror="${clean-can-fail}" />
<delete dir="benchmarkResults" failonerror="${clean-can-fail}" />
<delete includeemptydirs="true" failonerror="${clean-can-fail}">
<fileset dir="testFiles">
<exclude name="**" />
<!-- Additional test output files should be listed here -->
</fileset>
<fileset dir="${basedir}">
<patternset refid="generated-sources" />
</fileset>
<fileset dir="${basedir}" defaultexcludes="no">
<include name="TEST*" />
<include name="src/**/*.class" />
<!-- We could get rid of backups, but "update" ignores them, so they're okay.
(doesn't work if defaultexcludes is "yes") -->
<!-- <include name="**/*~" /> -->
<!-- Get rid of pesky OS helper files (doesn't work if defaultexcludes is "yes") -->
<include name="**/.DS_Store" />
<include name="**/Thumbs.db" />
<!-- Additional files to delete may be listed here -->
</fileset>
</delete>
</target>
<target name="clean-products" unless="skip-clean">
<echo message="Deleting all final build products" />
<delete dir="docs" failonerror="${clean-can-fail}" />
<delete includeemptydirs="true" failonerror="${clean-can-fail}">
<fileset dir="${basedir}" defaultexcludes="no">
<include name="*.jar" />
<include name="*.zip" />
<include name="*.tar.gz" />
<include name="findbugs.html" />
</fileset>
</delete>
</target>
<!-- ******************
Subversion Targets
****************** -->
<target name="update" depends="clean" description="Reconcile source with the Subversion archive">
<echo message="Running Subversion update" />
<exec executable="svn" dir="${svn-working-dir}" failonerror="yes">
<arg value="update" />
</exec>
<exec executable="svn" dir="${svn-working-dir}" failonerror="yes">
<arg value="status" />
</exec>
</target>
<target name="commit" depends="update, build"
description="Commit source to the Subversion archive (after building)">
<antcall target="clean-intermediate"> <!-- Clean up after the latest build -->
<param name="clean-can-fail" value="no" />
</antcall>
<exec executable="svn" dir="${svn-working-dir}" failonerror="yes">
<arg value="status" />
</exec>
<input message="Please enter a log message for the commit: "
addproperty="svn-commit-message" />
<echo message="Running Subversion commit" />
<exec executable="svn" dir="${svn-working-dir}" failonerror="yes">
<arg value="commit" />
<arg value="-m" />
<arg value="${svn-commit-message}" />
</exec>
</target>
<target name="tag" depends="update, resolve-version-tag"
description="Copy the working copy to a new Subversion tag (after updating)">
<echo message="Creating a new Subversion tag with name ${version-tag}"/>
<exec executable="svn" failonerror="yes">
<arg value="copy" />
<arg value="${basedir}" />
<arg value="${svn-repository}/tags/${version-tag}" />
<arg value="-m" />
<arg value="Created tag ${version-tag}" />
</exec>
</target>
<target name="branch" depends="update"
description="Copy the working copy to a new Subversion branch (after updating)">
<echo message="This will create a new branch from your working copy. If there are changes " />
<echo message="in your copy that have not been committed, you may want to do so first, " />
<echo message="so that there's a clear branch point for merging later." />
<input message="Enter a name for the new branch: "
addproperty="svn-branch-name" />
<echo message="Creating a new Subversion branch ${svn-branch-name}" />
<exec executable="svn" failonerror="yes">
<arg value="copy" />
<arg value="${basedir}" />
<arg value="${svn-repository}/branches/${svn-branch-name}" />
<arg value="-m" />
<arg value="Created branch ${svn-branch-name}" />
</exec>
</target>
<!-- ***************
Release Targets
*************** -->
<target name="release-stable" description="Generate all release files tagged with 'stable'">
<antcall target="release">
<param name="tag-append" value="-stable" />
<param name="is-development" value="no" />
</antcall>
</target>
<target name="release-beta" description="Generate all release files tagged with 'beta'">
<antcall target="release">
<param name="tag-append" value="-beta" />
<param name="is-development" value="no" />
</antcall>
</target>
<target name="release"
depends="update, build, tag, jar-app, mac-app, windows-app, src-zip, javadoc-zip"
description="Generate all release files (after building)">
<delete dir="${version-tag}" />
</target>
<target name="jar-app" depends="assert-jar-exists, resolve-version-tag">
<echo message="Creating ${version-tag}.jar" />
<copy file="${ant.project.name}.jar" tofile="${version-tag}.jar" />
</target>
<target name="mac-app" depends="assert-jar-exists, resolve-version-tag">
<echo message="Creating ${version-tag}-osx.tar.gz" />
<property name="mac-app-dir" value="${version-tag}/osx" />
<mkdir dir="${mac-app-dir}" />
<filter token="VERSION" value="${version-tag}" />
<copy todir="${mac-app-dir}/${readable-project-name}.app" filtering="yes" >
<fileset dir="packaging/mac/${readable-project-name}.app" excludes="**/*jar-goes-here" />
</copy>
<copy file="${ant.project.name}.jar"
todir="${mac-app-dir}/${readable-project-name}.app/Contents/Resources/Java" />
<zip destfile="${version-tag}-osx.zip" basedir="${mac-app-dir}" />
</target>
<target name="windows-app" depends="assert-jar-exists, resolve-version-tag">
<echo message="Creating ${version-tag}-windows.zip" />
<property name="windows-app-dir" value="${version-tag}/windows" />
<mkdir dir="${windows-app-dir}" />
<filter token="VERSION" value="${version-tag}" />
<copy todir="${windows-app-dir}" filtering="yes" >
<fileset dir="packaging/windows" />
</copy>
<copy file="${ant.project.name}.jar" todir="${windows-app-dir}" />
<launch4j configfile="${windows-app-dir}/launch4j-config.xml" />
<zip destfile="${version-tag}-windows.zip" basedir="${windows-app-dir}"
includes="${readable-project-name}.exe" />
</target>
<target name="src-zip" depends="resolve-version-tag">
<echo message="Creating ${version-tag}-src.zip" />
<exec executable="svn" failonerror="yes">
<arg value="export" />
<arg value="${svn-repository}/tags/${version-tag}" />
<arg value="${version-tag}/src" />
</exec>
<zip destfile="${version-tag}-src.zip">
<zipfileset dir="${version-tag}/src" prefix="${version-tag}/src" />
</zip>
</target>
<target name="javadoc-zip" depends="javadoc, resolve-version-tag">
<echo message="Creating ${version-tag}-javadoc.zip" />
<zip destfile="${version-tag}-javadoc.zip">
<zipfileset dir="docs/javadoc" prefix="${version-tag}/javadoc" />
</zip>
</target>
<!-- We don't include this in the standard release process, because we don't want to
include instrumented files in the release, and because Clover must be run on a
licensed machine -->
<target name="clover-zip" depends="clover-14-in-15, resolve-version-tag">
<echo message="Creating ${version-tag}-clover.zip" />
<zip destfile="${version-tag}-clover.zip">
<zipfileset dir="docs/clover" prefix="${version-tag}/clover" />
</zip>
</target>
<!-- ********************************
Misc Occasionally-Useful Targets
******************************** -->
<patternset id="exclude-binaries">
<exclude name="**/*.jar" />
<exclude name="**/*.class" />
<exclude name="**/DrJava" />
<exclude name="**/*.png" />
<exclude name="**/*.icns" />
<exclude name="**/*.gif" />
<exclude name="**/*.jpg" />
<exclude name="**/*.jpeg" />
<!-- Additional binary types may be added here -->
</patternset>
<!-- Run a batch find-and-replace on all text files in the project.
Assumes the properties "find" and "replace" have been defined
(e.g. "ant -Dfind=foo -Dreplace=bar find-and-replace"). -->
<target name="find-and-replace">
<replace dir="${basedir}" token="${find}" value="${replace}" summary="yes">
<patternset refid="exclude-binaries" />
</replace>
</target>
<!-- Standardize all newline character sequences. Subversion takes care of this
automatically, but sometimes files crop up with the wrong sequence.
Use "svn status" after running this to see which files were fixed. -->
<target name="fix-newlines" description="Standardize newline character sequences in all text files">
<!-- If we're in Windows, use \r\n -->
<condition property="newline-code" value="crlf">
<os family="windows" />
</condition>
<!-- Otherwise, use \n -->
<property name="newline-code" value="lf" />
<fixcrlf srcdir="${basedir}" eol="${newline-code}" fixlast="no">
<patternset refid="exclude-binaries" />
</fixcrlf>
</target>
<!-- ***************************
Property-resolution Targets
*************************** -->
<target name="resolve-java14-runtime">
<!-- We rely on "location" to generate a platform-specific path; note that properties
are immutable and so java14-runtime will only be set the *first* time. -->
<property name="java14-runtime-1" location="${java14-home}/lib/rt.jar" />
<available property="java14-runtime" value="${java14-runtime-1}" file="${java14-runtime-1}" />
<property name="java14-runtime-2" location="${java14-home}/jre/lib/rt.jar" />
<available property="java14-runtime" value="${java14-runtime-2}" file="${java14-runtime-2}" />
<property name="java14-runtime-3" location="${java14-home}/../Classes/classes.jar" />
<available property="java14-runtime" value="${java14-runtime-3}" file="${java14-runtime-3}" />
<fail message="Can't find rt.jar in the Java 1.4 home: ${java14-home}" unless="java14-runtime" />
</target>
<target name="resolve-java14-exec">
<!-- We rely on "location" to generate a platform-specific path -->
<property name="java14-exec-1" location="${java14-home}/bin/java.exe" />
<condition property="java14-exec" value="${java14-exec-1}">
<and>
<available file="${java14-exec-1}" />
<os family="windows" />
</and>
</condition>
<property name="java14-exec-2" location="${java14-home}/bin/java" />
<available property="java14-exec" value="${java14-exec-2}" file="${java14-exec-2}" />
<fail message="Can't find the java executable in the Java 1.4 home: ${java14-home}" unless="java14-exec" />
</target>
<target name="resolve-java14-tools">
<!-- We rely on "location" to generate a platform-specific path; note that properties
are immutable and so java15-tools will only be set the *first* time. -->
<property name="java14-tools-1" location="${java14-home}/lib/tools.jar" />
<available property="java14-tools" value="${java14-tools-1}" file="${java14-tools-1}" />
<property name="java14-tools-2" location="${java14-home}/jre/lib/tools.jar" />
<available property="java14-tools" value="${java14-tools-2}" file="${java14-tools-2}" />
<property name="java14-tools-3" location="${java14-home}/../Classes/classes.jar" />
<available property="java14-tools" value="${java14-tools-3}" file="${java14-tools-3}" />
<fail message="Can't find tools.jar in the Java 1.4 home: ${java14-home}" unless="java14-tools" />
</target>
<target name="resolve-java15-tools" depends="assert-15">
<!-- We rely on "location" to generate a platform-specific path; note that properties
are immutable and so java15-tools will only be set the *first* time. -->
<property name="java15-tools-1" location="${java.home}/../lib/tools.jar" />
<available property="java15-tools" value="${java15-tools-1}" file="${java15-tools-1}" />
<property name="java15-tools-2" location="${java.home}/../Classes/classes.jar" />
<available property="java15-tools" value="${java15-tools-2}" file="${java15-tools-2}" />
<fail message="Can't find tools.jar in the Java 1.5 home: ${java.home}" unless="java15-tools" />
</target>
<target name="assert-15">
<fail message="The specified target requires Ant to be run under Java 5.0 or later">
<condition>
<not>
<or>
<contains string="${java.version}" substring="1.5." />
<contains string="${java.version}" substring="1.6." />
</or>
</not>
</condition>
</fail>
</target>
<target name="assert-jar-exists">
<available property="jar-exists" file="${ant.project.name}.jar" />
<fail message="Can't find ${ant.project.name}.jar" unless="jar-exists" />
</target>
<target name="assert-clover-jar-exists">
<available property="clover-jar-exists" file="${clover-jar}" />
<fail message="${clover-jar} does not exist" unless="clover-jar-exists" />
</target>
<target name="resolve-development-value">
<condition property="development-value" value="true">
<istrue value="${is-development}" />
</condition>
<!-- else... -->
<property name="development-value" value="false" />
</target>
<target name="resolve-jvm-args">
<!-- First create individual parts of the 'jvm-args' line; note that the space at
the end of the strings is necessary to separate the values. -->
<!-- 'force-server' property -->
<condition property="jvm-args-force-server" value="-server ">
<istrue value="${force-server}" />
</condition>
<!-- else... -->
<property name="jvm-args-force-server" value="" />
<!-- 'test-drjava-config' property -->
<condition property="jvm-args-test-drjava-config" value="-Dtest.drjava.config=${test-drjava-config} ">
<isset property="test-drjava-config" />
</condition>
<!-- else... -->
<property name="jvm-args-test-drjava-config" value="-Dtest.drjava.config=${basedir}/testFiles/drjava.basic.config " />
<!-- Now assemble all arguments; no spaces between the individual arguments so
arguments not set disappear completely (without multiple spaces inbetween). -->
<property name="jvm-args" value="${jvm-args-force-server}${jvm-args-test-drjava-config}" />
</target>
<target name="resolve-test-formatter-class">
<condition property="test-formatter-class"
value="edu.rice.cs.plt.ant.QuietJUnitResultFormatter">
<equals arg1="quiet" arg2="${test-formatter}" />
</condition>
<condition property="test-formatter-class"
value="edu.rice.cs.plt.ant.OneLineJUnitResultFormatter">
<equals arg1="oneline" arg2="${test-formatter}" />
</condition>
<condition property="test-formatter-class"
value="org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter">
<equals arg1="brief" arg2="${test-formatter}" />
</condition>
<condition property="test-formatter-class"
value="org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter">
<equals arg1="plain" arg2="${test-formatter}" />
</condition>
<condition property="test-formatter-class"
value="org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter">
<equals arg1="xml" arg2="${test-formatter}" />
</condition>
<!-- else... -->
<property name="test-formatter-class"
value="edu.rice.cs.plt.ant.OneLineJUnitResultFormatter" />
</target>
<target name="resolve-version-tag">
<!-- Get a timestamp based on GMT, rather than local time -->
<tstamp>
<format property="DSTAMP" pattern="yyyyMMdd" timezone="GMT" />
<format property="TSTAMP" pattern="HHmm" timezone="GMT" />
<format property="TODAY" pattern="MMMM dd yyyy" timezone="GMT" />
</tstamp>
<property name="version-tag"
value="${ant.project.name}${tag-append}-${DSTAMP}-${TSTAMP}" />
</target>
<!-- Sets is-modified if "svn status" has non-empty output. Runs svn in svn-working-dir. -->
<target name="resolve-is-modified" depends="clean">
<exec executable="svn" dir="${svn-working-dir}" failonerror="yes" outputproperty="svn-status">
<arg value="status" />
</exec>
<condition property="is-modified">
<not>
<equals arg1="${svn-status}" arg2="" />
</not>
</condition>
</target>
<!-- Sets svn-revision to the current "Last Changed Rev" of "svn info". Runs svn in svn-working-dir. -->
<target name="resolve-svn-revision">
<exec executable="svn" dir="${svn-working-dir}" failonerror="yes" output="svn-info.txt">
<arg value="info" />
</exec>
<loadfile property="svn-revision" srcfile="svn-info.txt">
<filterchain>
<linecontains>
<contains value="Last Changed Rev: " />
</linecontains>
<replacestring from="Last Changed Rev: " to="" />
</filterchain>
</loadfile>
<delete file="svn-info.txt" />
</target>
<!-- Sets "already-generated" if "generate-file" is more recent than "generate-sourcefile";
otherwise, the out-of-date target file is deleted (if it exists). Note that, since
properties can only be set once, this should happen underneath an "antcall". -->
<target name="check-generate-file-from-file">
<dependset>
<srcfilelist dir="${basedir}" files="${generate-sourcefile}" />
<targetfilelist dir="${basedir}" files="${generate-file}" />
</dependset>
<available file="${generate-file}" property="already-generated" />
</target>
<!-- Sets "already-generated" if "generate-file" is more recent than everything in
"generate-sourcedir"; otherwise, the out-of-date target file is deleted (if it exists).
Note that, since properties can only be set once, this should happen underneath an "antcall". -->
<target name="check-generate-file-from-dir">
<dependset>
<srcfileset dir="${generate-sourcedir}" />
<targetfilelist dir="${basedir}" files="${generate-file}" />
</dependset>
<available file="${generate-file}" property="already-generated" />
</target>
<!-- Sets "already-generated" if "generate-dir" was created (or modified) more recently
than "generate-sourcefile". Note that, since properties can only be set once, this
should happen underneath an "antcall". -->
<target name="check-generate-dir-from-file">
<uptodate property="already-generated" targetfile="${generate-dir}" srcfile="${generate-sourcefile}" />
</target>
<!-- Sets "already-generated" if "generate-dir" was created (or modified) more recently
than everything in "generate-sourcedir". Note that, since properties can only be
set once, this should happen underneath an "antcall". -->
<target name="check-generate-dir-from-dir">
<!-- Unfortunately, a bug in uptodate prevents this from working properly,
so we just have to equate *existence* with being up to date.
<uptodate property="already-generated" targetfile="${generate-dir}" >
<srcfiles dir="${generate-sourcedir}" />
</uptodate>
-->
<available file="${generate-dir}" property="already-generated" />
</target>
</project>