Add ability to run all unit tests with the ant build via "ant test".
Strip trailing whitespace from the build file.master
parent
dd3f975c9d
commit
652f2ba56d
71
build.xml
71
build.xml
|
@ -7,6 +7,7 @@
|
|||
<property name="source" value="1.8"/>
|
||||
<property name="target" value="1.8"/>
|
||||
<property name="lib" value="release/lib" />
|
||||
<property name="testlib" value="test/lib" />
|
||||
<property name="groovy-version" value="2.4.12" />
|
||||
<property name="error-prone-version" value="2.0.19" />
|
||||
|
||||
|
@ -16,12 +17,48 @@
|
|||
</fileset>
|
||||
</path>
|
||||
|
||||
<path id="classpath.test">
|
||||
<fileset dir="${testlib}">
|
||||
<include name="**/*.jar" />
|
||||
</fileset>
|
||||
<path refid="classpath" />
|
||||
</path>
|
||||
|
||||
<path id="classpath.test.full">
|
||||
<pathelement location="build"/>
|
||||
<pathelement location="buildtest" />
|
||||
<path refid="classpath.test" />
|
||||
</path>
|
||||
|
||||
<target name="test" depends="buildtest">
|
||||
<junit haltonerror="true" haltonfailure="true" fork="yes">
|
||||
<classpath refid="classpath.test.full" />
|
||||
<batchtest>
|
||||
<fileset dir="${testdir}">
|
||||
<include name="**/*Test*" />
|
||||
</fileset>
|
||||
</batchtest>
|
||||
<formatter type="brief" usefile="false"/>
|
||||
</junit>
|
||||
</target>
|
||||
|
||||
<property name="testdir" location="test" />
|
||||
<property name="srcdir" location="src" />
|
||||
<property name="full-compile" value="true" />
|
||||
|
||||
<taskdef name="bundleapp"
|
||||
classname="com.oracle.appbundler.AppBundlerTask"
|
||||
classpath="lib/appbundler-1.0.jar" />
|
||||
|
||||
<!-- deps - Download dependencies -->
|
||||
<target name="deps" unless="skip.download">
|
||||
<echo message="downloading junit with hamcrest to ${testlib}"/>
|
||||
<get src="https://repo1.maven.org/maven2/junit/junit/4.12/junit-4.12.jar"
|
||||
dest="${testlib}/junit-4.12.jar"
|
||||
skipexisting="true" />
|
||||
<get src="https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"
|
||||
dest="${testlib}/hamcrest-core-1.3.jar"
|
||||
skipexisting="true" />
|
||||
<echo message="downloading groovy to ${lib}"/>
|
||||
<get src="https://repo1.maven.org/maven2/org/codehaus/groovy/groovy-all/${groovy-version}/groovy-all-${groovy-version}-indy.jar"
|
||||
dest="${lib}/groovy-all-${groovy-version}.jar"
|
||||
|
@ -58,12 +95,15 @@
|
|||
<!-- init - Create temporary directory to build the program -->
|
||||
<target name="init">
|
||||
<mkdir dir="build"/>
|
||||
<mkdir dir="buildtest"/>
|
||||
<mkdir dir="${lib}"/>
|
||||
<mkdir dir="${testlib}"/>
|
||||
</target>
|
||||
|
||||
<!-- clean - Remove temporary directory -->
|
||||
<target name="clean">
|
||||
<delete dir="build"/>
|
||||
<delete dir="buildtest"/>
|
||||
</target>
|
||||
|
||||
<!-- build - Compile sources and copy resources to build directory -->
|
||||
|
@ -77,7 +117,7 @@
|
|||
source="${source}"
|
||||
target="${target}"
|
||||
compiler="com.google.errorprone.ErrorProneAntCompilerAdapter">
|
||||
<src path="src"/>
|
||||
<src path="${srcdir}"/>
|
||||
<compilerarg value="-Xlint"/>
|
||||
<!--
|
||||
<compilerarg value="-XepPatchChecks:MissingOverride,DefaultCharset,ClassCanBeStatic,ShortCircuitBoolean"/>
|
||||
|
@ -97,6 +137,35 @@
|
|||
</copy>
|
||||
</target>
|
||||
|
||||
<!-- buildtest - Compile test sources -->
|
||||
<target depends="init,deps,build" name="buildtest">
|
||||
<javac
|
||||
includeantruntime="false"
|
||||
debug="true"
|
||||
debuglevel="${debuglevel}"
|
||||
encoding="UTF-8"
|
||||
destdir="buildtest"
|
||||
source="${source}"
|
||||
target="${target}"
|
||||
compiler="com.google.errorprone.ErrorProneAntCompilerAdapter">
|
||||
<src path="${testdir}"/>
|
||||
<compilerarg value="-Xlint"/>
|
||||
<!--
|
||||
<compilerarg value="-XepPatchChecks:MissingOverride,DefaultCharset,ClassCanBeStatic,ShortCircuitBoolean"/>
|
||||
<compilerarg value="-XepPatchLocation:IN_PLACE"/>
|
||||
-->
|
||||
<compilerarg value="-Xep:ImmutableEnumChecker:OFF"/>
|
||||
<compilerarg value="-Xep:OperatorPrecedence:OFF"/>
|
||||
<classpath refid="classpath.test" />
|
||||
<classpath>
|
||||
<pathelement location="build"/>
|
||||
</classpath>
|
||||
<compilerclasspath>
|
||||
<pathelement location="lib/error_prone_ant-${error-prone-version}.jar"/>
|
||||
</compilerclasspath>
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<!-- jar (default target) - Create .jar file -->
|
||||
<target depends="build" name="jar">
|
||||
<jar destfile="release/Magarena.jar" basedir="build" includes="**/*.*">
|
||||
|
|
Loading…
Reference in New Issue